private void FindEnemy() { enemy = GameObject.FindObjectOfType <EnemyBehaviour>(); if (enemy) { myOffense.SetAttackTarget(enemy.gameObject); } }
private void FindPlayer() { player = GameObject.FindObjectOfType <PlayerBehaviour>().gameObject; if (player) { playerHealth = player.gameObject.GetComponent <HealthBehavior>(); myOffense.SetAttackTarget(player); } else { Debug.Log("Enemy did not find Player game object in scene."); } }