/// <summary> /// Fills the table with castles of the given player by given arrays of position and corresponding blocks. /// </summary> private void InstantiateCastlesForPlayer(IntVector2[] positions, IntVector2[] blocks, PlayerType ownerType, BoardStorageItem[,] bonusTable) { for (var i = 0; i < positions.Length; i++) { Sprite castleSprite = null; if (ownerType == PlayerType.FIRST) { castleSprite = firstUserCastleSprite; } else if (ownerType == PlayerType.SECOND) { castleSprite = secondUserCastleSprite; } var castleObject = InstantiateIcon(castleSprite); castleObject.SetActive(false); var castle = new Castle(castleObject, ownerType); var globalPosition = GetGlobalPosition(positions[i], blocks[i]); bonusTable[globalPosition.x, globalPosition.y] = castle; } }
/// <summary> /// Adds castle to table with bonus items by given position /// </summary> public void AddCastle(IntVector2 position, Castle castle) { bonusTable[position.x, position.y] = castle; }