示例#1
0
        public void Capture()
        {
            var state = State;

            state.IsAlive = false;
            State         = state;
            gameObject.SetActive(false);
        }
示例#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);
 }
示例#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)));
        }