Example #1
0
 private void CreateLightCollection()
 {
     if (lightCollection == null)
     {
         chainedPuzzleInstance = GetComponentInChildren <ChainedPuzzleInstance>();
         lightCollection       = LG_LightCollection.Create(chainedPuzzleInstance.m_sourceArea.m_courseNode, new Vector3(0, 0, 0), LG_LightCollectionSorting.Distance, float.MaxValue);
     }
 }
Example #2
0
        private async Task DoorSequence()
        {
            if (trigger == true)
            {
                return;
            }
            trigger = true;
            Utils.ShowWardenMessage("msgCat::Obj.Info" + "\n>\n<size=200%><color=red>" + "Issue with security bypass, standby." + "</color></size>");

            await Task.Delay(1 * 1000);

            lightCollection = LG_LightCollection.Create(chainedPuzzleInstance.m_sourceArea.m_courseNode, new Vector3(0, 0, 0), LG_LightCollectionSorting.Distance, float.MaxValue);

            sound.Post(EVENTS.LIGHTS_OFF_GLOBAL);
            foreach (CollectedLight light in lightCollection.collectedLights)
            {
                light.light.ChangeIntensity(0);
                if (light.light.m_category == LG_Light.LightCategory.Emergency ||
                    light.light.m_category == LG_Light.LightCategory.Door ||
                    light.light.m_category == LG_Light.LightCategory.DoorImportant ||
                    light.light.m_category == LG_Light.LightCategory.Sign)
                {
                    light.light.ChangeColor(new Color(1, 0, 0, 1));
                }
            }

            await Task.Delay(4 * 1000);

            sound.Post(EVENTS.LIGHTS_ON_INTENSITY_1);
            LightsOnForCatagory(LG_Light.LightCategory.Emergency);
            //Main.log.LogDebug("1");
            await Task.Delay(1 * 1000);

            sound.Post(EVENTS.LIGHTS_ON_INTENSITY_2);
            LightsOnForCatagory(LG_Light.LightCategory.DoorImportant);
            //Main.log.LogDebug("2");
            await Task.Delay(1 * 1000);

            sound.Post(EVENTS.LIGHTS_ON_INTENSITY_3);
            LightsOnForCatagory(LG_Light.LightCategory.Door);
            //Main.log.LogDebug("3");
            await Task.Delay(1 * 1000);

            sound.Post(EVENTS.LIGHTS_ON_INTENSITY_4);
            LightsOnForCatagory(LG_Light.LightCategory.Sign);
            //Main.log.LogDebug("4");

            await Task.Delay(5 * 1000);

            HelpText = showHelp.show;
        }
Example #3
0
        public void Trigger()
        {
            lightCollection = LG_LightCollection.Create(EnemyAgent.CourseNode, EnemyAgent.EyePosition, LG_LightCollectionSorting.Distance, EMPConfig.Radius);

            ExtraEnemyAbilities.log.LogDebug($"Collected {lightCollection.collectedLights.Count} lights");


            foreach (var collectedLight in lightCollection.collectedLights)
            {
                if (collectedLight.distance > EMPConfig.Radius)
                {
                    break;
                }
                LightEMPManager prevLightEMPMan = collectedLight.light.gameObject.GetComponent <LightEMPManager>();
                if (prevLightEMPMan != null)
                {
                    prevLightEMPMan.ResetDuration(EMPConfig);
                }
                else
                {
                    LightEMPManager lightEMPMan = collectedLight.light.gameObject.AddComponent <LightEMPManager>();
                    lightEMPMan.ResetDuration(EMPConfig);
                    lightEMPMan.CollectedLight = collectedLight;
                }
            }

            var targets = Physics.OverlapSphere(EnemyAgent.EyePosition, EMPConfig.Radius, LayerManager.MASK_EXPLOSION_TARGETS);

            int playerCount = 0;

            foreach (var target in targets)
            {
                PlayerAgent playerAgent = target.GetComponent <PlayerAgent>();
                if (playerAgent != null)
                {
                    if (playerAgent.IsLocallyOwned)
                    {
                        var existingPEMPM = playerAgent.GetComponent <PlayerEMPManager>();
                        if (existingPEMPM != null)
                        {
                            //TODO Duration
                            existingPEMPM.ResetDuration(EMPConfig.Duration);
                        }
                        else
                        {
                            PlayerEMPManager playerEMPManager = playerAgent.gameObject.AddComponent <PlayerEMPManager>();
                            if (playerEMPManager != null)
                            {
                                playerEMPManager.ResetDuration(EMPConfig.Duration);
                                playerEMPManager.triggered = true;
                            }
                            playerCount++;
                        }
                    }
                }
            }

            ExtraEnemyAbilities.log.LogDebug($"Added PlayerEMPManager to {playerCount} players.");



            Triggered = true;
        }