protected override async Task LoadContent()
        {
            await base.LoadContent();

            graphicsCompositor = new SceneGraphicsCompositorLayers
            {
                Cameras = { Camera.Get<CameraComponent>() },
                Master =
                {
                    Renderers =
                    {
                        new ClearRenderFrameRenderer { Color = Color.Green, Name = "Clear frame" },
                        new SceneDelegateRenderer(PreCameraRendererDraw),
                        new SceneCameraRenderer { Mode = SceneCameraRenderer },
                        new SceneDelegateRenderer(PostCameraRendererDraw),
                    }
                }
            };

            Scene = new Scene { Settings = { GraphicsCompositor = graphicsCompositor } };
            Scene.Entities.Add(Camera);

            AmbientLight = new LightComponent { Type = new LightAmbient { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 };
            var ambientLight = new Entity { AmbientLight };
            Scene.Entities.Add(ambientLight);

            SceneSystem.SceneInstance = new SceneInstance(Services, Scene);
        }
        public override void Start()
        {
            base.Start();

            radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
            officer          = Character.Controlled;

            var handcuffs = officer.Inventory.FindItemByIdentifier("handcuffs");

            handcuffs.Unequip(officer);
            officer.Inventory.RemoveItem(handcuffs);

            var stunbaton = officer.Inventory.FindItemByIdentifier("stunbaton");

            stunbaton.Unequip(officer);
            officer.Inventory.RemoveItem(stunbaton);

            var ballistichelmet = officer.Inventory.FindItemByIdentifier("ballistichelmet");

            ballistichelmet.Unequip(officer);
            officer.Inventory.RemoveItem(ballistichelmet);

            var bodyarmor = officer.Inventory.FindItemByIdentifier("bodyarmor");

            bodyarmor.Unequip(officer);
            officer.Inventory.RemoveItem(bodyarmor);

            var gunOrder = Order.PrefabList.Find(order => order.AITag == "operateweapons");

            officer_gunIcon      = gunOrder.SymbolSprite;
            officer_gunIconColor = gunOrder.Color;

            // Other tutorial items
            tutorial_mechanicFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoorlight")).GetComponent <LightComponent>();
            tutorial_submarineSteering      = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>();

            tutorial_submarineSteering.CanBeSelected = false;
            foreach (ItemComponent ic in tutorial_submarineSteering.Item.Components)
            {
                ic.CanBeSelected = false;
            }

            SetDoorAccess(null, tutorial_mechanicFinalDoorLight, false);

            // Room 2
            officer_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("officer_equipmentobjectivesensor")).GetComponent <MotionSensor>();
            officer_equipmentCabinet         = Item.ItemList.Find(i => i.HasTag("officer_equipmentcabinet")).GetComponent <ItemContainer>();
            officer_firstDoor      = Item.ItemList.Find(i => i.HasTag("officer_firstdoor")).GetComponent <Door>();
            officer_firstDoorLight = Item.ItemList.Find(i => i.HasTag("officer_firstdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(officer_firstDoor, officer_firstDoorLight, false);

            // Room 3
            officer_crawlerSensor   = Item.ItemList.Find(i => i.HasTag("officer_crawlerobjectivesensor")).GetComponent <MotionSensor>();
            officer_crawlerSpawnPos = Item.ItemList.Find(i => i.HasTag("officer_crawlerspawn")).WorldPosition;
            officer_secondDoor      = Item.ItemList.Find(i => i.HasTag("officer_seconddoor")).GetComponent <Door>();
            officer_secondDoorLight = Item.ItemList.Find(i => i.HasTag("officer_seconddoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(officer_secondDoor, officer_secondDoorLight, false);

            // Room 4
            officer_somethingBigSensor = Item.ItemList.Find(i => i.HasTag("officer_somethingbigobjectivesensor")).GetComponent <MotionSensor>();
            officer_coilgunLoader      = Item.ItemList.Find(i => i.HasTag("officer_coilgunloader")).GetComponent <ItemContainer>();
            officer_superCapacitor     = Item.ItemList.Find(i => i.HasTag("officer_supercapacitor")).GetComponent <PowerContainer>();
            officer_coilgunPeriscope   = Item.ItemList.Find(i => i.HasTag("officer_coilgunperiscope"));
            officer_hammerheadSpawnPos = Item.ItemList.Find(i => i.HasTag("officer_hammerheadspawn")).WorldPosition;
            officer_thirdDoor          = Item.ItemList.Find(i => i.HasTag("officer_thirddoor")).GetComponent <Door>();
            officer_thirdDoorLight     = Item.ItemList.Find(i => i.HasTag("officer_thirddoorlight")).GetComponent <LightComponent>();
            officer_ammoShelf_1        = Item.ItemList.Find(i => i.HasTag("officer_ammoshelf_1")).GetComponent <ItemContainer>();
            officer_ammoShelf_2        = Item.ItemList.Find(i => i.HasTag("officer_ammoshelf_2")).GetComponent <ItemContainer>();

            SetDoorAccess(officer_thirdDoor, officer_thirdDoorLight, false);

            // Room 5
            officer_rangedWeaponSensor  = Item.ItemList.Find(i => i.HasTag("officer_rangedweaponobjectivesensor")).GetComponent <MotionSensor>();
            officer_rangedWeaponCabinet = Item.ItemList.Find(i => i.HasTag("officer_rangedweaponcabinet")).GetComponent <ItemContainer>();
            officer_rangedWeaponHolder  = Item.ItemList.Find(i => i.HasTag("officer_rangedweaponholder")).GetComponent <ItemContainer>();
            officer_fourthDoor          = Item.ItemList.Find(i => i.HasTag("officer_fourthdoor")).GetComponent <Door>();
            officer_fourthDoorLight     = Item.ItemList.Find(i => i.HasTag("officer_fourthdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(officer_fourthDoor, officer_fourthDoorLight, false);

            // Room 6
            officer_mudraptorObjectiveSensor = Item.ItemList.Find(i => i.HasTag("officer_mudraptorobjectivesensor")).GetComponent <MotionSensor>();
            officer_mudraptorSpawnPos        = Item.ItemList.Find(i => i.HasTag("officer_mudraptorspawn")).WorldPosition;
            tutorial_securityFinalDoor       = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoor")).GetComponent <Door>();
            tutorial_securityFinalDoorLight  = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(tutorial_securityFinalDoor, tutorial_securityFinalDoorLight, false);

            // Submarine
            tutorial_submarineDoor          = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight     = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            tutorial_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("tutorial_enteredsubmarinesensor")).GetComponent <MotionSensor>();
            officer_subAmmoBox_1            = Item.ItemList.Find(i => i.HasTag("officer_subammobox_1"));
            officer_subAmmoBox_2            = Item.ItemList.Find(i => i.HasTag("officer_subammobox_2"));
            officer_subLoader_1             = Item.ItemList.Find(i => i.HasTag("officer_subloader_1")).GetComponent <ItemContainer>();
            officer_subLoader_2             = Item.ItemList.Find(i => i.HasTag("officer_subloader_2")).GetComponent <ItemContainer>();
            officer_subSuperCapacitor_1     = Item.ItemList.Find(i => i.HasTag("officer_subsupercapacitor_1")).GetComponent <PowerContainer>();
            officer_subSuperCapacitor_2     = Item.ItemList.Find(i => i.HasTag("officer_subsupercapacitor_2")).GetComponent <PowerContainer>();
            officer_subAmmoShelf            = Item.ItemList.Find(i => i.HasTag("officer_subammoshelf")).GetComponent <ItemContainer>();
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, true);
        }
        public override LightShadowMapTexture CreateShadowMapTexture(RenderView renderView, LightComponent lightComponent, IDirectLight light, int shadowMapSize)
        {
            var shadowMap = base.CreateShadowMapTexture(renderView, lightComponent, light, shadowMapSize);

            shadowMap.CascadeCount = ((LightDirectionalShadowMap)light.Shadow).GetCascadeCount();
            // Views with orthographic cameras cannot use cascades, we force it to 1 shadow map here.
            if (renderView.Projection.M44 == 1.0f)
            {
                shadowMap.ShadowType  &= ~(LightShadowType.CascadeMask);
                shadowMap.ShadowType  |= LightShadowType.Cascade1;
                shadowMap.CascadeCount = (int)LightShadowMapCascadeCount.OneCascade;
            }
            return(shadowMap);
        }
 public LightEntry(int currentLightGroupIndex, int currentLightGroupIndexNoShadows, LightComponent light, LightShadowMapTexture shadow)
 {
     GroupIndex          = currentLightGroupIndex;
     GroupIndexNoShadows = currentLightGroupIndexNoShadows;
     Light  = light;
     Shadow = shadow;
 }
Esempio n. 5
0
 protected virtual void OnExecuting(GraphicEntity entity, ref LightComponent light, ref ColorComponent color, ISceneSnapshot snapshot)
 {
 }
Esempio n. 6
0
        public override void Start()
        {
            base.Start();

            captain          = Character.Controlled;
            radioSpeakerName = TextManager.Get("Tutorial.Radio.Watchman");
            GameMain.GameSession.CrewManager.AllowCharacterSwitch = false;

            var revolver = captain.Inventory.FindItemByIdentifier("revolver");

            revolver.Unequip(captain);
            captain.Inventory.RemoveItem(revolver);

            var captainscap = captain.Inventory.FindItemByIdentifier("captainscap");

            captainscap.Unequip(captain);
            captain.Inventory.RemoveItem(captainscap);

            var captainsuniform = captain.Inventory.FindItemByIdentifier("captainsuniform");

            captainsuniform.Unequip(captain);
            captain.Inventory.RemoveItem(captainsuniform);

            var steerOrder = Order.PrefabList.Find(order => order.AITag == "steer");

            captain_steerIcon      = steerOrder.SymbolSprite;
            captain_steerIconColor = steerOrder.Color;

            // Room 2
            captain_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_equipmentobjectivesensor")).GetComponent <MotionSensor>();
            captain_equipmentCabinet         = Item.ItemList.Find(i => i.HasTag("captain_equipmentcabinet")).GetComponent <ItemContainer>();
            captain_firstDoor      = Item.ItemList.Find(i => i.HasTag("captain_firstdoor")).GetComponent <Door>();
            captain_firstDoorLight = Item.ItemList.Find(i => i.HasTag("captain_firstdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(captain_firstDoor, captain_firstDoorLight, true);

            // Room 3
            captain_medicObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_medicobjectivesensor")).GetComponent <MotionSensor>();
            captain_medicSpawnPos        = Item.ItemList.Find(i => i.HasTag("captain_medicspawnpos")).WorldPosition;
            tutorial_submarineDoor       = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight  = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            var medicInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "medicaldoctor"));

            captain_medic = Character.Create(medicInfo, captain_medicSpawnPos, "medicaldoctor");
            captain_medic.GiveJobItems(null);
            captain_medic.CanSpeak = captain_medic.AIController.Enabled = false;
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false);

            // Submarine
            captain_enteredSubmarineSensor    = Item.ItemList.Find(i => i.HasTag("captain_enteredsubmarinesensor")).GetComponent <MotionSensor>();
            tutorial_submarineReactor         = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent <Reactor>();
            captain_navConsole                = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>();
            captain_navConsoleCustomInterface = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <CustomInterface>();
            captain_sonar         = captain_navConsole.Item.GetComponent <Sonar>();
            captain_statusMonitor = Item.ItemList.Find(i => i.HasTag("captain_statusmonitor"));

            tutorial_submarineReactor.CanBeSelected = false;
            tutorial_submarineReactor.IsActive      = tutorial_submarineReactor.AutoTemp = false;

            tutorial_lockedDoor_1 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_1")).GetComponent <Door>();
            tutorial_lockedDoor_2 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_2")).GetComponent <Door>();
            SetDoorAccess(tutorial_lockedDoor_1, null, false);
            SetDoorAccess(tutorial_lockedDoor_2, null, false);

            var mechanicInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "mechanic"));

            captain_mechanic = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job, Submarine.MainSub).WorldPosition, "mechanic");
            captain_mechanic.GiveJobItems();

            var securityInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "securityofficer"));

            captain_security = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job, Submarine.MainSub).WorldPosition, "securityofficer");
            captain_security.GiveJobItems();

            var engineerInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer"));

            captain_engineer = Character.Create(engineerInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job, Submarine.MainSub).WorldPosition, "engineer");
            captain_engineer.GiveJobItems();

            captain_mechanic.CanSpeak             = captain_security.CanSpeak = captain_engineer.CanSpeak = false;
            captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = false;
        }
        public override void Start()
        {
            base.Start();

            var firstAidOrder = Order.GetPrefab("requestfirstaid");

            doctor_firstAidIcon      = firstAidOrder.SymbolSprite;
            doctor_firstAidIconColor = firstAidOrder.Color;

            subPatients      = new List <Character>();
            radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
            doctor           = Character.Controlled;

            var bandages = FindOrGiveItem(doctor, "antibleeding1");

            bandages.Unequip(doctor);
            doctor.Inventory.RemoveItem(bandages);

            var syringegun = FindOrGiveItem(doctor, "syringegun");

            syringegun.Unequip(doctor);
            doctor.Inventory.RemoveItem(syringegun);

            var antibiotics = FindOrGiveItem(doctor, "antibiotics");

            antibiotics.Unequip(doctor);
            doctor.Inventory.RemoveItem(antibiotics);

            var morphine = FindOrGiveItem(doctor, "antidama1");

            morphine.Unequip(doctor);
            doctor.Inventory.RemoveItem(morphine);

            doctor_suppliesCabinet = Item.ItemList.Find(i => i.HasTag("doctor_suppliescabinet"))?.GetComponent <ItemContainer>();
            doctor_medBayCabinet   = Item.ItemList.Find(i => i.HasTag("doctor_medbaycabinet"))?.GetComponent <ItemContainer>();

            var patientHull1 = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "waitingroom").CurrentHull;
            var patientHull2 = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "airlock").CurrentHull;

            medBay = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "medbay").CurrentHull;

            var assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("assistant"));

            patient1        = Character.Create(assistantInfo, patientHull1.WorldPosition, "1");
            patient1.TeamID = Character.TeamType.Team1;
            patient1.GiveJobItems(null);
            patient1.CanSpeak = false;
            patient1.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.Burn, 45.0f)
            }, stun: 0, playSound: false);
            patient1.AIController.Enabled = false;

            assistantInfo   = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("assistant"));
            patient2        = Character.Create(assistantInfo, patientHull2.WorldPosition, "2");
            patient2.TeamID = Character.TeamType.Team1;
            patient2.GiveJobItems(null);
            patient2.CanSpeak             = false;
            patient2.AIController.Enabled = false;

            var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("engineer"));
            var subPatient1  = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job, Submarine.MainSub).WorldPosition, "3");

            subPatient1.TeamID = Character.TeamType.Team1;
            subPatient1.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.Burn, 40.0f)
            }, stun: 0, playSound: false);
            subPatients.Add(subPatient1);

            var securityInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("securityofficer"));
            var subPatient2  = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job, Submarine.MainSub).WorldPosition, "3");

            subPatient2.TeamID = Character.TeamType.Team1;
            subPatient2.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.InternalDamage, 40.0f)
            }, stun: 0, playSound: false);
            subPatients.Add(subPatient2);

            var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("engineer"));
            var subPatient3  = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job, Submarine.MainSub).WorldPosition, "3");

            subPatient3.TeamID = Character.TeamType.Team1;
            subPatient3.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.Burn, 20.0f)
            }, stun: 0, playSound: false);
            subPatients.Add(subPatient3);

            doctor_firstDoor        = Item.ItemList.Find(i => i.HasTag("doctor_firstdoor")).GetComponent <Door>();
            doctor_secondDoor       = Item.ItemList.Find(i => i.HasTag("doctor_seconddoor")).GetComponent <Door>();
            doctor_thirdDoor        = Item.ItemList.Find(i => i.HasTag("doctor_thirddoor")).GetComponent <Door>();
            tutorial_upperFinalDoor = Item.ItemList.Find(i => i.HasTag("tutorial_upperfinaldoor")).GetComponent <Door>();
            doctor_firstDoorLight   = Item.ItemList.Find(i => i.HasTag("doctor_firstdoorlight")).GetComponent <LightComponent>();
            doctor_secondDoorLight  = Item.ItemList.Find(i => i.HasTag("doctor_seconddoorlight")).GetComponent <LightComponent>();
            doctor_thirdDoorLight   = Item.ItemList.Find(i => i.HasTag("doctor_thirddoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(doctor_firstDoor, doctor_firstDoorLight, false);
            SetDoorAccess(doctor_secondDoor, doctor_secondDoorLight, false);
            SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, false);
            tutorial_submarineDoor      = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false);
            tutorial_lockedDoor_2 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_2")).GetComponent <Door>();
            SetDoorAccess(tutorial_lockedDoor_2, null, true);


            foreach (var patient in subPatients)
            {
                patient.CanSpeak             = false;
                patient.AIController.Enabled = false;
                patient.GiveJobItems();
            }

            Item reactorItem = Item.ItemList.Find(i => i.Submarine == Submarine.MainSub && i.GetComponent <Reactor>() != null);

            reactorItem.GetComponent <Reactor>().AutoTemp = true;
        }
        protected override async Task LoadContent()
        {
            CreatePipeline();

            await base.LoadContent();

            IsMouseVisible = true;
            rotateLights   = true;

            // load the model
            characterEntity = Asset.Load <Entity>("character_00");
            characterEntity.Transformation.Rotation    = Quaternion.RotationAxis(Vector3.UnitX, (float)(0.5 * Math.PI));
            characterEntity.Transformation.Translation = characterInitPos;
            Entities.Add(characterEntity);

            // create the stand
            var material    = Asset.Load <Material>("character_00_material_mc00");
            var standEntity = CreateStand(material);

            standEntity.Transformation.Translation = new Vector3(0, 0, -80);
            standEntity.Transformation.Rotation    = Quaternion.RotationAxis(Vector3.UnitX, (float)(0.5 * Math.PI));
            Entities.Add(standEntity);

            var standBorderEntity = CreateStandBorder(material);

            standBorderEntity.Transformation.Translation = new Vector3(0, 0, -80);
            standBorderEntity.Transformation.Rotation    = Quaternion.RotationAxis(Vector3.UnitX, (float)(0.5 * Math.PI));
            Entities.Add(standBorderEntity);

            // create the lights
            var directLightEntity = CreateDirectLight(new Vector3(-1, 1, -1), new Color3(1, 1, 1), 0.9f);

            directionalLight = directLightEntity.Get <LightComponent>();
            Entities.Add(directLightEntity);

            var spotLightEntity = CreateSpotLight(new Vector3(0, -500, 600), new Vector3(0, -200, 0), 15, 20, new Color3(1, 1, 1), 0.9f);

            Entities.Add(spotLightEntity);
            spotLight = spotLightEntity.Get <LightComponent>();

            var rand = new Random();

            for (var i = -800; i <= 800; i = i + 200)
            {
                for (var j = -800; j <= 800; j = j + 200)
                {
                    var position = new Vector3(i, j, (float)(rand.NextDouble() * 150));
                    var color    = new Color3((float)rand.NextDouble() + 0.3f, (float)rand.NextDouble() + 0.3f, (float)rand.NextDouble() + 0.3f);
                    var light    = CreatePointLight(position, color);
                    pointLights.Add(light.Get <LightComponent>());
                    pointLightEntities.Add(light);
                    Entities.Add(light);
                }
            }

            // set the camera
            var targetEntity = new Entity(characterInitPos);
            var cameraEntity = CreateCamera(cameraInitPos, targetEntity, (float)GraphicsDevice.BackBuffer.Width / (float)GraphicsDevice.BackBuffer.Height);

            camera = cameraEntity.Get <CameraComponent>();
            Entities.Add(cameraEntity);
            RenderSystem.Pipeline.SetCamera(camera);

            // UI
            CreateUI();

            // Add a custom script
            Script.Add(UpdateScene);
        }
Esempio n. 9
0
 protected override void AddLightInternal(LightComponent light)
 {
     lightDirections[Count] = light.Direction;
     lightColors[Count]     = light.Color;
 }
Esempio n. 10
0
 protected abstract void AddLightInternal(LightComponent light);
        private LightComponentCollectionGroup GetLightGroup(RenderViewLightData renderViewData, LightComponent light)
        {
            LightComponentCollectionGroup lightGroup;

            var directLight = light.Type as IDirectLight;
            var lightGroups = renderViewData.ActiveLightGroups;

            var type = light.Type.GetType();

            if (!lightGroups.TryGetValue(type, out lightGroup))
            {
                lightGroup = new LightComponentCollectionGroup(type);
                lightGroups.Add(type, lightGroup);
            }
            return(lightGroup);
        }
Esempio n. 12
0
        public override void ProcessLights(ProcessLightsParameters parameters)
        {
            if (parameters.LightCollection.Count == 0)
            {
                return;
            }

            ILightShadowMapRenderer currentShadowRenderer = null;
            LightShadowType         currentShadowType     = 0;

            // Start by filtering/sorting what can be processed
            shadowComparer.ShadowMapTexturesPerLight = parameters.ShadowMapTexturesPerLight;
            parameters.LightCollection.Sort(parameters.LightStart, parameters.LightEnd - parameters.LightStart, shadowComparer);

            for (int index = parameters.LightStart; index <= parameters.LightEnd; index++)
            {
                LightShadowType         nextShadowType     = 0;
                ILightShadowMapRenderer nextShadowRenderer = null;

                LightShadowMapTexture nextShadowTexture = null;
                LightComponent        nextLight         = null;
                if (index < parameters.LightEnd)
                {
                    nextLight = parameters.LightCollection[index];

                    if (parameters.ShadowMapRenderer != null &&
                        parameters.ShadowMapTexturesPerLight.TryGetValue(nextLight, out nextShadowTexture) &&
                        nextShadowTexture.Atlas != null)    // atlas could not be allocated? treat it as a non-shadowed texture
                    {
                        nextShadowType     = nextShadowTexture.ShadowType;
                        nextShadowRenderer = nextShadowTexture.Renderer;
                    }
                }

                // Flush current group
                if (index == parameters.LightEnd || currentShadowType != nextShadowType || currentShadowRenderer != nextShadowRenderer)
                {
                    if (processedLights.Count > 0)
                    {
                        var lightGroupKey = new LightGroupKey(currentShadowRenderer, currentShadowType);
                        LightShaderGroupDynamic lightShaderGroup;
                        if (!lightShaderGroupPool.TryGetValue(lightGroupKey, out lightShaderGroup))
                        {
                            ILightShadowMapShaderGroupData shadowGroupData = null;
                            if (currentShadowRenderer != null)
                            {
                                shadowGroupData = currentShadowRenderer.CreateShaderGroupData(currentShadowType);
                            }

                            lightShaderGroup = CreateLightShaderGroup(parameters.Context, shadowGroupData);
                            lightShaderGroup.SetViews(parameters.Views);

                            lightShaderGroupPool.Add(lightGroupKey, lightShaderGroup);
                        }

                        // Add view and lights
                        var allowedLightCount = lightShaderGroup.AddView(parameters.ViewIndex, parameters.View, processedLights.Count);
                        for (int i = 0; i < allowedLightCount; ++i)
                        {
                            var light = processedLights[i];
                            lightShaderGroup.AddLight(light.Light, light.ShadowMapTexture);
                        }

                        // TODO: assign extra lights to non-shadow rendering if possible
                        //for (int i = lightCount; i < processedLights.Count; ++i)
                        //    XXX.AddLight(processedLights[i], null);

                        var lightShaderGroupEntry = new LightShaderGroupEntry(lightGroupKey, lightShaderGroup);
                        if (!lightShaderGroups.Contains(lightShaderGroupEntry))
                        {
                            lightShaderGroups.Add(lightShaderGroupEntry);
                        }

                        processedLights.Clear();
                    }

                    // Start next group
                    currentShadowType     = nextShadowType;
                    currentShadowRenderer = nextShadowRenderer;
                }

                if (index < parameters.LightEnd)
                {
                    // Do we need to process non shadowing lights or defer it to something else?
                    if (nextShadowTexture == null && NonShadowRenderer != null)
                    {
                        parameters.LightStart = index;
                        NonShadowRenderer.ProcessLights(parameters);
                        break;
                    }

                    processedLights.Add(new LightDynamicEntry(nextLight, nextShadowTexture));
                }
            }

            processedLights.Clear();
        }
Esempio n. 13
0
        public override void Start()
        {
            base.Start();

            radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
            mechanic         = Character.Controlled;

            var toolbox = mechanic.Inventory.FindItemByIdentifier("toolbox");

            toolbox.Unequip(mechanic);
            mechanic.Inventory.RemoveItem(toolbox);

            var crowbar = mechanic.Inventory.FindItemByIdentifier("crowbar");

            crowbar.Unequip(mechanic);
            mechanic.Inventory.RemoveItem(crowbar);

            var repairOrder = Order.PrefabList.Find(order => order.AITag == "repairsystems");

            mechanic_repairIcon      = repairOrder.SymbolSprite;
            mechanic_repairIconColor = repairOrder.Color;

            // Other tutorial items
            tutorial_securityFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoorlight")).GetComponent <LightComponent>();
            tutorial_upperFinalDoor         = Item.ItemList.Find(i => i.HasTag("tutorial_upperfinaldoor")).GetComponent <Door>();
            tutorial_submarineSteering      = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>();

            tutorial_submarineSteering.CanBeSelected = false;
            foreach (ItemComponent ic in tutorial_submarineSteering.Item.Components)
            {
                ic.CanBeSelected = false;
            }

            SetDoorAccess(null, tutorial_securityFinalDoorLight, false);
            SetDoorAccess(tutorial_upperFinalDoor, null, false);

            // Room 1
            mechanic_firstDoor      = Item.ItemList.Find(i => i.HasTag("mechanic_firstdoor")).GetComponent <Door>();
            mechanic_firstDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_firstdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(mechanic_firstDoor, mechanic_firstDoorLight, false);

            // Room 2
            mechanic_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_equipmentobjectivesensor")).GetComponent <MotionSensor>();
            mechanic_equipmentCabinet         = Item.ItemList.Find(i => i.HasTag("mechanic_equipmentcabinet")).GetComponent <ItemContainer>();
            mechanic_secondDoor      = Item.ItemList.Find(i => i.HasTag("mechanic_seconddoor")).GetComponent <Door>();
            mechanic_secondDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_seconddoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(mechanic_secondDoor, mechanic_secondDoorLight, false);

            // Room 3
            mechanic_weldingObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_weldingobjectivesensor")).GetComponent <MotionSensor>();
            mechanic_workingPump            = Item.ItemList.Find(i => i.HasTag("mechanic_workingpump")).GetComponent <Pump>();
            mechanic_thirdDoor      = Item.ItemList.Find(i => i.HasTag("mechanic_thirddoor")).GetComponent <Door>();
            mechanic_thirdDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_thirddoorlight")).GetComponent <LightComponent>();
            mechanic_brokenWall_1   = Structure.WallList.Find(i => i.SpecialTag == "mechanic_brokenwall_1");
            //mechanic_ladderSensor = Item.ItemList.Find(i => i.HasTag("mechanic_laddersensor")).GetComponent<MotionSensor>();

            SetDoorAccess(mechanic_thirdDoor, mechanic_thirdDoorLight, false);
            mechanic_brokenWall_1.Indestructible = false;
            mechanic_brokenWall_1.SpriteColor    = Color.White;
            for (int i = 0; i < mechanic_brokenWall_1.SectionCount; i++)
            {
                mechanic_brokenWall_1.AddDamage(i, 165);
            }
            mechanic_brokenhull_1 = mechanic_brokenWall_1.Sections[0].gap.FlowTargetHull;

            // Room 4
            mechanic_craftingObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_craftingobjectivesensor")).GetComponent <MotionSensor>();
            mechanic_deconstructor           = Item.ItemList.Find(i => i.HasTag("mechanic_deconstructor")).GetComponent <Deconstructor>();
            mechanic_fabricator      = Item.ItemList.Find(i => i.HasTag("mechanic_fabricator")).GetComponent <Fabricator>();
            mechanic_craftingCabinet = Item.ItemList.Find(i => i.HasTag("mechanic_craftingcabinet")).GetComponent <ItemContainer>();
            mechanic_fourthDoor      = Item.ItemList.Find(i => i.HasTag("mechanic_fourthdoor")).GetComponent <Door>();
            mechanic_fourthDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_fourthdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(mechanic_fourthDoor, mechanic_fourthDoorLight, false);

            // Room 5
            mechanic_fifthDoor      = Item.ItemList.Find(i => i.HasTag("mechanic_fifthdoor")).GetComponent <Door>();
            mechanic_fifthDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_fifthdoorlight")).GetComponent <LightComponent>();
            mechanic_fireSensor     = Item.ItemList.Find(i => i.HasTag("mechanic_firesensor")).GetComponent <MotionSensor>();

            SetDoorAccess(mechanic_fifthDoor, mechanic_fifthDoorLight, false);

            // Room 6
            mechanic_divingSuitObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_divingsuitobjectivesensor")).GetComponent <MotionSensor>();
            mechanic_divingSuitContainer       = Item.ItemList.Find(i => i.HasTag("mechanic_divingsuitcontainer")).GetComponent <ItemContainer>();
            for (int i = 0; i < mechanic_divingSuitContainer.Inventory.Items.Length; i++)
            {
                foreach (ItemComponent ic in mechanic_divingSuitContainer.Inventory.Items[i].Components)
                {
                    ic.CanBePicked = true;
                }
            }
            mechanic_oxygenContainer = Item.ItemList.Find(i => i.HasTag("mechanic_oxygencontainer")).GetComponent <ItemContainer>();
            for (int i = 0; i < mechanic_oxygenContainer.Inventory.Items.Length; i++)
            {
                foreach (ItemComponent ic in mechanic_oxygenContainer.Inventory.Items[i].Components)
                {
                    ic.CanBePicked = true;
                }
            }
            tutorial_mechanicFinalDoor      = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoor")).GetComponent <Door>();
            tutorial_mechanicFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(tutorial_mechanicFinalDoor, tutorial_mechanicFinalDoorLight, false);

            // Room 7
            mechanic_brokenPump = Item.ItemList.Find(i => i.HasTag("mechanic_brokenpump")).GetComponent <Pump>();
            mechanic_brokenPump.Item.Indestructible = false;
            mechanic_brokenPump.Item.Condition      = 0;
            mechanic_brokenWall_2       = Structure.WallList.Find(i => i.SpecialTag == "mechanic_brokenwall_2");
            tutorial_submarineDoor      = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();

            mechanic_brokenWall_2.Indestructible = false;
            mechanic_brokenWall_2.SpriteColor    = Color.White;
            for (int i = 0; i < mechanic_brokenWall_2.SectionCount; i++)
            {
                mechanic_brokenWall_2.AddDamage(i, 165);
            }
            mechanic_brokenhull_2 = mechanic_brokenWall_2.Sections[0].gap.FlowTargetHull;
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false);

            // Submarine
            tutorial_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("tutorial_enteredsubmarinesensor")).GetComponent <MotionSensor>();
            mechanic_submarineEngine        = Item.ItemList.Find(i => i.HasTag("mechanic_submarineengine")).GetComponent <Engine>();
            mechanic_submarineEngine.Item.Indestructible = false;
            mechanic_submarineEngine.Item.Condition      = 0f;
            mechanic_ballastPump_1 = Item.ItemList.Find(i => i.HasTag("mechanic_ballastpump_1")).GetComponent <Pump>();
            mechanic_ballastPump_1.Item.Indestructible = false;
            mechanic_ballastPump_1.Item.Condition      = 0f;
            mechanic_ballastPump_2 = Item.ItemList.Find(i => i.HasTag("mechanic_ballastpump_2")).GetComponent <Pump>();
            mechanic_ballastPump_2.Item.Indestructible = false;
            mechanic_ballastPump_2.Item.Condition      = 0f;
        }
Esempio n. 14
0
 public void AddWorldLight(LightComponent InLightComponent)
 {
     WorldLightList.Add(InLightComponent);
 }
Esempio n. 15
0
        public override void Start()
        {
            base.Start();

            radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
            engineer         = Character.Controlled;

            var toolbelt = FindOrGiveItem(engineer, "toolbelt");

            toolbelt.Unequip(engineer);
            engineer.Inventory.RemoveItem(toolbelt);

            var repairOrder = Order.GetPrefab("repairsystems");

            engineer_repairIcon      = repairOrder.SymbolSprite;
            engineer_repairIconColor = repairOrder.Color;

            var reactorOrder = Order.GetPrefab("operatereactor");

            engineer_reactorIcon      = reactorOrder.SymbolSprite;
            engineer_reactorIconColor = reactorOrder.Color;

            // Other tutorial items
            tutorial_securityFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoorlight")).GetComponent <LightComponent>();
            tutorial_mechanicFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoorlight")).GetComponent <LightComponent>();
            tutorial_submarineSteering      = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>();

            tutorial_submarineSteering.CanBeSelected = false;
            foreach (ItemComponent ic in tutorial_submarineSteering.Item.Components)
            {
                ic.CanBeSelected = false;
            }

            SetDoorAccess(null, tutorial_securityFinalDoorLight, false);
            SetDoorAccess(null, tutorial_mechanicFinalDoorLight, false);

            // Room 2
            engineer_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_equipmentobjectivesensor")).GetComponent <MotionSensor>();
            engineer_equipmentCabinet         = Item.ItemList.Find(i => i.HasTag("engineer_equipmentcabinet")).GetComponent <ItemContainer>();
            engineer_firstDoor      = Item.ItemList.Find(i => i.HasTag("engineer_firstdoor")).GetComponent <Door>();
            engineer_firstDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_firstdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(engineer_firstDoor, engineer_firstDoorLight, false);

            // Room 3
            engineer_reactorObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_reactorobjectivesensor")).GetComponent <MotionSensor>();
            tutorial_oxygenGenerator        = Item.ItemList.Find(i => i.HasTag("tutorial_oxygengenerator")).GetComponent <OxygenGenerator>();
            engineer_reactor                     = Item.ItemList.Find(i => i.HasTag("engineer_reactor")).GetComponent <Reactor>();
            engineer_reactor.FireDelay           = engineer_reactor.MeltdownDelay = float.PositiveInfinity;
            engineer_reactor.FuelConsumptionRate = 0.0f;
            engineer_reactor.PowerOn             = true;
            reactorOperatedProperly              = false;

            engineer_secondDoor      = Item.ItemList.Find(i => i.HasTag("engineer_seconddoor")).GetComponent <Door>();;
            engineer_secondDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_seconddoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(engineer_secondDoor, engineer_secondDoorLight, false);

            // Room 4
            engineer_repairJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_repairjunctionboxobjectivesensor")).GetComponent <MotionSensor>();
            engineer_brokenJunctionBox = Item.ItemList.Find(i => i.HasTag("engineer_brokenjunctionbox"));
            engineer_thirdDoor         = Item.ItemList.Find(i => i.HasTag("engineer_thirddoor")).GetComponent <Door>();
            engineer_thirdDoorLight    = Item.ItemList.Find(i => i.HasTag("engineer_thirddoorlight")).GetComponent <LightComponent>();

            engineer_brokenJunctionBox.Indestructible = false;
            engineer_brokenJunctionBox.Condition      = 0f;

            SetDoorAccess(engineer_thirdDoor, engineer_thirdDoorLight, false);

            // Room 5
            engineer_disconnectedJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_disconnectedjunctionboxobjectivesensor")).GetComponent <MotionSensor>();

            engineer_disconnectedJunctionBoxes    = new PowerTransfer[4];
            engineer_disconnectedConnectionPanels = new ConnectionPanel[4];

            for (int i = 0; i < engineer_disconnectedJunctionBoxes.Length; i++)
            {
                engineer_disconnectedJunctionBoxes[i]           = Item.ItemList.Find(item => item.HasTag($"engineer_disconnectedjunctionbox_{i + 1}")).GetComponent <PowerTransfer>();
                engineer_disconnectedConnectionPanels[i]        = engineer_disconnectedJunctionBoxes[i].Item.GetComponent <ConnectionPanel>();
                engineer_disconnectedConnectionPanels[i].Locked = false;

                for (int j = 0; j < engineer_disconnectedJunctionBoxes[i].PowerConnections.Count; j++)
                {
                    foreach (Wire wire in engineer_disconnectedJunctionBoxes[i].PowerConnections[j].Wires)
                    {
                        if (wire == null)
                        {
                            continue;
                        }
                        wire.Locked = true;
                    }
                }
            }

            engineer_wire_1             = Item.ItemList.Find(i => i.HasTag("engineer_wire_1"));
            engineer_wire_1.SpriteColor = Color.Transparent;
            engineer_wire_2             = Item.ItemList.Find(i => i.HasTag("engineer_wire_2"));
            engineer_wire_2.SpriteColor = Color.Transparent;
            engineer_lamp_1             = Item.ItemList.Find(i => i.HasTag("engineer_lamp_1")).GetComponent <Powered>();
            engineer_lamp_2             = Item.ItemList.Find(i => i.HasTag("engineer_lamp_2")).GetComponent <Powered>();
            engineer_fourthDoor         = Item.ItemList.Find(i => i.HasTag("engineer_fourthdoor")).GetComponent <Door>();
            engineer_fourthDoorLight    = Item.ItemList.Find(i => i.HasTag("engineer_fourthdoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(engineer_fourthDoor, engineer_fourthDoorLight, false);

            // Room 6
            engineer_workingPump = Item.ItemList.Find(i => i.HasTag("engineer_workingpump")).GetComponent <Pump>();
            engineer_workingPump.Item.CurrentHull.WaterVolume += engineer_workingPump.Item.CurrentHull.Volume;
            engineer_workingPump.IsActive = true;
            tutorial_lockedDoor_1         = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_1")).GetComponent <Door>();
            SetDoorAccess(tutorial_lockedDoor_1, null, true);

            // Submarine
            tutorial_submarineDoor      = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, true);

            tutorial_enteredSubmarineSensor    = Item.ItemList.Find(i => i.HasTag("tutorial_enteredsubmarinesensor")).GetComponent <MotionSensor>();
            engineer_submarineJunctionBox_1    = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_1"));
            engineer_submarineJunctionBox_2    = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_2"));
            engineer_submarineJunctionBox_3    = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_3"));
            engineer_submarineReactor          = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent <Reactor>();
            engineer_submarineReactor.PowerOn  = true;
            engineer_submarineReactor.IsActive = engineer_submarineReactor.AutoTemp = false;

            engineer_submarineJunctionBox_1.Indestructible = false;
            engineer_submarineJunctionBox_1.Condition      = 0f;
            engineer_submarineJunctionBox_2.Indestructible = false;
            engineer_submarineJunctionBox_2.Condition      = 0f;
            engineer_submarineJunctionBox_3.Indestructible = false;
            engineer_submarineJunctionBox_3.Condition      = 0f;
        }
 public static void UpdateUnityLightParameters(this LightComponent Light, Light UnityLight, in ELightType LightType)
Esempio n. 17
0
        public override LightShadowMapTexture CreateShadowMapTexture(RenderView renderView, LightComponent lightComponent, IDirectLight light, int shadowMapSize)
        {
            var shadowMap = shadowMaps.Add();

            shadowMap.Initialize(renderView, lightComponent, light, light.Shadow, shadowMapSize, this);
            shadowMap.CascadeCount = 2; // 2 faces
            return(shadowMap);
        }
        public override void Start()
        {
            base.Start();

            radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
            doctor           = Character.Controlled;

            doctor_suppliesCabinet = Item.ItemList.Find(i => i.HasTag("doctor_suppliescabinet"))?.GetComponent <ItemContainer>();
            doctor_medBayCabinet   = Item.ItemList.Find(i => i.HasTag("doctor_medbaycabinet"))?.GetComponent <ItemContainer>();

            var patientHull1 = Hull.hullList.Find(h => h.RoomName == "Waiting room" && h.Submarine == doctor.Submarine);
            var patientHull2 = Hull.hullList.Find(h => h.RoomName == "Airlock" && h.Submarine == doctor.Submarine);

            medBay = Hull.hullList.Find(h => h.RoomName == "Med bay" && h.Submarine == doctor.Submarine);

            var assistantInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "assistant"));

            patient1 = Character.Create(assistantInfo, patientHull1.WorldPosition, "1");
            patient1.GiveJobItems(null);
            patient1.CanSpeak = false;
            patient1.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.Burn, 45.0f)
            }, stun: 0, playSound: false);
            patient1.AIController.Enabled = false;

            assistantInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "assistant"));
            patient2      = Character.Create(assistantInfo, patientHull2.WorldPosition, "2");
            patient2.GiveJobItems(null);
            patient2.CanSpeak             = false;
            patient2.AIController.Enabled = false;

            var mechanicInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer"));
            var subPatient1  = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job, Submarine.MainSub).WorldPosition, "3");

            subPatient1.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.Burn, 40.0f)
            }, stun: 0, playSound: false);
            subPatients.Add(subPatient1);

            var securityInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "securityofficer"));
            var subPatient2  = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job, Submarine.MainSub).WorldPosition, "3");

            subPatient2.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.InternalDamage, 40.0f)
            }, stun: 0, playSound: false);
            subPatients.Add(subPatient2);

            var engineerInfo = new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer"));
            var subPatient3  = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job, Submarine.MainSub).WorldPosition, "3");

            subPatient3.AddDamage(patient1.WorldPosition, new List <Affliction>()
            {
                new Affliction(AfflictionPrefab.Burn, 20.0f)
            }, stun: 0, playSound: false);
            subPatients.Add(subPatient3);

            doctor_firstDoor        = Item.ItemList.Find(i => i.HasTag("doctor_firstdoor")).GetComponent <Door>();
            doctor_secondDoor       = Item.ItemList.Find(i => i.HasTag("doctor_seconddoor")).GetComponent <Door>();
            doctor_thirdDoor        = Item.ItemList.Find(i => i.HasTag("doctor_thirddoor")).GetComponent <Door>();
            tutorial_upperFinalDoor = Item.ItemList.Find(i => i.HasTag("tutorial_upperfinaldoor")).GetComponent <Door>();
            doctor_firstDoorLight   = Item.ItemList.Find(i => i.HasTag("doctor_firstdoorlight")).GetComponent <LightComponent>();
            doctor_secondDoorLight  = Item.ItemList.Find(i => i.HasTag("doctor_seconddoorlight")).GetComponent <LightComponent>();
            doctor_thirdDoorLight   = Item.ItemList.Find(i => i.HasTag("doctor_thirddoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(doctor_firstDoor, doctor_firstDoorLight, false);
            SetDoorAccess(doctor_secondDoor, doctor_secondDoorLight, false);
            SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, false);
            tutorial_submarineDoor      = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false);
            tutorial_lockedDoor_2 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_2")).GetComponent <Door>();
            SetDoorAccess(tutorial_lockedDoor_2, null, true);


            foreach (var patient in subPatients)
            {
                patient.CanSpeak             = false;
                patient.AIController.Enabled = false;
                patient.GiveJobItems();
            }

            Item reactorItem = Item.ItemList.Find(i => i.Submarine == Submarine.MainSub && i.GetComponent <Reactor>() != null);

            reactorItem.GetComponent <Reactor>().AutoTemp = true;
        }
Esempio n. 19
0
 public LightComponentKey(LightComponent lightComponent, RenderView renderView)
 {
     LightComponent = lightComponent;
     RenderView     = renderView;
 }
Esempio n. 20
0
 public abstract bool Update(LightComponent lightComponent);
Esempio n. 21
0
 public override bool Update(LightComponent lightComponent)
 {
     return(true);
 }