Example #1
0
    private void Awake()
    {
        ///Set this to be main Game Controller
        if (Instance)
        {
            Debug.Log("I already exist: destroying self");
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);

            engObjPool = new EngPool(maxEnergy);

            //Get Other Controllers
            secCon = gameObject.GetComponent <SecurityCon>();
            scrMan = gameObject.GetComponent <ScreenManager>();
            sndCon = gameObject.GetComponent <SoundCon>();

            //Get Each Energy Container in Eng
            //foreach (GameObject gameObj in GameObject.FindGameObjectsWithTag("EnergyBox"))
            //{
            //    EngBarCon objCon = gameObj.GetComponent<EngBarCon>();
            //    if (objCon.section == Section.Life)
            //        lsPowerCon = objCon;
            //   if (objCon.section == Section.Shields)
            //        shieldPowerCon = objCon;
            //}
        }
    }
Example #2
0
    public IEnumerator CheckForDamage(float maxTime, float minTime, EngPool pool)
    {
        while (!gameOver && pool.Count() == 0)
        {
            float newRadTime = Random.Range(minTime, maxTime);
            yield return(new WaitForSeconds(newRadTime));



            if (pool.Count() == 0 && !gameOver)
            {
                TakeDamage();
                sndCon.PlayExplosion();
            }
        }
    }
Example #3
0
 public void SetupEngPool()
 {
     engPool = new EngPool(maxEnergy);
     sprite  = GetComponent <SpriteRenderer>();
 }