private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Opponent") { ScoreDisplay scoreDisplay = ScoreDisplay.GetComponent <ScoreDisplay>(); EnemyCollide enemyCollide = collision.gameObject.GetComponent <EnemyCollide>(); enemyCollide.pointsOfGeneralHealthAndWellbeing -= 5; if (enemyCollide.pointsOfGeneralHealthAndWellbeing <= 0) { Destroy(collision.gameObject, 0); scoreDisplay.CurrentScore += 1000; } } }
void Start() { movement = this.GetComponent <EnemyMovement>(); collision = this.GetComponent <EnemyCollide>(); }