예제 #1
0
    private void RespondTo_BossFired_Event(bool _oneProjectileIsBig)
    {
        // Change boss animation
        bossManager.StartFiringAnimation();

        // Fire event: Boss fired
        BossFired?.Invoke(_oneProjectileIsBig);
    }
예제 #2
0
    // ---------- SHOW HIDDEN PROJECTILES ----------------------------------------------------+

    #region SHOW HIDDEN PROJECTILES
    private void ShowHiddenProjectiles(GameObject _firstProjectile)
    {
        // Local flag
        bool oneProjectileIsBig = false;

        // ----- IF BOSS IS VULNERABLE -----

        if (state == ObstacleStates.BOSS_VULNERABLE)
        {
            // Show hidden flawed projectile
            flawedProjectile.ShowHidden_ChangeSpeed();

            // Fire event: Boss fired jammed gun
            BossFired_JammedGun?.Invoke();
        }

        // ----- IF BOSS IS NOT VULNERABLE -----

        else if (state != ObstacleStates.SERENITY)
        {
            // Local flag
            bool secondProjectileIsBig = false;

            // Loop "current projectile groups" list
            for (int i = 0; i < currentProjectileGroups.Count; i++)
            {
                // Local flag
                bool firstProjectileWasFound = false;

                // Loop projectiles in current group
                for (int j = 0; j < currentProjectileGroups[i].Count; j++)
                {
                    // If projectile is found: Show all hidden projectiles at the same time
                    if (currentProjectileGroups[i][j].gameObject == _firstProjectile)
                    //if (GameObject.ReferenceEquals(currentProjectileGroups[i][j], _firstProjectile))
                    {
                        // ----- VALIDATE THAT "IF FIRST PROJECTILE IS SMALL -> SECOND PROJECTILE IS NOT BIG" -----

                        // Check if first projectile is small
                        if (!currentProjectileGroups[i][j].CheckIf_ItsBig())
                        {
                            // Loop same cycle as j
                            for (int k = 0; k < currentProjectileGroups[i].Count; k++)
                            {
                                // Check if second projectile is big
                                if ((k != j) && currentProjectileGroups[i][k].CheckIf_ItsBig())
                                {
                                    secondProjectileIsBig = true;
                                    break;
                                }
                            }
                        }

                        if (secondProjectileIsBig)
                        {
                            break;
                        }

                        // ----- SHOW HIDDEN PROJECTILES IF THE VALIDATION WAS CLEARED -----

                        // Loop same cycle as j
                        for (int k = 0; k < currentProjectileGroups[i].Count; k++)
                        {
                            // Show hidden projectile when fired by boss
                            currentProjectileGroups[i][k].ShowHidden_ChangeTag();

                            // Set local flag
                            if (currentProjectileGroups[i][k].CheckIf_ItsBig())
                            {
                                oneProjectileIsBig = true;
                            }
                        }

                        firstProjectileWasFound = true;
                        break;
                    }
                }

                if (firstProjectileWasFound || secondProjectileIsBig)
                {
                    break;
                }
            }

            if (!secondProjectileIsBig)
            {
                // Fire event: Boss fired
                BossFired?.Invoke(oneProjectileIsBig);
            }
        }
    }