Ejemplo n.º 1
0
        public void Capture()
        {
            var state = State;

            state.IsAlive = false;
            State         = state;
            gameObject.SetActive(false);
        }
Ejemplo n.º 2
0
 public void Init(Tile tile, Teams team)
 {
     gameObject.SetActive(true);
     State = new PawnState()
     {
         CurrentTile = tile,
         IsAlive     = true,
         Team        = team,
     };
     transform.position = tile.transform.position;
     tile.Occupy(this);
 }
Ejemplo n.º 3
0
        public IEnumerator MoveTo(Tile tile)
        {
            if (tile.IsOccupied)
            {
                tile.GetOccupyingPawn().Capture();
            }

            if (tile == State.CurrentTile)
            {
                yield break;
            }
            State.CurrentTile.SetUnoccupied();
            tile.Occupy(this);

            var state = State;

            state.CurrentTile = tile;
            State             = state;

            yield return(StartCoroutine(MoveRoutine(tile.transform.position)));
        }