public void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("enemy")) { this.enemy.Play(); Debug.Log("enemy collider"); this.gameController.LivesValue -= 10; enemyctrl c = other.GetComponent <enemyctrl>(); c.Reset(); } if (other.CompareTag("health")) { this.health.Play(); Debug.Log("health collider"); this.gameController.LivesValue += 10; enemyctrl c = other.GetComponent <enemyctrl>(); c.Reset(); } if (other.CompareTag("Rock")) { this.Rock.Play(); Debug.Log("Rock collider"); this.gameController.ScoreValue += 20; enemyctrl c = other.GetComponent <enemyctrl>(); c.Reset(); } }
// Use this for initialization void Start() { Player = transform.parent.Find("devil@attack_1").GetComponent <enemyctrl>(); }