예제 #1
0
        public void ApplyTo(Light light)
        {
            if (original == null)
            {
                original = new ArenaModLight();
                original.GetFrom(light);
            }

            if (modThis)
            {
                //Debug.Log($"[Modding] setting light active: {isActive}");
                light.gameObject.SetActive(isActive);
                light.enabled = isActive;
                if (isActive)
                {
                    Transform t = light.transform;
                    t.localPosition = position;
                    t.localRotation = Quaternion.Euler(rotation);

                    light.type      = type;
                    light.range     = range;
                    light.spotAngle = spotAngle;
                    light.color     = color;
                    light.intensity = intensity;
                    light.shadows   = shadows;

                    GameStateLight gameStateLight = light.GetComponent <GameStateLight>();
                    if (dependentOnGameState)
                    {
                        if (gameStateLight == null)
                        {
                            Debug.LogWarning($"Light '{light.name}' cannot depend on Game State; ignored!");
                            return;
                        }

                        gameStateLight.enabled          = true;
                        gameStateLight.intensityWaiting = intensityWaiting;
                        gameStateLight.intensityPlaying = intensityPlaying;
                    }
                    else
                    {
                        if (gameStateLight != null)
                        {
                            gameStateLight.enabled = false;
                        }
                    }
                }
            }
        }
예제 #2
0
        public void GetFrom(List <ModdableGameObject> gos, List <Light> lights)
        {
            skybox.GetFrom();

            moddableGameObjects.Clear();
            foreach (ModdableGameObject go in gos)
            {
                ArenaModGameObject goMod = new ArenaModGameObject();
                moddableGameObjects.Add(goMod);
                goMod.GetFrom(go);
            }

            moddableLights.Clear();
            foreach (Light light in lights)
            {
                ArenaModLight lightMod = new ArenaModLight();
                moddableLights.Add(lightMod);
                lightMod.GetFrom(light);
            }
        }