Exemplo n.º 1
0
    //Give the factory a private Get method with a prefab parameter
    GameTileContent Get(GameTileContent prefab)
    {
        GameTileContent instance = CreateGameObjectInstance(prefab);

        instance.OriginFactory = this;
        return(instance);
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
    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);
 }
Exemplo n.º 7
0
 public void Reclaim(GameTileContent content)
 {
     Debug.Assert(content.OriginFactory == this, "Wrong factory reclaimed!");
     Destroy(content.gameObject);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 回收对象
 /// </summary>
 /// <param name="content"></param>
 public void Reclaim(GameTileContent content)
 {
     Debug.Assert(content.OriginFactory == this, "错误的回收工厂!");
     Destroy(content.gameObject);
 }