コード例 #1
0
 private void OnEntityExitCell(GameObject entity, BoardCell cell)
 {
     if (entity == gameObject && Mover.IsMoving)
     {
         ExitCellEffect?.Clone().Apply(this.caster, entity);
         ExitCell?.Invoke(cell);
     }
 }
コード例 #2
0
        public void TryToStep(Direction direction)
        {
            RememberLast = false;
            BaseCell cellToMove = null;

            var hero = Player.GetPlayer;

            switch (direction)
            {
            case Direction.Up:
                cellToMove = this[hero.Coordinates.X, hero.Coordinates.Y - 1];
                break;

            case Direction.Right:
                cellToMove = this[hero.Coordinates.X + 1, hero.Coordinates.Y];
                break;

            case Direction.Down:
                cellToMove = this[hero.Coordinates.X, hero.Coordinates.Y + 1];
                break;

            case Direction.Left:
                cellToMove = this[hero.Coordinates.X - 1, hero.Coordinates.Y];
                break;
            }

            if (cellToMove?.TryToStep() ?? false)
            {
                hero.Coordinates = cellToMove.Coordinates;
            }

            if (Cells[Cells.FindIndex(n => n.Coordinates.X == hero.Coordinates.X & n.Coordinates.Y == hero.Coordinates.Y)].Skin == ExitCell.Skin())
            {
                LastExitX        = hero.Coordinates.X;
                LastExitY        = hero.Coordinates.Y;
                hero.Coordinates = Cells[0].Coordinates;
                GenerateNew      = true;
            }

            if (Cells[Cells.FindIndex(n => n.Coordinates.X == hero.Coordinates.X & n.Coordinates.Y == hero.Coordinates.Y)].Skin == LastMazeCell.Skin())
            {
                hero.Coordinates = Cells[0].Coordinates;
                RememberLast     = true;
            }
        }
コード例 #3
0
 public void CheckSkin()
 {
     Assert.AreEqual(ExitCell.Skin(), skin);
 }
コード例 #4
0
 public void Setup()
 {
     exCell = new ExitCell(0, 0);
     skin   = 'E';
 }