コード例 #1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        EnemyVehicle enemyVehicle = collider.GetComponent <EnemyVehicle>();

        if (collider.GetComponent <EnemyVehicle>() != null)
        {
            //AddEnemyInRadius(enemyVehicle);
        }
    }
コード例 #2
0
    void OnTriggerExit2D(Collider2D collider)
    {
        EnemyVehicle enemyVehicle = collider.GetComponent <EnemyVehicle>();

        if (enemyVehicle != null)
        {
            RemoveEnemyInRadius();
            enemyVehicle.IsInSpawnPointRadius = false;
        }
    }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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();
     }
 }
コード例 #5
0
 public void RemoveEnemy(EnemyVehicle enemy)
 {
     existingEnemies.Remove(enemy);
 }
コード例 #6
0
 public void AddEnemy(EnemyVehicle enemy)
 {
     existingEnemies.Add(enemy);
 }
コード例 #7
0
 public void RemoveEnemy(EnemyVehicle enemy)
 {
     existingEnemies.Remove(enemy);
 }
コード例 #8
0
 public void AddEnemy(EnemyVehicle enemy)
 {
     existingEnemies.Add(enemy);
 }
コード例 #9
0
ファイル: SteeringBehaviour.cs プロジェクト: CLina10/Router
 public virtual void Awake()
 {
     vehicle = GetComponent <EnemyVehicle>();
 }
コード例 #10
0
 public void AddEnemyInRadius(EnemyVehicle enemy)
 {
     enemy.IsInSpawnPointRadius = true;
     enemiesInRadius           += 1;
 }