Ejemplo n.º 1
0
 private void Start()
 {
     enemyAircraftScript = gameObject.GetComponent <EnemyAircraftScript>();
     positions           = new List <Vector3>();
     positions.Add(transform.position);
     lineRenderer = GetComponent <LineRenderer>();
 }
Ejemplo n.º 2
0
 public void EnemyInSootRange(GameObject enemyGameObjet)
 {
     if (state == State.FollowAircraft)
     {
         if (enemyGameObjet == pathHandlerBase.enemyToChase)
         {
             EnemyAircraftScript enemyAircraftScript =
                 pathHandlerBase.enemyToChase.GetComponent <EnemyAircraftScript>();
             speed = enemyAircraftScript.GetAircraftSpeed();
             pathHandlerBase.enemyToChase = enemyAircraftScript.enemyTail;
             state = State.CloseFollow;
         }
     }
 }
        private void SpawnEnemyBomber(EnemySpawnInformation enemySpawnInformation)
        {
            Transform  tf = GetSpawner(enemySpawnInformation.SpawnerNumber);
            GameObject enemyAircraftObject =
                Instantiate(enemyBomberPrefab, tf.position, Quaternion.identity);
            EnemyAircraftScript enemyAircraftScript = enemyAircraftObject.GetComponent <EnemyAircraftScript>();

            enemyAircraftScript.gameManager        = gameManager;
            enemyAircraftScript.maxHealth          = enemySpawnInformation.MaxHealth;
            enemyAircraftScript.bombDamage         = enemySpawnInformation.bombDamage;
            enemyAircraftScript.enemyAim           = enemySpawnInformation.enemyAim;
            enemyAircraftScript.enemySpawnerScript = this;
            enemyAircraftScript.SetAircraftSpeedInMoveHandler(enemySpawnInformation.Speed);
            enemySpawnInformationsLocal.RemoveAt(enemySpawnInformationsLocal.IndexOf(enemySpawnInformation));
        }
        private void OnTriggerStay2D(Collider2D other)
        {
            if (other.CompareTag("Enemy"))
            {
                if (currentShootCallDawn <= 0)
                {
                    enemyInRanage(other.gameObject.GetComponent <EnemyAircraftScript>());
                    EnemyAircraftScript enemyAircraftScript = other.gameObject.GetComponent <EnemyAircraftScript>();
                    enemyAircraftScript.TakeDamage(playerAircraftScript.toAircraftDamage);
                    currentShootCallDawn = shootCallDawn;
                    if (enemyAircraftScript.GetCurrentHealth() <= 0)
                    {
                        playerAircraftScript.aircraftMoveHandler.GoToWaitState();
                    }
                }
            }

            if (other.CompareTag("Base"))
            {
                playerAircraftScript.aircraftMoveHandler.BaseInRange(other);
            }
        }
 private void enemyInRanage(EnemyAircraftScript enemyAircraftScript)
 {
     leftGun.Play();
     rightGun.Play();
 }