public void CreatePlayers() { boardInput = GetComponent <ChessInputGround>(); HumanPlayerGround whiteHuman = null; HumanPlayerGround blackHuman = null; AIPlayerGround whiteAI = null; AIPlayerGround blackAI = null; if (blackPlayerType == PlayerType.Human) { ChessUIGround.instance.SetBoardOrientation(false); blackHuman = new HumanPlayerGround(); boardInput.AddPlayer(blackHuman); } else { blackAI = new AIPlayerGround(); } if (whitePlayerType == PlayerType.Human) { ChessUIGround.instance.SetBoardOrientation(true); whiteHuman = new HumanPlayerGround(); boardInput.AddPlayer(whiteHuman); // FindObjectOfType<NotationInput>().SetPlayer(whiteHuman); } else { whiteAI = new AIPlayerGround(); } whitePlayer = (PlayerGround)whiteHuman ?? (PlayerGround)whiteAI; blackPlayer = (PlayerGround)blackHuman ?? (PlayerGround)blackAI; whitePlayer.OnMove += OnMove; blackPlayer.OnMove += OnMove; whitePlayer.Init(true); blackPlayer.Init(false); whiteToPlay = BoardGround.IsWhiteToPlay(); RequestMove(); }
public void AddPlayer(HumanPlayerGround player) { players.Add(player); active = true; }