void OnTriggerEnter(Collider collision) { if (collision.gameObject.tag == "FootHead") { Objects.Player playerObj = collision.gameObject.GetComponentInParent <Objects.Player>(); playerObj.ResetJumps(); this.Damage(1); } else if (collision.gameObject.tag == "Sides") { Classes.Player player = collision.gameObject.GetComponentInParent <Classes.Player>(); player.Damage(1); // Give the player 1 second of invincibility after being damaged. Spells.Spell sp = player.GetSpell("NP_Invulnerability"); if (sp == null) { Debug.Log("Unable to get Invulnerability spell"); } Spells.Invulnerability inv = (Spells.Invulnerability)sp; inv.SetDuration(1); player.ReceiveBuff(inv); inv.Cast(); } else if (collision.gameObject.tag == "Projectile") { this.Damage(1); } }
// Use this for initialization private void Start() { Player = (GameObject.FindGameObjectWithTag("Player")); playerClass = Player.GetComponent <Player>(); this.LearnSpell("Explosion", new Spells.Explosion(this)); playerbody = Player.GetComponent <Rigidbody>(); //Player =(GameObject) GameObject.FindGameObjectsWithTag ("Player"); this.transform.LookAt(Player.transform.position); }