CEngineSharp_Client.World.Entity.Player.Move C# (CSharp) Method

Move() public method

public Move ( int newX, int newY, Directions direction ) : void
newX int
newY int
direction Directions
return void
        public void Move(int newX, int newY, Directions direction)
        {
            this.Direction = direction;

            ServiceLocator.WorldManager.MapManager.Map.GetTile(this.Position.X, this.Position.Y).IsOccupied = false;

            this.Position = new Vector2i(newX, newY);

            ServiceLocator.WorldManager.MapManager.Map.GetTile(newX, newY).IsOccupied = true;

            switch (this.Step)
            {
                case 0:
                    this._previousStep = 0;
                    this.Step++;
                    break;

                case 2:
                    this._previousStep = 2;
                    this.Step--;
                    break;

                case 1:
                    if (this._previousStep == 2)
                        this.Step--;
                    else
                        this.Step++;
                    break;
            }
        }