Exemplo n.º 1
0
    void Start()
    {
        // initialize stuff
        globalInventory = new GlobalInventory();

        // launch next scene
        DontDestroyOnLoad(gameObject);
        SceneManager.LoadScene("Level Selection");
    }
Exemplo n.º 2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         throw new System.Exception("Multiple Inventory instances found.");
     }
 }
Exemplo n.º 3
0
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 4
0
    /// Small test for collecting powerups
    //private IEnumerator TestPowerupCollect()
    //{
    //    for (;;)
    //    {
    //        yield return new WaitForSeconds(4.0f);
    //        CollectPowerup(Powerup.Power.pwrBoost);
    //    }
    //}

    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("There are multiple instances of " + typeof(GlobalInventory).ToString() + " present in the scene!");
            return;
        }

        instance = this;
        DontDestroyOnLoad(gameObject);

        //StartCoroutine(TestPowerupCollect());
    }
Exemplo n.º 5
0
    void Start()
    {
        GameManager     gameManager = GameObject.FindObjectOfType <GameManager>();
        GlobalInventory gi          = gameManager.GetGlobalInventory();
        var             nextTech    = gi.NumTechRequiredToUnlockNextTech();

        string displayText;

        displayText = string.Format("{0}{1}{2}\nYou have collected {3} Alien Tech. {4}",
                                    (gi.TechStatus[Tile.TileType.BOMB] == 1 ?                       Tile.GetTileNameByEnum(Tile.TileType.BOMB) + " UNLOCKED!\n" : ""),
                                    (gi.TechStatus[Tile.TileType.DRILL_RIG] == 1 ?          Tile.GetTileNameByEnum(Tile.TileType.DRILL_RIG) + " UNLOCKED!\n" : ""),
                                    (gi.TechStatus[Tile.TileType.MINERAL_FARM] == 1 ?       Tile.GetTileNameByEnum(Tile.TileType.MINERAL_FARM) + " UNLOCKED!\n" : ""),
                                    gi.NumTechPieces,
                                    (nextTech.Value >= 0 ? string.Format(
                                         "{0} more needed to unlock next technology: {1}",
                                         nextTech.Value.ToString(),
                                         Tile.GetTileNameByEnum(nextTech.Key)) : ""));

        Text text = GetComponent <Text>();

        text.text = displayText;
    }
Exemplo n.º 6
0
 public void ChoppedTree(Vector2Int tilePosition)
 {
     SetTileType(tilePosition, Tile.Type.Grass);
     GlobalInventory.AddWood(GenerationParameters.resources.woodPerTree);
 }