public void Capture() { var state = State; state.IsAlive = false; State = state; gameObject.SetActive(false); }
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); }
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))); }