private void CreateChessman(Chessman.Types cmType, Chessman.Colours cmColour, Vector2Int newCoords) { GameObject newPiece = Instantiate(chessmanPrefab, Vector3.zero, Quaternion.identity); newPiece.transform.position = new Vector3(0, 0, Chessman.chessmanZ); Chessman newChessman = newPiece.GetComponent <Chessman>(); newChessman.Type = cmType; newChessman.Colour = cmColour; newChessman.SetBoardPos(newCoords); Chess.AddPieceToMatrix(newPiece); newChessman.ActivateSprite(); }
internal static GameWrapper AIHandler; //this is not particularly good architecture, but it will work for now. //static constructor. It gets called on first reference to static class. static Chess() { /* * PlayerWhite = new GameObject[] * { * Create(Chessman.Colours.White, Chessman.Types.Bishop, 2, 0), * }; */ //RefreshBoard(); moveSounds = GameObject.Find("Board").GetComponent <AudioSwitch>(); AIHandler = GameObject.Find("Game Controller").GetComponent <GameWrapper>(); toMove = Chessman.Colours.White; GameOver = false; PieceSquareTables = new int[, ][, ] { { KingTableWhite, KingTableBlack }, { QueenTableWhite, QueenTableBlack }, { RookTableWhite, RookTableBlack }, { BishopTableWhite, BishopTableBlack }, { KnightTableWhite, KnightTableBlack }, { PawnTableWhite, PawnTableBlack }, }; ConstructPieceSquareTables(); }