private IEnumerator Perk() { while (true) { if (Input.GetButtonDown(specs.PerkButtonName())) { GameObject instantiatedCloud = Instantiate(poisonCloudPrefab, playerTransform.position, Quaternion.Euler(0, 0, 0)); //instantiates cloud PoisonCloud spawnedCloud = instantiatedCloud.GetComponent <PoisonCloud>(); //gets reference to the cloud's PoisonCloud object spawnedCloud.spawnerName = this.gameObject.name; //changes the spawnerName name in the cloud's script yield return(new WaitForSeconds(cooldown)); // Waits for perk cooldown } else { yield return(null); } } }
private void Start() { InitializeEntity(); SelfCast = new Heal(gameObject); SelfCast2 = new PoisonCloud(gameObject); AutoTarget = new Fireball(gameObject); AutoTarget2 = new Mudball(gameObject); PosTarget = new MagicMissle(gameObject); anim = GetComponent <Animator> (); curHealth = gameObject.GetComponent <Status> ().getHealth(); blood = transform.Find("Blood").GetComponent <ParticleSystem>(); Dungeon = GameObject.Find("MapGenerator").GetComponent <MakeMap>(); weapon = transform.Find("Weapon"); playerGUI = new PlayerGUI(this); paused = false; Time.timeScale = 1; }