void OnTriggerEnter2D(Collider2D collider) { EnemyVehicle enemyVehicle = collider.GetComponent <EnemyVehicle>(); if (collider.GetComponent <EnemyVehicle>() != null) { //AddEnemyInRadius(enemyVehicle); } }
void OnTriggerExit2D(Collider2D collider) { EnemyVehicle enemyVehicle = collider.GetComponent <EnemyVehicle>(); if (enemyVehicle != null) { RemoveEnemyInRadius(); enemyVehicle.IsInSpawnPointRadius = false; } }
private void SpawnEnemies() { Debug.Log("enemiesInRadius " + enemiesInRadius + " enemiesToSpawn " + enemiesToSpawn); if (enemiesInRadius <= 0 && enemiesToSpawn > 0) { GameObject newEnemy = GameObject.Instantiate(enemyProtoype); EnemyVehicle newEnemyVehicle = newEnemy.GetComponent <EnemyVehicle>(); newEnemyVehicle.SpawnPoint = this; AddEnemyInRadius(newEnemyVehicle); SimpleAI enemyAI = newEnemy.GetComponent <SimpleAI>(); enemyAI.SetPlayer(playerPlane); } }
void Update() { for (int i = 0; i < enemyVehicles.Count; i++) { //enemyVehicles[i].GetComponent<SteeringBehaviour>().Steer(); EnemyVehicle eV = enemyVehicles[i]; for (int j = 0; j < eV.steeringBehaviours.Length; j++) { eV.steeringBehaviours[j].Steer(); } eV.UpdateVehicle(); } }
public void RemoveEnemy(EnemyVehicle enemy) { existingEnemies.Remove(enemy); }
public void AddEnemy(EnemyVehicle enemy) { existingEnemies.Add(enemy); }
public virtual void Awake() { vehicle = GetComponent <EnemyVehicle>(); }
public void AddEnemyInRadius(EnemyVehicle enemy) { enemy.IsInSpawnPointRadius = true; enemiesInRadius += 1; }