public async Task DeleteLightScene_Ok()
        {
            var hueLightProvider     = Substitute.For <IHueLightProvider>();
            var lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            var lightScene           = new LightScene()
            {
                Id   = 5,
                Name = "Test",
                Data = "abc"
            };

            lightSceneRepository.GetAsync(Arg.Is <int>(5)).Returns(lightScene);
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.DeleteLightScene(5);

            await lightSceneRepository.Received(1).RemoveAsync(Arg.Is <LightScene>(x => x.Id.Equals(5) && x.Name.Equals("Test") && x.Data.Equals("abc")));

            var okResult = Assert.IsType <OkObjectResult>(result.Result);
            var scene    = Assert.IsType <LightScene>(okResult.Value);

            Assert.Equal(5, scene.Id);
            Assert.Equal("Test", scene.Name);
            Assert.Equal("abc", scene.Data);
        }
        public async Task GetLight_Found()
        {
            var   hueLightProvider = Substitute.For <IHueLightProvider>();
            Light light            = new Light()
            {
                Id    = 5,
                Name  = "Light No. 5",
                Type  = LightType.HueDimmableLight,
                State = new LightState()
                {
                    On               = true,
                    Brightness       = 100,
                    ColorTemperature = 10,
                    Saturation       = 50,
                    Reachable        = true,
                }
            };

            hueLightProvider.GetLightByIdAsync(Arg.Any <int>()).Returns(Task.FromResult(light));
            var controller = new LightingController(hueLightProvider, null);

            var result = await controller.GetLight(5);

            var okResult    = Assert.IsType <OkObjectResult>(result.Result);
            var lightResult = Assert.IsType <Light>(okResult.Value);

            Assert.Equal(5, lightResult.Id);
        }
        public async Task GetAllLights_ListValid()
        {
            var          hueLightProvider = Substitute.For <IHueLightProvider>();
            List <Light> list             = new List <Light>()
            {
                new Light()
                {
                    Id    = 5,
                    Name  = "Light No. 5",
                    Type  = LightType.HueDimmableLight,
                    State = new LightState()
                    {
                        On               = true,
                        Brightness       = 100,
                        ColorTemperature = 10,
                        Saturation       = 50,
                        Reachable        = true,
                    }
                }
            };

            hueLightProvider.GetAllLightsAsync().Returns(Task.FromResult(list));
            var controller = new LightingController(hueLightProvider, null);

            var result = await controller.GetAllLights();

            var okResult = Assert.IsType <OkObjectResult>(result.Result);
            var lights   = Assert.IsType <List <Light> >(okResult.Value);

            Assert.Equal(list, lights);
        }
Beispiel #4
0
 public void ResetLight()
 {
     foreach (Transform tile in tiles)
     {
         LightingController lightcontroller = tile.GetComponent <LightingController>();
         lightcontroller.ResetLight();
     }
 }
        public async Task UpdateLightScene_BadRequest_SceneNull()
        {
            var        hueLightProvider     = Substitute.For <IHueLightProvider>();
            var        lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            LightScene lightScene           = null;
            var        controller           = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.UpdateLightScene(5, lightScene);

            Assert.IsType <BadRequestResult>(result.Result);
        }
Beispiel #6
0
        public void process()
        {
            Clog("Processing...");
            RGBColor priColor = new RGBColor(255, 255, 255);
            RGBColor secColor = new RGBColor(0, 0, 255);

            // if (req.SECONDARY != null) { priColor = new RGBColor(req.SECONDARY); } else { priColor = null; };
            // if (req.TERTIARY != null) { secColor = new RGBColor(req.TERTIARY); } else { secColor = null; };
            LightingController.StartLightingThread();
            LightingController.LightingProcess(priColor, secColor, effect);
        }
        public async Task GetAllLights_ListEmpty()
        {
            var          hueLightProvider = Substitute.For <IHueLightProvider>();
            List <Light> list             = new List <Light>();

            hueLightProvider.GetAllLightsAsync().Returns(Task.FromResult(list));
            var controller = new LightingController(hueLightProvider, null);

            var result = await controller.GetAllLights();

            Assert.IsType <NoContentResult>(result.Result);
        }
        public async Task GetLight_NotFound()
        {
            var   hueLightProvider = Substitute.For <IHueLightProvider>();
            Light light            = null;

            hueLightProvider.GetLightByIdAsync(Arg.Any <int>()).Returns(Task.FromResult(light));
            var controller = new LightingController(hueLightProvider, null);

            var result = await controller.GetLight(5);

            Assert.IsType <NotFoundResult>(result.Result);
        }
        public async Task ApplyLightScene_SceneNotFound()
        {
            var        hueLightProvider     = Substitute.For <IHueLightProvider>();
            var        lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            LightScene lightScene           = null;

            lightSceneRepository.GetAsync(Arg.Is <int>(5)).Returns(lightScene);
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.ApplyLightScene(5);

            Assert.IsType <NotFoundResult>(result);
        }
        public async Task GetLightScene_NotFound()
        {
            var        hueLightProvider     = Substitute.For <IHueLightProvider>();
            var        lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            LightScene lightScene           = null;

            lightSceneRepository.GetAsync(5).Returns(Task.FromResult(lightScene));
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.GetLightScene(2);

            Assert.IsType <NotFoundResult>(result.Result);
        }
    public void Awake()
    {
        eventDispatcher       = Service.Get <EventDispatcher>();
        dataEntityCollection  = Service.Get <CPDataEntityCollection>();
        sceneDataEntityHandle = dataEntityCollection.FindEntityByName("ActiveSceneData");
        lightingController    = base.gameObject.AddComponent <LightingController>();
        IGameData gameData = Service.Get <IGameData>();

        lightingDefs   = gameData.Get <Dictionary <int, LightingDefinition> >();
        musicDefs      = gameData.Get <Dictionary <int, MusicTrackDefinition> >();
        decorationDefs = gameData.Get <Dictionary <int, DecorationDefinition> >();
        structureDefs  = gameData.Get <Dictionary <int, StructureDefinition> >();
        eventDispatcher.AddListener <SceneTransitionEvents.SceneSwapLoadStarted>(onSceneSwapLoadStarted);
    }
        public async Task UpdateLightScene_BadRequest_InvalidId()
        {
            var        hueLightProvider     = Substitute.For <IHueLightProvider>();
            var        lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            LightScene lightScene           = new LightScene()
            {
                Id   = 5,
                Name = "Test",
                Data = "abc"
            };
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.UpdateLightScene(7, lightScene);

            Assert.IsType <BadRequestResult>(result.Result);
        }
Beispiel #13
0
        public MainView(RenderSystem rs,ModelViewDoc doc)
            : base("ModelMainView",rs)
        {
            m_camera.Position = new Vector3F(0, -5, 3);
            m_camera.Direction = new Vector3F(0, 0, 2);
            m_camera.Focus = true;
            Camera3DController camera_contrlooer = new Camera3DController("cam");
            camera_contrlooer.MoveSpeed = 1.0f;
            camera_contrlooer.WheelSpeed = 0.01f;
            BaseController = camera_contrlooer;

            mLightCtrl = new LightingController(doc);

            BaseController.OnKeyPressing += _onViewKeyPressing;
            BaseController.OnKeyUp += _onViewKeyUp;

            mDoc = doc;
        }
        public static void RegisterRendererInLightingController(GameObject containController, GameObject containRenderer)
        {
            LightingController lightingController = containController.GetComponent <LightingController>();

            if (lightingController == null)
            {
                throw new ArgumentException("GameObject does not have LightingController component!");
            }

            Renderer renderer = containRenderer.GetComponent <Renderer>();

            if (renderer == null)
            {
                throw new ArgumentException($"GameObject [{containRenderer.name}] does not have Renderer component!");
            }

            lightingController.emissiveController.RegisterRenderer(renderer);
        }
Beispiel #15
0
    public void LightUpdate(bool reset = true)
    {
        List <LightEmitter> emitters = new List <LightEmitter>();

        foreach (Transform tile in tiles)
        {
            LightingController lightcontroller = tile.GetComponent <LightingController>();
            if (reset)
            {
                lightcontroller.ResetLight();
            }
            if (lightcontroller.lightemitlevel != 0)
            {
                LightEmitter emitter = new LightEmitter();
                emitter.intensity = lightcontroller.lightemitlevel;
                emitter.x         = tile.GetComponent <BlockController>().x;
                emitter.y         = tile.GetComponent <BlockController>().y;
                emitters.Add(emitter);
            }
        }
        for (int x = 0; x < xLength; x++)         // For every x co-ord
        {
            for (int y = yLength - 1; y > 0; y--) // Iterate from top to bottom
            {
                if (map[x, y] != 0)               // When you find a non-air block
                {
                    if (y < map.GetLength(1))
                    {
                        tiles[x, y + 1].GetComponent <LightingController>().PropagateLight(20, 0); // Light the air block above it
                    }
                    if (!tilelist.transparentIDs.Contains(map[x, y]))                              // If not a transparent block
                    {
                        y = 0;                                                                     // End the loop
                    }
                }
            }
        }
        foreach (LightEmitter emitter in emitters)
        {
            tiles[emitter.x, emitter.y].GetComponent <LightingController>().PropagateLight(emitter.intensity, 0);
        }
    }
        public async Task SetLightState_NoSuccess()
        {
            var hueLightProvider = Substitute.For <IHueLightProvider>();
            var lightStateUpdate = new LightStateUpdate()
            {
                On               = true,
                Brightness       = 28,
                Saturation       = 190,
                Hue              = 8000,
                ColorTemperature = 103
            };
            bool success = false;

            hueLightProvider.SetLightStateAsync(Arg.Any <int>(), Arg.Any <LightStateUpdate>()).Returns(Task.FromResult(success));
            var controller = new LightingController(hueLightProvider, null);

            var result = await controller.SetLightState(5, lightStateUpdate);

            var notFoundResult = result as NotFoundResult;

            Assert.NotNull(notFoundResult);
        }
        public async Task AddLightScene_Created()
        {
            var hueLightProvider     = Substitute.For <IHueLightProvider>();
            var lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            var newLightScene        = new LightScene()
            {
                Id   = 5,
                Name = "Test",
                Data = "abc"
            };
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.AddLightScene(newLightScene);

            await lightSceneRepository.Received(1).AddAsync(Arg.Is <LightScene>(x => x.Id.Equals(0) && x.Name.Equals("Test") && x.Data.Equals("abc")));

            var createdResult = Assert.IsType <CreatedAtActionResult>(result.Result);
            var scene         = Assert.IsType <LightScene>(createdResult.Value);

            Assert.Equal("Test", scene.Name);
            Assert.Equal("abc", scene.Data);
        }
        public async Task ApplyLightScene_NotSuccessful()
        {
            var hueLightProvider = Substitute.For <IHueLightProvider>();

            hueLightProvider.ApplyLightSceneAsync(Arg.Any <LightScene>()).Returns(false);
            var        lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            LightScene lightScene           = new LightScene()
            {
                Id   = 5,
                Name = "Test",
                Data = "abc"
            };

            lightSceneRepository.GetAsync(Arg.Is <int>(5)).Returns(lightScene);
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.ApplyLightScene(5);

            await hueLightProvider.Received(1).ApplyLightSceneAsync(Arg.Is <LightScene>(x => x.Id.Equals(5) && x.Name.Equals("Test") && x.Data.Equals("abc")));

            Assert.IsType <NotFoundResult>(result);
        }
        public async Task GetLightScene_Ok()
        {
            var hueLightProvider     = Substitute.For <IHueLightProvider>();
            var lightSceneRepository = Substitute.For <IAsyncRepository <LightScene> >();
            var lightScene           = new LightScene()
            {
                Id   = 5,
                Name = "Test",
                Data = "abc"
            };

            lightSceneRepository.GetAsync(5).Returns(Task.FromResult(lightScene));
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.GetLightScene(5);

            var okResult = Assert.IsType <OkObjectResult>(result.Result);
            var scene    = Assert.IsType <LightScene>(okResult.Value);

            Assert.Equal(5, scene.Id);
            Assert.Equal("Test", scene.Name);
            Assert.Equal("abc", scene.Data);
        }
        public async Task GetLightScenes_Ok()
        {
            var hueLightProvider                 = Substitute.For <IHueLightProvider>();
            var lightSceneRepository             = Substitute.For <IAsyncRepository <LightScene> >();
            IEnumerable <LightScene> lightScenes = new List <LightScene>()
            {
                new LightScene()
                {
                    Id   = 5,
                    Name = "Test",
                    Data = "abc"
                }
            };

            lightSceneRepository.GetAllAsync().Returns(Task.FromResult(lightScenes));
            var controller = new LightingController(hueLightProvider, lightSceneRepository);

            var result = await controller.GetLightScenes();

            var okResult = Assert.IsType <OkObjectResult>(result.Result);
            var scenes   = Assert.IsType <List <LightScene> >(okResult.Value);

            Assert.Equal(lightScenes, scenes);
        }
 static void Prefix(LightingController __instance)
 {
     __instance.fadeDuration = SubRootSettings.lightFadeDuration;
 }
Beispiel #22
0
        public Machine()
        {
            mals_ctr     = new MALSController();
            lighting_ctr = new LightingController();
            listest      = new Test();

            if (listest.ABC == null)
            {
                listest.ABC = new List <string>();

                listest.ABC.Add("qkrwoghd");
                listest.ABC.Add("nihao");

                //for (int i = 0; i < 2; i++)
                //{
                //    Console.WriteLine("{0}", listest.ABC[i]);
                //}
                //foreach(var testlist in listest.ABC)
                //{
                //    Console.WriteLine("{0}", listest.ABC.ToArray());
                //}
            }



            if (listest.Array_test == null)
            {
                listest.Array_test = new string[3] {
                    "dfa", "asdf", "feww"
                };
                //for (int i = 0; i < 3; i++)
                //{
                //    Console.WriteLine("{0}", listest.Array_test[i]);
                //}
            }



            //if (listest.IntStack == null)
            //{
            //    listest.IntStack = new Stack<int>();
            //    listest.IntStack.Push(1);
            //    listest.IntStack.Push(2);

            //    foreach (var testStack in listest.IntStack)
            //    {
            //        Console.WriteLine("{0}", testStack);
            //    }
            //}

            //if (listest.Dictionary == null)
            //{
            //    listest.Dictionary = new Dictionary<string, int>()
            //{
            //    {"Hi", 1},
            //    {"bye",2}
            //};
            //    foreach (var testDictionary in listest.Dictionary)
            //    {
            //        Console.WriteLine("{0},{1}", testDictionary.Key, testDictionary.Value);
            //    }
            //}


            //if (listest.Queue_test == null)
            //{
            //    listest.Queue_test.ToList<string>();
            //}

            if (listest.Qtolist == null)
            {
                Queue <string> q = new Queue <string>();
                q.Enqueue("dTKFKFFKFKFK");
                q.Enqueue("diododododododododo");

                List <string> list = new List <string>(q);
                listest.Qtolist = list;
            }

            //if(listest.Qint == null)
            //{
            //    Queue<int> q = new Queue<int>();
            //    q.Enqueue(1);
            //    q.Enqueue(2);

            //    listest.Qint = q;
            //}
        }
Beispiel #23
0
        public static void LoadLights()
        {
            bool laserNull = false;
            bool ringNull  = false;

            Plugin.Log.Info("Loading lights...");

            try
            {
                lasers     = GameObject.Find("MultiplayerLocalActivePlayerController(Clone)/IsActiveObjects/Lasers");
                ringLights = GameObject.Find("MultiplayerLocalActivePlayerController(Clone)/IsActiveObjects/DirectionalLights");

                // Load the lasers
                if (lasers != null)
                {
                    laserLeft        = lasers.transform.Find("LaserL").gameObject.GetComponent <TubeBloomPrePassLight>();
                    laserRight       = lasers.transform.Find("LaserR").gameObject.GetComponent <TubeBloomPrePassLight>();
                    backLaserLeft    = lasers.transform.Find("LaserFrontL").gameObject.GetComponent <TubeBloomPrePassLight>();
                    backLaserRight   = lasers.transform.Find("LaserFrontR").gameObject.GetComponent <TubeBloomPrePassLight>();
                    behindLaserLeft  = lasers.transform.Find("LaserBackL").gameObject.GetComponent <TubeBloomPrePassLight>();
                    behindLaserRight = lasers.transform.Find("LaserBackR").gameObject.GetComponent <TubeBloomPrePassLight>();
                    farLaserLeft     = lasers.transform.Find("LaserFarL").gameObject.GetComponent <TubeBloomPrePassLight>();
                    farLaserRight    = lasers.transform.Find("LaserFarR").gameObject.GetComponent <TubeBloomPrePassLight>();
                    allLasers        = new List <TubeBloomPrePassLight>()
                    {
                        laserLeft, laserRight, backLaserLeft, backLaserRight, behindLaserLeft, behindLaserRight, farLaserLeft, farLaserRight
                    };

                    foreach (TubeBloomPrePassLight l in allLasers)
                    {
                        LightingController.HandleLightEvent(l, new LightArrangement()
                        {
                            enabled = false, color = null
                        });
                    }
                    playerLaserErr = false;
                }
                else
                {
                    Plugin.Log.Error("Lasers are disabled.");
                    playerLaserErr = true;
                }

                // Loaded the other player's lasers
                connectedPlayerLighting = new List <ConnectedPlayerLighting>();
                var players = Resources.FindObjectsOfTypeAll <GameObject>().Where(obj => obj.name == "MultiplayerConnectedPlayerController(Clone)");
                if (players != null)
                {
                    foreach (GameObject o in players)
                    {
                        ConnectedPlayerLighting l = new ConnectedPlayerLighting();
                        GameObject _lasers        = o.transform.Find("Lasers").gameObject;
                        l.laserLeft          = _lasers.transform.Find("SideLaserL").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.laserRight         = _lasers.transform.Find("SideLaserR").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.laserFront         = _lasers.transform.Find("FrontLaserC2").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.downLaserLeft      = _lasers.transform.Find("FrontLaserL").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.downLaserRight     = _lasers.transform.Find("FrontLaserR").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.downLaserConnector = _lasers.transform.Find("FrontLaserC").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.extendedLaserLeft  = _lasers.transform.Find("ThinLaserL").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.extendedLaserRight = _lasers.transform.Find("ThinLaserR").gameObject.GetComponent <TubeBloomPrePassLight>();
                        l.AddAllToList();

                        allLasers.AddRange(l.allLasers);
                        connectedPlayerLighting.Add(l);
                        Plugin.Log.Info("Loaded a Connected Player's lights");
                    }
                }

                cpOffColour = GetCSO(new Color(0, 0, 0));
                LightingController.HandleGlobalCPLightEvent(new LightArrangement()
                {
                    enabled = false, color = cpOffColour
                });

                // Load the ring lights
                if (ringLights != null)
                {
                    ringLightBehind = ringLights.transform.Find("DirectionalLight1").gameObject.GetComponent <DirectionalLight>();
                    ringLightFront  = ringLights.transform.Find("DirectionalLight2").gameObject.GetComponent <DirectionalLight>();
                    ringLightLeft   = ringLights.transform.Find("DirectionalLight4").gameObject.GetComponent <DirectionalLight>();
                    ringLightRight  = ringLights.transform.Find("DirectionalLight3").gameObject.GetComponent <DirectionalLight>();
                    allRings        = new List <DirectionalLight>()
                    {
                        ringLightBehind, ringLightFront, ringLightLeft, ringLightRight
                    };

                    foreach (DirectionalLight l in allRings)
                    {
                        LightingController.HandleLightEvent(l, new LightArrangement()
                        {
                            enabled = false, color = null
                        });
                    }
                    ringErr = false;
                }
                else
                {
                    Plugin.Log.Error("Ring Lights are disabled.");
                    ringErr = true;
                }

                Plugin.Log.Info("Lasers: " + (laserNull == true || lasers == null ? "error" : "working"));
                Plugin.Log.Info("Ring Lights: " + (ringNull == true || ringLights == null ? "error" : "working"));
                Plugin.Log.Info("CP Lights: " + (connectedPlayerLighting.Count == 0 ? "none found" : "working (" + connectedPlayerLighting.Count + ")"));

                if (ringErr && playerLaserErr)
                {
                    loadError = true;
                    Plugin.Log.Critical("Both rings and lasers failed to load. Lighting has been disabled.");
                }
                else
                {
                    loadedLights = true;
                }
            } catch (Exception e)
            {
                Plugin.Log.Critical("Error loading lights: " + e.Message);
                loadError = true;
            }
        }
Beispiel #24
0
 void OnEnable()
 {
     instance = this;
 }
 void OnEnable()
 {
     instance = this;
 }
        private void SetupPowerSystem()
        {
            powerSystem.name = "powerSystem";
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <BatteryCharger>());
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <PrefabIdentifier>());
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <TechTag>());
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <Constructable>());
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <FMOD_StudioEventEmitter>());
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <ConstructableBounds>());
            UnityEngine.Object.DestroyImmediate(powerSystem.GetComponent <PowerConsumer>());
            UnityEngine.Object.DestroyImmediate(powerSystem.transform.Find("Collider").gameObject);

            GameObject EquipmentRoot = powerSystem.transform.Find("EquipmentRoot").gameObject;

            EquipmentRoot.transform.SetParent(GameObjectClone.transform, false);

            Transform model = powerSystem.transform.Find("model");

            UnityEngine.Object.DestroyImmediate(model.GetComponent <Animator>());
            UnityEngine.Object.DestroyImmediate(model.GetComponent <BaseModuleLighting>());

            GameObject cover = model.Find("battery_charging_station_base/battery_charging_station_cover").gameObject;

            cover.transform.SetParent(model, false);

            UnityEngine.Object.DestroyImmediate(model.Find("battery_charging_station_base").gameObject);

            SkyApplier skyApplier = model.gameObject.GetComponent <SkyApplier>();

            LightingController controller = GameObjectClone.GetComponent <LightingController>();

            controller.RegisterSkyApplier(skyApplier);

            GameObject UI = powerSystem.transform.Find("UI").gameObject;

            UI.transform.localPosition = new Vector3(0f, 0f, 0.28f);
            UI.transform.localRotation = Quaternion.Euler(0, 0, 180);

            GameObject backgroundLeft = UI.transform.transform.Find("Background").gameObject;

            backgroundLeft.name = "backgroundLeft";

            RectTransform leftRt = backgroundLeft.transform as RectTransform;

            leftRt.anchoredPosition = new Vector2(-495f, 0f);
            leftRt.localScale       = new Vector3(0.70f, 0.70f, 0.1f);

            GameObject backgroundRight = UWE.Utils.Instantiate(backgroundLeft, UI.transform, Vector3.zero, Quaternion.identity);

            backgroundRight.name = "backgroundRight";

            RectTransform rightRt = backgroundRight.transform as RectTransform;

            rightRt.anchoredPosition = new Vector2(500f, 0f);
            rightRt.localScale       = new Vector3(0.70f, 0.70f, 0.1f);
            rightRt.SetSiblingIndex(0);

            RawImage imageLeft  = backgroundLeft.GetComponent <RawImage>();
            RawImage imageRight = backgroundRight.GetComponent <RawImage>();

            imageLeft.texture  = powerUI_background;
            imageRight.texture = powerUI_background;

            Transform Powered = UI.transform.Find("Powered");

            RectTransform battery1 = Powered.Find("Battery1") as RectTransform;

            battery1.anchoredPosition = new Vector2(-545f, 15f);

            RectTransform battery1_text = battery1.Find("Text") as RectTransform;

            battery1_text.anchoredPosition = new Vector2(0f, 95f);
            battery1_text.localScale       = new Vector3(1.50f, 1.50f, 0.1f);

            RectTransform battery2 = Powered.Find("Battery2") as RectTransform;

            battery2.anchoredPosition = new Vector2(-435f, 15f);

            RectTransform battery2_text = battery2.Find("Text") as RectTransform;

            battery2_text.anchoredPosition = new Vector2(0f, 95f);
            battery2_text.localScale       = new Vector3(1.50f, 1.50f, 0.1f);

            RectTransform battery3 = Powered.Find("Battery3") as RectTransform;

            battery3.anchoredPosition = new Vector2(450f, 15f);

            RectTransform battery3_text = battery3.Find("Text") as RectTransform;

            battery3_text.anchoredPosition = new Vector2(0f, 95f);
            battery3_text.localScale       = new Vector3(1.50f, 1.50f, 0.1f);

            RectTransform battery4 = Powered.Find("Battery4") as RectTransform;

            battery4.anchoredPosition = new Vector2(560f, 15f);

            RectTransform battery4_text = battery4.Find("Text") as RectTransform;

            battery4_text.anchoredPosition = new Vector2(0f, 95f);
            battery4_text.localScale       = new Vector3(1.50f, 1.50f, 0.1f);

            Powered.gameObject.SetActive(true);

            BoxCollider Trigger = powerSystem.transform.Find("Trigger").GetComponent <BoxCollider>();

            Trigger.center = new Vector3(0f, 0f, 0.32f);
            Trigger.size   = new Vector3(0.35f, 0.35f, 0.35f);

            UI.SetActive(true);

            powerSystem.AddComponent <SeaTruckScannerPowerSystem>();

            powerSystem.SetActive(true);
        }
Beispiel #27
0
 public void Start()
 {
     lightingController           = GetComponent <LightingController>();
     mainCamera.OnFinaleFinished += FinishGame;
     lightingController.SetNiceness(0f);
 }