public Control(int player_id) { this.setPlayersIds(player_id); this.field = new Field(this); this.battleControl = new BattleControl(this, field); this.lifeControl = new LifeControl(player_id, opponent_id); this.mana = new ManaControl(this); this.effects_control = new EffectsControl(this); this.hand = GameObject.FindGameObjectWithTag("Hand").GetComponent <Hand>(); }
/* * _____________________________________________________________________________________________________________________________________________________ * Game Time */ //Runs when the gameobject is awoken void Awake() { Debug.Log("EffectsControl Awake " + GetInstanceID()); //Check if an EffectsControl object instance already exists //if it does, destroy the newly instantiated object if (ecInstance != null) { Destroy(gameObject); Debug.Log("Destroy duplicate EffectsControl instance"); } //If an EffectsControl object instance does NOT exist, set the variable = object else { ecInstance = this; GameObject.DontDestroyOnLoad(gameObject); } }
IEnumerator spawnTimer() { spawnerActive = true; int spawnLoc = numEnemies % 2; warningSprites[spawnLoc].SetActive(true); EffectsControl ec = warningSprites[spawnLoc].GetComponent <EffectsControl>(); StartCoroutine(ec.fadeIn()); yield return(new WaitForSeconds(1)); warningSprites[spawnLoc].GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 0); //StartCoroutine(warningSprites[spawnLoc].GetComponent<EffectsControl>().fadeIn()); warningSprites[spawnLoc].SetActive(false); enemySpawn(); //yield return new WaitForSeconds(nextSpawn); //spawnerActive = false; }