//Give the factory a private Get method with a prefab parameter GameTileContent Get(GameTileContent prefab) { GameTileContent instance = CreateGameObjectInstance(prefab); instance.OriginFactory = this; return(instance); }
public GameTileContent Get(GameTileContent prefab) { var instance = Instantiate(prefab); instance.OriginFactory = this; MoveToFactoryScene(instance.gameObject); return(instance); }
GameTileContent Get(GameTileContent prefab) { GameTileContent instance = CreateGameObjectInstance(prefab); instance.OriginFactory = this; //MoveToFactoryScene(instance.gameObject); return(instance); }
private GameTileContent Get(GameTileContent prefab) { //GameTileContent instance = Instantiate(prefab); //instance.OriginFactory = this; //MoveToFactoryScene(instance.gameObject); GameTileContent instance = CreateGameObjectInstance <GameTileContent>(prefab); instance.OriginFactory = this; return(instance); }
void SwapAllies(GameTile tile) { //The first tile must be a turret if (swapTile1 == null) { if (tile.Content.Type == GameTileContentType.Tower) { swapTile1 = tile; Debug.Log("Tower selected"); Debug.Log("Swap tile 1 content : " + swapTile1.Content); tile.isSwapping = true; } } //If we already have it, we check for the second tile, it must be empty else if (swapTile2 == null) { if (tile.Content.Type == GameTileContentType.Empty) { //We get the new stile swapTile2 = tile; tile.isSwapping = true; //We swap the content GameTileContent swapTileHold = swapTile1.Content; swapTile1.Content = swapTile2.Content; swapTile2.Content = swapTileHold; //Check if the new configuration will not block the ground if (!board.FindPaths()) { swapTile2.Content = swapTile1.Content; swapTile1.Content = swapTileHold; board.FindPaths(); Debug.Log("Failed to swap !"); } else { Debug.Log("Success to swap ! "); } ResetSwapAlies(); } } }
public void Reclaim(GameTileContent content) { Destroy(content.gameObject); }
public void Reclaim(GameTileContent content) { Debug.Assert(content.OriginFactory == this, "Wrong factory reclaimed!"); Destroy(content.gameObject); }
/// <summary> /// 回收对象 /// </summary> /// <param name="content"></param> public void Reclaim(GameTileContent content) { Debug.Assert(content.OriginFactory == this, "错误的回收工厂!"); Destroy(content.gameObject); }