/// <summary> /// Copies the settings from the given instance. /// </summary> public void Set(EpochSettings other) { // Copy the settings from the given instance maxEnemies = other.maxEnemies; buildUpSpawnRate = other.buildUpSpawnRate; peakFadeDespawnRate = other.peakFadeDespawnRate; sustainPeakDuration.Set(other.sustainPeakDuration); relaxDuration.Set(other.relaxDuration); peakIntensityThreshold = other.peakIntensityThreshold; relaxUpperBound = other.relaxUpperBound; }
/// <summary> /// Initialize the AIDirector. Called on start when the AIDirector is instantiated. /// </summary> public void Init() { // Set the epoch settings to default. epochSettings = new EpochSettings(defaultEpochSettings); // Retrieve the 'AISpawner' instance used to spawn enemies on the battlefield. enemySpawner = GetComponent <AISpawner>(); // Set the enemy spawner to spawn enemies in the GameManager's current level enemySpawner.Level = GameManager.Instance.CurrentLevel; // Find the player gameObject to control his AI settings GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); // Cache the player's Character component to modify his AI settings player = playerObject.GetComponent <Character>(); // Retrieve the EnemyMob component attached to this GameObject. This component controls the enemies' behavior enemyMob = GetComponent <EnemyMob>(); // Set the enemy mob's combat settings to default. enemyMob.Settings.Set(defaultEnemyAISettings); // Make the enemies attack the player. enemyMob.AttackTarget = player; // Initialize the enemy mob. enemyMob.Init(); // Update the settings for the player's AnxietyMonitor. These settings determine the rate at which player anxiety changes. playerAnxietyMonitor.Settings = playerAnxietyMonitorSettings; // Sets the AnxietyMonitor to monitor the player's anxiety. playerAnxietyMonitor.CharacterToMonitor = player; // Populate the current level with enemies PopulateLevel(GameManager.Instance.CurrentLevel); //paused = true; // Start updating the AI in a coroutine loop, where the AI is updated every 'aiTimeStep' seconds. StartCoroutine(UpdateAI()); // Update the game's intensity value every 'aiTimeStep' seconds. StartCoroutine(UpdateGameIntensity()); }
/// <summary> /// Creates a new EpochSettings instance, copying the values from the given instance. /// </summary> public EpochSettings(EpochSettings other) { // Copies the settings from the given instance Set(other); }