Example #1
0
    //
    void EnemyInfoEC()
    {
        //
        EnemyConsistency enemyConsistency = EnemyAnalyzer.enemyConsistency;

        //
        if (enemyConsistency != null)
        {
            // Marcador de posición estimada del enemigo
            Vector3 anticipatedPositionInScreen = mainCamera.WorldToViewportPoint(EnemyAnalyzer.estimatedToHitPosition);
            GUI.DrawTexture(new Rect(
                                anticipatedPositionInScreen.x * Screen.width - 2,
                                Screen.height - anticipatedPositionInScreen.y * Screen.height - 2, 10, 10),
                            circleTexture);

            // Barra de vida
            float enemyCoreHealthForBar = enemyConsistency.CurrentHealth / enemyConsistency.maxHealth;
            enemyCoreHealthForBar = Mathf.Clamp01(enemyCoreHealthForBar);
            GUI.DrawTexture(new Rect(Screen.width / 2 + 150, Screen.height / 2 - 30, enemyCoreHealthForBar * 100f, 20), enemyHealthTexture);
            //GUI.Label(new Rect(Screen.width / 2 + 150, Screen.height / 2 - 30, 100f, 20), " " + enemyConsistency.CurrentHealth);

            // TODO: Sacar vida de la parte extra
            EnemyCollider enemyCollider = EnemyAnalyzer.enemyCollider;
            if (enemyCollider != null && enemyCollider.isTargeteable && enemyCollider.maxLocationHealth > 0)
            {
                float enemyPartHealthForBar = enemyCollider.CurrentLocationHealth / enemyCollider.maxLocationHealth;
                enemyPartHealthForBar = Mathf.Clamp01(enemyPartHealthForBar);
                GUI.DrawTexture(new Rect(Screen.width / 2 + 150, Screen.height / 2, enemyPartHealthForBar * 100f, 20), enemyHealthTexture);
            }


            //
            float distance       = (playerIntegrity.transform.position - enemyConsistency.transform.position).magnitude;
            int   distanceToShow = (int)distance;
            GUI.Label(new Rect(Screen.width / 2 + 150, Screen.height / 2, 300, 20), "Distance: " + distanceToShow, guiSkin.label);
            // TODO: Mostrar también velocidad del bicho
            float enemySpeed = (int)EnemyAnalyzer.enemyRb.velocity.magnitude;
            GUI.Label(new Rect(Screen.width / 2 + 150, Screen.height / 2 + 30, 300, 20), "Speed: " + enemySpeed + " m/s", guiSkin.label);

            // Raycast para saber si el enemigo está a tiro
            RaycastHit hitInfo;
            Vector3    enemyCentralPointPosition = EnemyAnalyzer.enemyTransform.TransformPoint(EnemyAnalyzer.enemyConsistency.centralPointOffset);
            Vector3    enemyDirection            = enemyCentralPointPosition - cameraControl.transform.position;
            if (Physics.Raycast(cameraControl.transform.position, enemyDirection, out hitInfo, enemyDirection.magnitude))
            {
                //Debug.Log(hitInfo.transform.name);
                EnemyCollider possibleHit = hitInfo.collider.GetComponent <EnemyCollider>();
                //Debug.Log("Enemy collider: " + enemyCollider);
                if (possibleHit != null)
                {
                    //GUI.DrawTexture(new Rect(Screen.width / 2 - 25, Screen.height / 2 - 25, 50, 50), enemyMarkerTextureRed);
                    Vector3 enemyScreenPosition = Camera.main.WorldToViewportPoint(enemyCentralPointPosition);
                    GUI.DrawTexture(new Rect(
                                        (enemyScreenPosition.x * Screen.width) - 25,
                                        Screen.height - (enemyScreenPosition.y * Screen.height) - 25, 50, 50),
                                    enemyMarkerTextureRed);
                }
            }
        }
    }
Example #2
0
    //
    AffectedByPulseAttack GetElementsOnReachOfPulseAttack(float pulseReach, float pulseRadius)
    {
        //
        AffectedByPulseAttack affectedByPulseAttack = new AffectedByPulseAttack();

        //
        Collider[] collidersOnReach = Physics.OverlapSphere(transform.position, pulseReach);
        //
        for (int i = 0; i < collidersOnReach.Length; i++)
        {
            //Si no entra en el ángulo, siguiente
            Vector3 pointFromPlayer = collidersOnReach[i].transform.position - transform.position;
            if (Vector3.Angle(pointFromPlayer, transform.forward) > pulseRadius)
            {
                continue;
            }

            // Chequemamos primero por enemy colliders
            EnemyCollider enemyCollider = collidersOnReach[i].GetComponent <EnemyCollider>();
            if (enemyCollider != null)
            {
                affectedByPulseAttack.affectedEnemyColliders.Add(enemyCollider);
            }
            // Después enemy consistencies
            EnemyConsistency enemyConsistency = collidersOnReach[i].GetComponent <EnemyConsistency>();
            if (enemyConsistency == null)
            {
                enemyConsistency = collidersOnReach[i].GetComponentInParent <EnemyConsistency>();
            }
            if (enemyConsistency != null)
            {
                affectedByPulseAttack.affectedEnemyConsistencies.Add(enemyConsistency);
            }
            //
            WeakPoint weakPoint = collidersOnReach[i].GetComponent <WeakPoint>();
            if (weakPoint != null)
            {
                Debug.Log("Adding weakpoint");
                affectedByPulseAttack.affectedWeakPoints.Add(weakPoint);
            }
            // Terrenos destruibles
            DestructibleTerrain destructibleTerrain = collidersOnReach[i].GetComponent <DestructibleTerrain>();
            if (destructibleTerrain == null)
            {
                destructibleTerrain = collidersOnReach[i].GetComponentInParent <DestructibleTerrain>();
            }
            if (destructibleTerrain != null)
            {
                affectedByPulseAttack.affectedDestructibleTerrains.Add(destructibleTerrain);
            }
            // Y por último rigidbodies
            // Estos solo deberían entrar en la lista si no ha cuajado arriba
            Rigidbody rigidbody = collidersOnReach[i].GetComponent <Rigidbody>();
            if (rigidbody != null && enemyConsistency == null)
            {
                affectedByPulseAttack.affectedRigidbodies.Add(rigidbody);
            }
        }
        return(affectedByPulseAttack);
    }
Example #3
0
    // TODO: MIrarlo y dejarlo bien hecho
    // Intentar no repetir nombres y demás
    void ShowLevelInfo()
    {
        Vector2 pos = new Vector2(100, 100);
        //
        Vector2 rectSize      = new Vector2(300, 50);
        Rect    levelInfoRect = new Rect(pos, rectSize)
        {
            position = pos
        };

        // Nombre del nivel
        GUI.Label(levelInfoRect, levelData.levelInfo.inGameName, guiSkin.customStyles[3]);
        //
        string message = "";

        switch (levelData.levelInfo.victoryCondition)
        {
        case VictoryCondition.DefeatAnyEnemy:
            message = "Defeat " + levelData.levelInfo.enemiesToDefeat + " enemies";
            break;

        case VictoryCondition.SlayTheBeast:
            message = "Slay the beast";
            break;
        }

        //
        pos.y += yOffset;
        levelInfoRect.position = pos;
        GUI.Label(levelInfoRect, message, guiSkin.customStyles[1]);
        //
        pos.y += yOffset;
        levelInfoRect.position = pos;
        GUI.Label(levelInfoRect, levelData.levelInfo.description, guiSkin.customStyles[0]);
        //
        pos.y += yOffset;
        levelInfoRect.position = pos;
        GUI.Label(levelInfoRect, "Expected enemies ", guiSkin.label);
        //
        for (int i = 0; i < levelData.levelInfo.enemiesSpawnSettings.Length; i++)
        {
            pos.y += yOffset;
            levelInfoRect.position = pos;
            // TODO: Sacar el nombre con el in-game name
            EnemyConsistency enemyConsistency = levelData.levelInfo.enemiesSpawnSettings[i].enemyPrefab.GetComponent <EnemyConsistency>();
            //
            string nameToShow = "";
            if (enemyConsistency != null && enemyConsistency.inGameName != "Size Category")
            {
                nameToShow = enemyConsistency.inGameName;
            }
            else
            {
                nameToShow = levelData.levelInfo.enemiesSpawnSettings[i].enemyPrefab.name;
            }
            //
            GUI.Label(levelInfoRect, nameToShow, guiSkin.customStyles[0]);
            //GUI.Label(levelInfoRect, i + "", guiSkin.label);
        }
    }
 // Start is called before the first frame update
 protected virtual void Start()
 {
     player          = FindObjectOfType <RobotControl>();
     rb              = GetComponent <Rigidbody>();
     bodyConsistency = GetComponent <EnemyConsistency>();
     terrainManager  = FindObjectOfType <TerrainManager>();
     audioSource     = GetComponent <AudioSource>();
     enemyManager    = FindObjectOfType <EnemyManager>();
 }
Example #5
0
 // TODO: Ajustarlo para que trabaje con casos sin rigidbody y/o enemyconsistency
 public static void Assign(Transform enemyReference)
 {
     enemyTransform = enemyReference;
     enemyRb        = enemyReference.GetComponent <Rigidbody>();
     // Chequeo extra para multipartes
     if (enemyRb == null)
     {
         enemyRb = enemyReference.GetComponentInParent <Rigidbody>();
     }
     // Chequeo para gusano grande. Debería ser el de la cabeza el que coja
     if (enemyRb == null)
     {
         enemyRb = enemyReference.GetComponentInChildren <Rigidbody>();
         // Para cuando cambias entre partes del cuerpo
         if (enemyRb == null)
         {
             enemyRb = enemyReference.parent.GetComponentInChildren <Rigidbody>();
         }
         //
         else
         {
             enemyTransform = enemyRb.transform;
         }
     }
     //
     enemyConsistency = enemyReference.GetComponent <EnemyConsistency>();
     // Chequeo extra para  las body parts
     if (enemyConsistency == null)
     {
         enemyConsistency = enemyReference.GetComponentInParent <EnemyConsistency>();
     }
     // Para el gusano grande
     if (enemyConsistency == null)
     {
         enemyConsistency = enemyReference.parent.GetComponentInChildren <EnemyConsistency>();
     }
     // Chequeo para los componentes que no lo tienen, como los WeakPoints
     // TODO: Ponerselos más adelante y quitar esto
     if (enemyConsistency != null)
     {
         enemyConsistency.SetCollidersPenetrationColors();
     }
     //
     enemyCollider = enemyReference.GetComponent <EnemyCollider>();
     //
     targeteable = enemyReference.GetComponent <Targeteable>();
     // Chequeo extra para  las body parts
     if (targeteable == null)
     {
         targeteable = enemyReference.GetComponentInParent <Targeteable>();
     }
     isActive = true;
 }
Example #6
0
    //
    public void SendToReserve(int index, GameObject downedEnemy)
    {
        // Chequeo extra para solventar problemas con la jerarquía
        EnemyConsistency enemyConsistency = downedEnemy.GetComponent <EnemyConsistency>();

        if (enemyConsistency == null)
        {
            downedEnemy.transform.GetChild(0).localPosition = Vector3.zero;
        }
        //
        activeEnemies[index].Remove(downedEnemy);
        reserveEnemies[index].Add(downedEnemy);
        downedEnemy.SetActive(false);
    }
Example #7
0
    // Start is called before the first frame update
    void Start()
    {
        //
        robotControl   = FindObjectOfType <RobotControl>();
        gameManager    = FindObjectOfType <GameManager>();
        enemyManager   = GetComponent <EnemyManager>();
        terrainManager = GetComponent <TerrainManager>();
        fade           = FindObjectOfType <Fade>();
        inputManager   = FindObjectOfType <InputManager>();

        // In arcade mode we get the data from level info list
        //if(gameManager.gameMode == GameMode.Arcade)
        LoadLevelDataArcade();
        // In boss mode...

        /*else
         * {
         *
         * }*/


        //
        //switch (victoryCondition)
        //{
        //    case VictoryCondition.DefeatAllEnemies:
        //        EnemyConsistency[] enemiesInLevel = FindObjectsOfType<EnemyConsistency>();
        //        enemiesToDestroy = enemiesInLevel.Length;
        //        break;
        //}

        //
        if (victoryCondition == VictoryCondition.DefeatCertainEnemy)
        {
            EnemyConsistency enemyConsistency = levelInfo.enemiesSpawnSettings[0].enemyPrefab.GetComponent <EnemyConsistency>();

            if (enemyConsistency == null)
            {
                enemyConsistency = levelInfo.enemiesSpawnSettings[0].enemyPrefab.GetComponentInChildren <EnemyConsistency>();
            }

            enemyToKillName = enemyConsistency.inGameName;
        }

        // Escodemos el cursor para jugar birn
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
    }
Example #8
0
    public static void Release()
    {
        //
        //Debug.Log("Releasing enemy");

        // Trabajamos con el transform del targeteable
        if (targeteable != null)
        {
            lastEnemyPosition = targeteable.transform.position;
        }
        //
        enemyTransform = null;
        enemyRb        = null;

        // Chequeo para los componentes que no lo tienen, como los WeakPoints
        if (enemyConsistency != null)
        {
            enemyConsistency.SetOriginalPenetrationColors();
        }

        enemyConsistency = null;
        isActive         = false;
    }
Example #9
0
    // Start is called before the first frame update
    void Start()
    {
        // Cogemos el componente cuerpo del padre
        if (transform.parent != null)
        {
            //body = transform.parent.GetComponent<EnemyConsistency>();
            body = transform.GetComponentInParent <EnemyConsistency>();
        }
        // Para casos en los que el body solo tiene un collider
        // y por tanto lo lleva integrado
        if (body == null)
        {
            body = GetComponent <EnemyConsistency>();
        }
        // Intento extra para gusano garnde
        if (body == null)
        {
            body = transform.parent.GetComponentInChildren <EnemyConsistency>();
        }
        //
        if (body != null)
        {
            bodyBehaviour = body.GetComponent <EnemyBaseBodyBehaviour>();
        }

        //
        //bodyRb = body.GetComponent<Rigidbody>();

        //
        GetOriginalColors();
        // Si no hay efecto adicional asignado no tiene sentido poner vida aparte
        if (onDamage != AdditionalEffectOnDamage.None)
        {
            currentLocationHealth = maxLocationHealth;
        }
    }
Example #10
0
    //
    bool EnemyOnSight(Vector3 enemyPosition)
    {
        //
        RaycastHit hitInfo;
        Vector3    direction = enemyPosition - transform.position;

        //
        if (Physics.Raycast(transform.position, direction, out hitInfo, direction.magnitude))
        {
            //Debug.Log("Object 'on sight': " + hitInfo.transform);
            EnemyCollider enemyCollider = hitInfo.transform.GetComponent <EnemyCollider>();
            if (enemyCollider != null)
            {
                return(true);
            }
            EnemyConsistency enemyConsistency = hitInfo.transform.GetComponent <EnemyConsistency>();
            if (enemyConsistency != null)
            {
                return(true);
            }
        }
        //
        return(false);
    }
Example #11
0
    /// <summary>
    /// Activa los enemigos y los coloca donde corresponde
    /// Puede ser llamado por el boss
    /// </summary>
    /// <param name="i"></param>
    public void ActivateEnemies(int i, Vector3 spawnPoint = new Vector3())
    {
        //Metodo con spawn points
        EnemyIdentifier enemyIdentifier = enemiesSpawnSettings[i].enemyPrefab.GetComponent <EnemyIdentifier>();
        Transform       groupSpawn;
        Vector3         pointForGroupSpawn;

        //
        if (spawnPoint != Vector3.zero)
        {
            pointForGroupSpawn = spawnPoint;
        }
        else if (enemyIdentifier)
        {
            EnemyType typeToSpawn = enemyIdentifier.enemyType;
            groupSpawn = GetRandomSpawmPointNearerThanX(typeToSpawn, farestSpawnDistanceToEpicenter);
            // Control de errores
            if (groupSpawn == null)
            {
                return;
            }
            pointForGroupSpawn = groupSpawn.position;
        }
        else
        {
            // TODO: Desarrorlo
            pointForGroupSpawn = epicenterPoint;
        }

        // NOTA: Control de error
        // De primeras no debería haber tamaño de spawn 0
        int enemiesToSpawn = (int)GameManager.instance.ApplyDifficultyFactor(enemiesSpawnSettings[i].enemiesToSpawn, 1);

        Debug.Log("Spawning enemies: " + enemiesSpawnSettings[i].enemiesToSpawn + ", " + enemiesToSpawn);
        // Aparte, ahora sale todo el grupo o no sale
        if (/*enemiesSpawnSettings[i].*/ enemiesToSpawn > 0 &&
            /*enemiesSpawnSettings[i].enemiesToSpawn*/ enemiesToSpawn <= enemiesSpawnSettings[i].maxActiveEnemies - activeEnemies[i].Count)
        {
            // Si no hay enemigos activos de ese tipo, aviso de Carol
            if (activeEnemies[i].Count == 0)
            {
                carolHelp.TriggerGeneralAdvice("EnemiesIncoming");
            }
            // Primero iniciamos la formación
            EnemyFormation newEnemyFormation = null;
            if (enemiesSpawnSettings[i].formationData != null)
            {
                //
                //newEnemyFormation = new EnemyFormation(enemiesSpawnSettings[i].enemiesToSpawn,
                //    enemiesSpawnSettings[i].formationData.formationInfo.formationType,
                //    enemiesSpawnSettings[i].formationData.formationInfo.distanceBetweenMembers);
                newEnemyFormation = new EnemyFormation(enemiesSpawnSettings[i].formationData.formationInfo,
                                                       /*enemiesSpawnSettings[i].*/ enemiesToSpawn);
                //
                enemyFormations.Add(newEnemyFormation);
            }
            //
            float memberSpawnAngle = 360 / /*enemiesSpawnSettings[i].*/ enemiesToSpawn;
            float meberSpawnRadius = 10;
            // Sacamos a los enemigos
            for (int j = 0; j < /*enemiesSpawnSettings[i].*/ enemiesToSpawn; j++)
            {
                //
                float   memberSpawnCoordinates = memberSpawnAngle * j;
                Vector2 memberSpawnPositionXY  = new Vector2(Mathf.Cos(memberSpawnCoordinates) * meberSpawnRadius,
                                                             Mathf.Sin(memberSpawnCoordinates) * meberSpawnRadius);

                //Vector3 positionToSpawn = new Vector3(Random.Range(-groupToSpawnSize[i], groupToSpawnSize[i]) + pointForGroupSpawn.x, 1,
                //                                        Random.Range(-groupToSpawnSize[i], groupToSpawnSize[i]) + pointForGroupSpawn.z);
                Vector3 positionToSpawn = new Vector3(pointForGroupSpawn.x + memberSpawnPositionXY.x,
                                                      pointForGroupSpawn.y, pointForGroupSpawn.z + memberSpawnPositionXY.y);

                // TODO: Chequear cuando esté vacía
                if (reserveEnemies[i].Count == 0)
                {
                    Debug.Log("No more enemies in reserve");
                    continue;
                }
                GameObject nextEnemy = reserveEnemies[i][0];
                reserveEnemies[i].Remove(nextEnemy);
                // TODO: Revisar que falla aquí
                if (nextEnemy.gameObject == null)
                {
                    Debug.Log(nextEnemy);
                    continue;
                }
                // TODO: Revisar lo de la posición al activarlos
                nextEnemy.SetActive(true);
                nextEnemy.transform.position = positionToSpawn;
                EnemyConsistency enemyConsistency = nextEnemy.GetComponent <EnemyConsistency>();
                // TODO: Cuando esté bien organizado este paso no debería ahcer falta
                if (enemyConsistency == null)
                {
                    enemyConsistency = nextEnemy.GetComponentInChildren <EnemyConsistency>();
                }
                //
                if (enemyConsistency != null)
                {
                    enemyConsistency.ManagerIndex = i;
                    enemyConsistency.ResetStatus();
                }
                // Ponemos los bosses de lado de momento
                if (levelManager.LevelVictoryCondition == VictoryCondition.SlayTheBeast && i == 0)
                {
                    nextEnemy.transform.Rotate(Vector3.up * -90);
                }

                // Y lo añadimos a enemigos activos
                activeEnemies[i].Add(nextEnemy);

                // Si he formación lo metemos a ella
                if (newEnemyFormation != null)
                {
                    //TODO: Meterlo en la formación
                    EnemyBaseBodyBehaviour behaviour = nextEnemy.GetComponent <EnemyBaseBodyBehaviour>();
                    // TODO: Arregalro para que no haga falta hacer esto
                    if (behaviour == null)
                    {
                        behaviour = nextEnemy.GetComponentInChildren <EnemyBaseBodyBehaviour>();
                    }
                    //
                    newEnemyFormation.formationMembers.Add(behaviour);
                    behaviour.enemyFormation = newEnemyFormation;
                }

                //GameObject nextEnemy = Instantiate(enemyPrefabsToUse[i], pointForGroupSpawn, Quaternion.identity);
            }
        }
        //else
        //    Debug.Log("Zero enemies to spawn or no more room for enemies");
    }
Example #12
0
    private void OnGUI()
    {
        // draw Overlay using the entire screen
        //GUI.DrawTexture(new Rect(0, 0,Screen.width, Screen.height), overlayTexture);

        //
        PlayerHealthAndShields();

        // Lo quitamos de momento
        if (EnemyAnalyzer.isActive && EnemyAnalyzer.enemyConsistency != null && EnemyAnalyzer.enemyConsistency.IsMultipart)
        {
            MarkEnemyPartsOnScreen();
        }
        else
        {
            MarkEnemiesOnScreen();
        }

        //
        DrawAbilityIcons();

        //
        if (!cameraControl.TargetingPlayer)
        {
            // Vamos a trabajar para que maneje varios tipos de objetivo
            // Enemy consistency (el viejo)
            // TODO: Gestionar los enemigos muertos de otra forma
            //if (cameraControl.CurrentTarget != null)
            if (EnemyAnalyzer.isActive)
            {
                EnemyConsistency enemyConsistency = EnemyAnalyzer.enemyConsistency;
                if (enemyConsistency != null)
                {
                    EnemyInfoEC();
                }
                // TODO: Hacerlo con weakpoints también
                else
                {
                    EnemyInfoSimple();
                }
                ShowCross();
            }
        }
        else
        {
            ShowCross();
        }

        //
        DrawImpactInfo();

        //
        DrawDamageIndicators();

        //
        DrawRadarWithEnemies();

        //
        if (GameControl.paused)
        {
            DrawControls();
        }

        //
        //ShowPlayerSpeed();

        //
        //ShowChargedAmount();

        //
        //ShowOverheat();

        //
        CheckAndDrawLevelEnd();

        //
        if (bulletPool != null)
        {
            DrawDangerousBulletsDangerIndicators();
        }
    }
Example #13
0
    //
    public void GenerateExplosion()
    {
        //
        if (exploding)
        {
            return;
        }
        else
        {
            exploding = true;
        }
        // Primero aplicamos la onda de choque
        // Vamos a hacer que este daño vaya contra la "estrucura"
        Collider[] affectedColliders = Physics.OverlapSphere(transform.position, shockWaveRange);
        //
        for (int i = 0; i < affectedColliders.Length; i++)
        {
            //
            Vector3 affectedColliderDirection = affectedColliders[i].transform.position - transform.position;
            float   receivedBlastForce        = explosionForce / (1 + Mathf.Pow(affectedColliderDirection.magnitude, 2));
            Vector3 blastForceWithDirection   = affectedColliderDirection.normalized * receivedBlastForce;
            //
            PlayerIntegrity playerIntegrity = affectedColliders[i].GetComponent <PlayerIntegrity>();
            if (playerIntegrity != null)
            {
                playerIntegrity.ReceiveBlastDamage(blastForceWithDirection);
            }
            //
            EnemyCollider enemyCollider = affectedColliders[i].GetComponent <EnemyCollider>();
            if (enemyCollider != null)
            {
                enemyCollider.ReceivePulseDamage(blastForceWithDirection);
            }
            // Después enemy consistencies
            EnemyConsistency enemyConsistency = affectedColliders[i].GetComponent <EnemyConsistency>();
            if (enemyConsistency == null)
            {
                enemyConsistency = affectedColliders[i].GetComponentInParent <EnemyConsistency>();
            }
            if (enemyConsistency != null)
            {
                enemyConsistency.ReceivePulseDamage(blastForceWithDirection);
            }
            //
            DestructibleTerrain destructibleTerrain = affectedColliders[i].GetComponent <DestructibleTerrain>();
            if (destructibleTerrain != null)
            {
                destructibleTerrain.ReceivePulseImpact(blastForceWithDirection);
            }
            // Aplicamos fuerza directa a los rigidbodies que no son el player ni los enemigos
            // Estos se lo gestionan en la funcióbn de recibir daño de explosión
            Rigidbody rigidbody = affectedColliders[i].GetComponent <Rigidbody>();
            if (rigidbody != null && enemyConsistency == null && playerIntegrity == null && rigidbody != proyectileRb)
            {
                rigidbody.AddForce(blastForceWithDirection / 1000);
            }
        }
        //
        if (generatesFragments)
        {
            GenerateFragments(fragmentsPerHeight, fragmentsPerWidth, 1 / 2);
        }
        //
        //GeneralFunctions.PlaySoundEffect(audioObjectManager, explosionClip);
        if (audioObjectManager != null)
        {
            audioObjectManager.CreateAudioObject(explosionClip, transform.position);
        }
        //
        //Destroy(gameObject);
        //proyectileRb.velocity = Vector3.zero;
        //bulletPool.ReturnBullet(gameObject);

        bulletScript.ReturnBulletToPool();
    }
Example #14
0
 // Esta la haremos para los proyectiles disñeados para explotar dentro del objetivo
 // Esto se traducirán en daño adicional en función de la carga explosiva
 public void GenerateInternalExplosion(EnemyConsistency enemyConsistency)
 {
     // TODO: Hcaerla. Hacer función dentro de
     //enemyConsistency.
 }