void PreDeath(GameObject attacker) { // The bird is ABOUT TO DIE // Award your bonus to the Dragon HealthMonitor dragonSM = attacker.GetComponent <HealthMonitor>(); dragonSM.StatInput(this.give_HP, this.give_Stam, this.give_Flame); // Maybe do a little animation? }
// On trigger collision void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == Globals.TAGS.Enemy) { return; } if (coll.gameObject.tag == Globals.TAGS.Player) // @@@ENUM HERE!!! { GameObject dragon = coll.gameObject; UseItem(dragon); // For non awarding actions if (Audi != null) { Audi.Play(); } int hp = this.award_HP; int stam = this.award_Stam; float flame = this.award_Flame; if (p == null) { p = gameObject.GetComponent <Perks>(); } if (p.BE()) { stam *= 2; flame *= 2; } if (hp < 0) { Debug.Log("1"); dragonSM.HP += (int)(hp * p.damageMult()) + p.damageReduction(); } if (hp > 0 && p.BE()) { dragonSM.HP += hp * 2; } monitor.Add_Coins(award_Coin_Value); Debug.Log(award_Coin_Value); dragonSM.StatInput(hp, stam, flame); // @@@ SESSION MONITOR //monitor.Add_Coins(this.award_Coin_Value); Destroy(this.gameObject); // Goodbye } }