PlayerCharacter.Update C# (CSharp) Method

Update() protected method

protected Update ( ) : void
return void
    protected override void Update()
    {
        base.Update();
        if (myNetworkView.isMine && !IsDying)
        {
            // If the player is too far to the left on the screen, they shouldn't be able to move back
            if (myTransform.position.x < MinimumScreenX)
            {
                myTransform.position = new Vector3(MinimumScreenX, myTransform.position.y, myTransform.position.z);
            }
            // Players should not be able to walk past the level boss
            else if (myTransform.position.x > MaximumScreenX)
            {
                myTransform.position = new Vector3(MaximumScreenX, myTransform.position.y, myTransform.position.z);
            }
        }
    }

Usage Example

Esempio n. 1
0
 public void Update(GameTime gameTime)
 {
     foreach (ITerrain terrain in Tiles)
     {
         terrain.Update(gameTime);
     }
     for (int i = _creatures.Count - 1; i >= 0; i--)
     {
         _creatures[i].Update(gameTime);
     }
     for (int i = _containers.Count - 1; i >= 0; i--)
     {
         _containers[i].Update(gameTime);
     }
     for (int i = _doors.Count - 1; i >= 0; i--)
     {
         _doors[i].Update(gameTime);
     }
     for (int i = _quests.Count - 1; i >= 0; i--)
     {
         _quests[i].Update(gameTime);
     }
     for (int i = _fire.Count - 1; i >= 0; i--)
     {
         _fire[i].Update(gameTime);
     }
     for (int i = _specialEffects.Count - 1; i >= 0; i--)
     {
         _specialEffects[i].Update(gameTime);
     }
     Player.Update(gameTime);
 }
All Usage Examples Of PlayerCharacter::Update