public void UnregisterEnemy(EnemyController_Photon enemyKilled) { int enemiesRemainingNotification = numberOfEnemiesRemaining - 1; onRemoveEnemy.Invoke(enemyKilled, enemiesRemainingNotification); // removes the enemy from the list, so that we can keep track of how many are left on the map enemies.Remove(enemyKilled); }
void Start() { m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, EnemyTurret_Photon>(m_Health, this, gameObject); m_Health.onDamaged += OnDamaged; m_EnemyController = GetComponent <EnemyController_Photon>(); DebugUtility.HandleErrorIfNullGetComponent <EnemyController_Photon, EnemyTurret_Photon>(m_EnemyController, this, gameObject); m_EnemyController.onDetectedTarget += OnDetectedTarget; m_EnemyController.onLostTarget += OnLostTarget; // Remember the rotation offset between the pivot's forward and the weapon's forward m_RotationWeaponForwardToPivot = Quaternion.Inverse(m_EnemyController.weapon.weaponMuzzle.rotation) * turretPivot.rotation; // Start with idle aiState = AIState.Idle; m_TimeStartedDetection = Mathf.NegativeInfinity; m_PreviousPivotAimingRotation = turretPivot.rotation; }
public void RegisterEnemy(EnemyController_Photon enemy) { enemies.Add(enemy); numberOfEnemiesTotal++; }