Exemple #1
0
 void Start()
 {
     ecosystem    = FindObjectOfType <EcosystemController>();
     gameCore     = FindObjectOfType <GameCore>();
     uiController = FindObjectOfType <UIController>();
     SelectSpawnable(GameCore.SpawnableLookup["Water"]);
     audioData = GetComponent <AudioSource>();
 }
Exemple #2
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>();
    }
    public void Setup()
    {
        RaycastHit hit = new RaycastHit();

        if (Physics.Raycast(camera.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2)), out hit))
        {
            cameraOffset = transform.position.z - hit.point.z;
        }

        EcosystemController ecoController = GameObject.Find("Local Object").GetComponent <EcosystemController>();

        nLowerBound = ecoController.lowerBound;
        nLowerBound = new Vector3(Mathf.Min(0, nLowerBound.x + 120), 0, Mathf.Min(-75, nLowerBound.z - 30));

        nUpperBound = ecoController.upperBound;
        nUpperBound = new Vector3(Mathf.Max(0, nUpperBound.x - 120), 0, Mathf.Max(-75, nUpperBound.z + cameraOffset - 60));

        zLowerBound = ecoController.lowerBound;
        zLowerBound = new Vector3(Mathf.Min(-80, zLowerBound.x), 0, Mathf.Min(-145, zLowerBound.z - 75));

        zUpperBound = ecoController.upperBound;
        zUpperBound = new Vector3(Mathf.Max(80, zUpperBound.x), 0, Mathf.Max(25, zUpperBound.z + cameraOffset + 10));
    }
Exemple #4
0
 public void SetEcosystem(EcosystemController ec)
 {
     ecosystemController = ec;
 }