private void Awake() { Stats = Instantiate(Stats); WaitingTimerLeft = WaitingTime; Waypoints = GameObject.FindGameObjectsWithTag("Waypoint"); Sight = GetComponent <EnemySight>(); Agent = GetComponent <NavMeshAgent>(); }
/// <summary> /// Realoate the enemys once the're hitted /// </summary> /// <param name="haveToAct"></param> /// <param name="hit"></param> private void Relocate(bool haveToAct, RaycastHit hit) { if (haveToAct) { ScriptEnemy enemyscript = hit.transform.GetComponent <ScriptEnemy>(); enemyscript.numberOfclicks -= 1; //add points when destroying a shape if (enemyscript.numberOfclicks <= 0) { points += enemyscript.enemyPoint; } Debug.Log("you hit an enemy."); } else { Debug.Log("This is not anenemy."); } }