/// <summary>
        /// Finds all as spawn tagged objects and fills the molecule queue of the attached collector with molecules
        /// for the start.
        /// </summary>
        void Start()
        {
            collector       = GetComponent <CoolingCollectorScript>();
            moleculeManager = GameObject.Find("CoolingGameManager").GetComponent <CoolingMoleculeManager>();
            // Find all as spawn tagged objects
            spawnPositions = ExtensionMethods.FindComponentsInChildrenWithTag <Component>(gameObject, "Cooling.Spawn");

            if (collector && prefabObject && waypoints.Length > 0)
            {
                for (int i = 0; i < 10; i++)
                {
                    CWater clone = Instantiate(prefabObject);
                    // Wapoint doesnt matter, gets overwritten later, and index 0 is always available
                    clone.waypoint = waypoints[0];
                    moleculeManager.AddMoleculeToList(clone);
                    clone.gameObject.SetActive(false);
                    collector.moleculeQueue.Enqueue(clone);
                }
            }

            if (spawnPositions.Length > 1)
            {
                singlespawn = false;
            }
        }
 void Start()
 {
     MAXCOUNTMOLECULES = 200;
     spawnScript       = GetComponent <CoolingSpawnScript>();
     gameManager       = GameObject.Find("CoolingGameManager").GetComponent <CoolingMoleculeManager>();
     lamps             = ExtensionMethods.FindComponentsInChildrenWithTag <Renderer>(gameObject, "Cooling.Lamp");
 }
예제 #3
0
        void Start()
        {
            particleSystem  = GetComponent <ParticleSystem>();
            moleculeManager = GameObject.Find("CoolingGameManager").GetComponent <CoolingMoleculeManager>();
            // Set random rotation on x axis for particle system
            Vector3 rotation = new Vector3(Random.Range(-200, 20), 0, 0);
            var     shape    = particleSystem.shape;

            shape.rotation = rotation;
        }
        void Start()
        {
            animator = GetComponent <Animator>();
            GameObject manager = GameObject.Find("CoolingGameManager");

            moleculeManager = manager.GetComponent <CoolingMoleculeManager>();
            powerManager    = manager.GetComponent <CoolingPowerManager>();
            // Initialize starting state
            animator.SetFloat("animSpeed", 0.6f);
            lamps[0].GetComponent <Renderer>().material.SetColor("_EmissionColor", Color.green);
            lamps[1].GetComponent <Renderer>().material.SetColor("_EmissionColor", Color.green);
            powerLevel   = 2;
            powerConsume = powerLevel * 30;
            powerManager.UpdatePowerConsume('P', powerConsume);
        }