Exemplo n.º 1
0
    // Start is called before the first frame update
    void Awake()
    {
        SpawnableLookup = new Dictionary <string, SpawnableObject>();
        SpawnableList   = new List <SpawnableObject>();
        CreationLookup  = new Dictionary <string, List <Creation> >();

        instance     = this;
        ecosystem    = FindObjectOfType <EcosystemController>();
        uiController = FindObjectOfType <UIController>();
        Energy       = MaxEnergy;
        UpdateEnergy();
        SpawnableList = GetSpawnables();
        uiController.populationPanel.CreatePopulationPanels(SpawnableList);
        InvokeRepeating("GameTick", 1f, 1f);
        spawnerRay = FindObjectOfType <SpawnerRay>();
    }
Exemplo n.º 2
0
    private void Start()
    {
        spawnerRay = FindObjectOfType <SpawnerRay>();
        List <SpawnableObject> spawnables = GameCore.SpawnableList;

        foreach (SpawnableObject o in spawnables)
        {
            GameObject newGO = Instantiate(SpawnButtonPrefab, ButtonPanel);
            newGO.GetComponent <UISpawnButton>().ObjectToSpawn = o;
            newGO.GetComponent <Button>().onClick.AddListener(() => { spawnerRay.SelectSpawnable(o); });
            if (o.name == "Water")
            {
                newGO.GetComponent <UISpawnButton>().originalColour = newGO.GetComponent <Image>().color;
                newGO.GetComponent <UISpawnButton>().ThisButtonSelected();
                UISpawnButton.SelectedButton = newGO.GetComponent <UISpawnButton>();
            }
        }
    }