예제 #1
0
        private void HandleNightmareProximity()
        {
            if (!photonView.isMine)
            {
                return;
            }
            Collider2D[] nightmares = Physics2D.OverlapCircleAll(transform.position, circleCollider.radius * (transform.localScale.x + transform.localScale.y) / 2, whatIsNightmare);
            if (nightmares.Length == 0)
            {
                nightmareCharges -= Time.deltaTime;
                nightmareCharges  = Mathf.Max(nightmareCharges, 0f);
            }
            else
            {
                float modifier = 0f;
                HashSet <BaseNightmare> playerSet = new HashSet <BaseNightmare>();
                foreach (Collider2D collider in nightmares)
                {
                    BaseNightmare behavior = collider.GetComponentInParent <BaseNightmare>();
                    if (behavior == null || playerSet.Contains(behavior))
                    {
                        continue;
                    }
                    playerSet.Add(behavior);
                    float nightmareModifier    = 1f;
                    int   mirrorActivationRank = behavior.GetTalentRank(TalentEnum.MIRROR_ACTIVATION);
                    if (behavior.HasPowerup(Powerup.DOUBLE_OBJECTIVE_SPEED))
                    {
                        nightmareModifier *= 2f;
                    }

                    switch (mirrorActivationRank)
                    {
                    case 1:
                        nightmareModifier *= 1.25f;
                        break;

                    case 2:
                        nightmareModifier *= 2.5f;
                        break;

                    case 3:
                        nightmareCharges = requiredCharges;
                        break;
                    }
                    modifier += nightmareModifier;
                }
                nightmareCharges += Time.deltaTime * modifier;
                nightmareCharges  = Mathf.Min(nightmareCharges, requiredCharges);
            }
        }
        private void HandleNotifications()
        {
            if (gameManagerBehavior == null)
            {
                return;
            }
            List <GameObject>     objectsToDisplay   = new List <GameObject>();
            List <PortalBehavior> particlesToDisplay = new List <PortalBehavior>();

            switch (PlayerStateContainer.Instance.TeamSelection)
            {
            case PlayerStateContainer.EXPLORER:
                BaseExplorer explorer = gameManagerBehavior.Explorer;
                if (explorer != null)
                {
                    if (!explorer.IsDead())
                    {
                        objectsToDisplay.AddRange(GetDeadExplorerNotifications());
                    }
                    else
                    {
                        objectsToDisplay.AddRange(GetLiveExplorerNotifications());
                        objectsToDisplay.AddRange(GetAllLitBonfires());
                    }

                    if (gameManagerBehavior.ShowMirrorNotifications)
                    {
                        objectsToDisplay.AddRange(GetAllUnlitBonfires());
                        objectsToDisplay.AddRange(GetNightmareNotifications());
                        if (!explorer.IsDead())
                        {
                            objectsToDisplay.AddRange(GetLiveExplorerNotifications());
                        }

                        int chestLocatorRank = explorer.GetTalentRank(TalentEnum.CHEST_LOCATOR);
                        if (chestLocatorRank >= 1)
                        {
                            objectsToDisplay.AddRange(GetClosedChests());
                        }
                        if (chestLocatorRank >= 2)
                        {
                            objectsToDisplay.AddRange(GetOpenedChests());
                        }
                    }
                    else if (explorer.HasPowerup(Powerup.NIGHTMARE_VISION))
                    {
                        objectsToDisplay.AddRange(GetNightmareNotifications());
                    }

                    int portalNotificationRank = explorer.GetTalentRank(TalentEnum.PORTAL_NOTIFICATIONS);
                    if (portalNotificationRank >= 1)
                    {
                        particlesToDisplay.AddRange(GetRecentlyChargedPortals());
                    }
                    if (portalNotificationRank >= 2)
                    {
                        particlesToDisplay.AddRange(GetInProgressPortals());
                    }

                    int bonfireNotificationRank = explorer.GetTalentRank(TalentEnum.BONFIRE_PROGRESS_NOTIFICATIONS);
                    if (bonfireNotificationRank == 1)
                    {
                        objectsToDisplay.AddRange(GetAllInProgressBonfires());
                    }
                }
                break;

            case PlayerStateContainer.NIGHTMARE:
                BaseNightmare nightmare = gameManagerBehavior.Nightmare;
                if (nightmare != null)
                {
                    if (gameManagerBehavior.ShowMirrorNotifications)
                    {
                        objectsToDisplay.AddRange(GetNightmareNotifications());
                        objectsToDisplay.AddRange(GetLiveExplorerNotifications());

                        int chestLocatorRank = nightmare.GetTalentRank(TalentEnum.CHEST_LOCATOR);
                        if (chestLocatorRank >= 1)
                        {
                            objectsToDisplay.AddRange(GetClosedChests());
                        }
                        if (chestLocatorRank >= 2)
                        {
                            objectsToDisplay.AddRange(GetOpenedChests());
                        }
                    }
                    else if (nightmare.HasPowerup(Powerup.DREAMER_VISION))
                    {
                        objectsToDisplay.AddRange(GetLiveExplorerNotifications());
                    }
                }
                break;

            default:
                break;
            }
            objectsToDisplay.AddRange(GetRecentlyLitBonfires());
            objectsToDisplay.AddRange(GetRecentlyOpenedChests());
            DrawNotifications(objectsToDisplay);
            DrawParticles(particlesToDisplay);
        }