private Vector3 _lastTouchedWaypoint; // keep track of the last waypoint we touched, so we don't keep going back to it void Start() { // Set up the generic AI components _animator = GetComponent <CharacterAnimator>(); _settings = GetComponent <EnemyAISettings>(); _awareness = GetComponent <EnemyAwareness>(); _personalHearingRadius = GetComponentInChildren <HearingRadius>(); _personalVision = GetComponentInChildren <Vision>(); _timeSincePlayerSeen = 0; // Set up Astar _seeker = GetComponent <Seeker>(); if (_seeker == null) { _seeker = gameObject.AddComponent <Seeker>(); } // Map the output of this class to the input of the animator GetComponent <CharacterInput>().UpdateInputMethod = UpdateInput; // Let child classes initialize OnStart(); // Finally, register ourselves with the AI system GameManager.AI.Enemies.Add(this); transform.parent = GameManager.AI.transform; }
/// <summary> /// Copies the settings from the given AISettings instance into this instance /// </summary> public void Set(EnemyAISettings other) { // Copy the settings of the given instance attackRate = other.attackRate; attackRateFluctuation = other.attackRateFluctuation; battleCircleRadius = other.battleCircleRadius; simultaneousAttackers = other.simultaneousAttackers; }
void Awake() { // If the EnemyAISettings instance for this enemy mob has not yet been created if (aiSettings == null) { // Create a new EnemyAISettings instance to control the enemies' behaviour in combat aiSettings = new EnemyAISettings(); } }