/// <summary> /// The update logic for the behaviour of the advanced enemies. /// </summary> void AdvancedEnemyHandler() { if (AdvancedTimer <= 0f && AdvancedEnemies) { GameObject tGO; IsoObject tIsoObject; CharacterMovement tCharacterMovement; int tRandom = Random.Range(0, 2); if (tRandom == 0) { tGO = Instantiate(AdvancedEnemyRightPrefab) as GameObject; tIsoObject = tGO.GetComponent <IsoObject>(); tCharacterMovement = tGO.GetComponent <CharacterMovement>(); } else { tGO = Instantiate(AdvancedEnemyLeftPrefab) as GameObject; tIsoObject = tGO.GetComponent <IsoObject>(); tCharacterMovement = tGO.GetComponent <CharacterMovement>(); } Characters.Add(tIsoObject); CharacterMovementScripts.Add(tCharacterMovement); EnemySpawn.Play(); AdvancedTimer = Random.Range(TimeBetweenAdvancedMin, TimeBetweenAdvancedMax); } else if (AdvancedEnemies) { AdvancedTimer -= Time.deltaTime; } }
/// <summary> /// The update logic for the behaviour of the simple enemies. /// </summary> void SimpleEnemyHandler() { if (SimpleTimer <= 0f) { GameObject tGO; if (Random.Range(0, 2) == 1 && !ActiveBlockChanger && BlockChangerEnemy) { tGO = Instantiate(BlockChangerEnemyPrefab) as GameObject; ActiveBlockChanger = true; } else { tGO = Instantiate(SimpleEnemyPrefab) as GameObject; } //GameObject tGO = Instantiate(FollowEnemyPrefab, EnemySpawner.position, Quaternion.identity) as GameObject; Characters.Add(tGO.GetComponent <IsoObject>()); CharacterMovementScripts.Add(tGO.GetComponent <CharacterMovement>()); EnemySpawn.Play(); SimpleTimer = Random.Range(TimeBetweenSimplesMin, TimeBetweenSimplesMax); } else { SimpleTimer -= Time.deltaTime; } }
/// <summary> /// The update logic for the behaviour of the following enemies. /// </summary> void FollowEnemyHandler() { if (FollowTimer <= 0f && !ActiveFollower && FollowEnemy) { GameObject tGO = Instantiate(FollowEnemyPrefab) as GameObject; //GameObject tGO = Instantiate(FollowEnemyPrefab, EnemySpawner.position, Quaternion.identity) as GameObject; Characters.Add(tGO.GetComponent <IsoObject>()); CharacterMovementScripts.Add(tGO.GetComponent <CharacterMovement>()); EnemySpawn.Play(); ActiveFollower = true; FollowTimer = Random.Range(TimeUntilFollowerMin, TimeUntilFollowerMax); } else if (!ActiveFollower && FollowEnemy) { FollowTimer -= Time.deltaTime; } }
/// <summary> /// Add an enemy to the list of active enemies. /// </summary> /// <param name="_Enemy">Instance of the spawned enemy.</param> public void AddEnemy(IsoObject _Enemy) { EnemySpawn.Play(); Characters.Add(_Enemy); }