private void OnEnable()
 {
     m_skyController  = GetComponent <AzureSkyController>();
     m_timeController = GetComponent <AzureTimeController>();
     m_skyController.onMinuteChange.AddListener(OnMinuteChange);
     m_skyController.onHourChange.AddListener(OnHourChange);
 }
Exemple #2
0
        private void Update()
        {
            if (_Player == null)
            {
                _Player = ComponentManager <Player> .Value;
            }
            if (_Network_Player == null)
            {
                _Network_Player = ComponentManager <Network_Player> .Value;
            }
            if (_AzureSkyController == null)
            {
                _AzureSkyController = UnityEngine.Object.FindObjectOfType <AzureSkyController>();
            }
            if (_WeatherManager == null)
            {
                _WeatherManager = UnityEngine.Object.FindObjectOfType <WeatherManager>();
            }
            if (_Raft == null)
            {
                _Raft = ComponentManager <Raft> .Value;
            }

            if (Cheat.fixTimeScale)
            {
                Time.timeScale = 0f;
            }
            else
            {
                if (!visible)
                {
                    Time.timeScale = 1f;
                }
            }
            if (UnityEngine.Input.GetKeyDown(KeyCode.F3))
            {
                ModAPI.Log.Write("Flying");
                Cheat.FlyMode = !Cheat.FlyMode;
            }
            // if clicked button
            if (UnityEngine.Input.GetKeyDown(KeyCode.F1))
            {
                ModAPI.Log.Write("Menü");
                if (visible)
                {
                    // menu is closed
                    _Player.SetMouseLookScripts(true);
                    Helper.SetCursorVisibleAndLockState(false, CursorLockMode.Locked);
                    Time.timeScale = 1f;
                }
                else
                {
                    // menu is open
                    _Player.SetMouseLookScripts(false);
                    Helper.SetCursorVisibleAndLockState(true, CursorLockMode.None);
                    Time.timeScale = 0f;
                }
                visible = !visible;
            }
        }
Exemple #3
0
        private void Start()
        {
            m_skyController = GetComponent <AzureSkyController>();

            // Calculates the progression step to move the timeline
            m_timeProgressionStep = GetTimeProgressionStep();
            m_previousMinute      = minute;
            m_previousHour        = hour;
            UpdateTimeSystem();
            UpdateCalendar();
        }
Exemple #4
0
    void Update()
    {
        if (skyController == null)
        {
            skyController = FindObjectOfType <AzureSkyController>();
        }

        if (!battery.BatterySlotIsEmpty && Semih_Network.IsHost)
        {
            if (battery.GetBatteryInstance().Uses < ItemManager.GetItemByName("Battery").MaxUses&& lastRecharge.AddSeconds(secsBetweenRecharges) <= DateTime.Now)
            {
                lastRecharge = DateTime.Now;
                AddBatteryUsesNetworked(1);
                return;
            }
        }
    }
Exemple #5
0
        private void CheckLightState(bool _forceSet)
        {
            if (mi_azureCntrl == null)
            {
                mi_azureCntrl = ComponentManager <AzureSkyController> .Value;
            }

            var isNight = mi_azureCntrl.timeOfDay.hour > Traverse.Create(mi_nlCntrl).Field("nightTimeStart").GetValue <float>() ||
                          mi_azureCntrl.timeOfDay.hour < Traverse.Create(mi_nlCntrl).Field("nightTimeEnd").GetValue <float>();

            if (mi_setLightIntensityInfo != null && mi_nlCntrl != null)
            {
                mi_setLightIntensityInfo.Invoke(mi_nlCntrl, new object[] { IsOn ? 1f : 0f });
            }
            if ((mi_isNight != isNight || _forceSet) && !UserControlsState)
            {
                mi_isNight = isNight;
                SetLightOn(mi_isNight);
            }
        }
 private void Awake()
 {
     azure          = GetComponent <AzureSkyController>();
     currentDetails = environmentProfiles[index];
 }
Exemple #7
0
    // The Update() method is being called every frame. Have fun!
    public void Update()
    {
        DateTime              currentTime = DateTime.UtcNow;
        Network_Player        player      = RAPI.getLocalPlayer();
        Network_Host_Entities nhe         = ComponentManager <Network_Host_Entities> .Value;
        Raft       raft = ComponentManager <Raft> .Value;
        Rigidbody  body = Traverse.Create(raft).Field("body").GetValue() as Rigidbody;
        RewardData reward;

        if (rewardsQueue.TryDequeue(out reward))
        {
            switch (reward.action)
            {
            case "sound":
                system.playSound(sounds[reward.args[0]], channels, false, out newChannel);
                break;

            case "message":
                chat.SendChatMessage(string.Join(" ", reward.args), SteamUser.GetSteamID());
                break;

            case "item":
                Item_Base item   = ItemManager.GetItemByName(reward.args[0]);
                int       amount = 1;
                int.TryParse(reward.args[1], out amount);
                Helper.DropItem(new ItemInstance(item, amount, item.MaxUses), player.transform.position, player.CameraTransform.forward, player.transform.ParentedToRaft());
                break;

            case "inventory_bomb":
                chat.SendChatMessage("Inventory Bomb!", SteamUser.GetSteamID());
                foreach (Slot s in player.Inventory.allSlots)
                {
                    player.Inventory.DropItem(s);
                }
                foreach (Slot s in player.Inventory.equipSlots)
                {
                    player.Inventory.DropItem(s);
                }
                break;

            case "stat_edit":
                //TODO
                //player.PersonController.gravity = 20;
                //player.PersonController.swimSpeed = 2;
                //player.PersonController.normalSpeed = 3;
                //player.PersonController.jumpSpeed = 8;
                //player.Stats.stat_thirst.Value -= 5;
                string action       = reward.args[0];
                string stat         = reward.args[1];
                float  changeAmount = 1;
                float.TryParse(reward.args[2], out changeAmount);
                int duration = 1;
                int.TryParse(reward.args[3], out duration);

                bool contained = false;
                foreach (StatData data in statsEdited)
                {
                    if (data.stat.Equals(stat))
                    {
                        data.duration += duration;
                        contained      = true;
                    }
                }

                if (!contained)
                {
                    StatData data = getStatData(player, stat, action, changeAmount);
                    data.duration    = duration * 1000;
                    data.timeStarted = DateTime.UtcNow;
                    setStatVal(player, stat, data.currentValue);
                    if (duration != -1)
                    {
                        statsEdited.Add(data);
                    }
                }

                break;

            case "move":
                push     = true;
                pushData = new PushData(new Vector3(-4, 0, -4.3f), currentTime, 250);
                break;

            case "spawn_entity":
                Vector3 pos   = player.FeetPosition;
                float   scale = 1;
                if (reward.args.Length > 1)
                {
                    float.TryParse(reward.args[1], out scale);
                }
                int amountFromEntries = 1;
                if (reward.args.Length > 2)
                {
                    int.TryParse(reward.args[2], out amountFromEntries);
                }
                int spawnDuration = 1;
                if (reward.args.Length > 3)
                {
                    int.TryParse(reward.args[3], out spawnDuration);
                }
                TempEntity tempEnt;
                uint       objIndex = SaveAndLoad.GetUniqueObjectIndex();
                for (int index = 0; index < amountFromEntries; ++index)
                {
                    switch (reward.args[0])
                    {
                    case "stone_bird":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.StoneBird, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "puffer_fish":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.PufferFish, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "llama":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Llama, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        (tempEnt.ent as AI_NetworkBehaviour_Domestic).QuickTameLate();
                        break;

                    case "goat":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Goat, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        (tempEnt.ent as AI_NetworkBehaviour_Domestic).QuickTameLate();
                        break;

                    case "chicken":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Chicken, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        (tempEnt.ent as AI_NetworkBehaviour_Domestic).QuickTameLate();
                        break;

                    case "boar":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Boar, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "rat":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Rat, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "shark":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Shark, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "bear":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Bear, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "mama_bear":
                        tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.MamaBear, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null));
                        break;

                    case "seagull":
                        //TODO: It's not like the others for some reason.....
                        tempEnt = null;
                        break;

                    default:
                        tempEnt = null;
                        break;
                    }
                    if (tempEnt != null && spawnDuration != -1)
                    {
                        Semih_Network network = ComponentManager <Semih_Network> .Value;
                        Message_CreateAINetworkBehaviour networkBehaviour2 = new Message_CreateAINetworkBehaviour(Messages.CreateAINetworkBehaviour, network.NetworkIDManager, objIndex, pos, tempEnt.ent, null);
                        if (network == null)
                        {
                            network = ComponentManager <Semih_Network> .Value;
                        }
                        network.RPC(networkBehaviour2, Target.Other, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game);
                        tempEnt.spawned  = DateTime.UtcNow;
                        tempEnt.duration = spawnDuration * 1000;
                        tempEntities.Add(tempEnt);
                    }
                }
                break;

            case "set_weather":
                string weatherName = reward.args[0];
                bool   instant;
                bool.TryParse(reward.args[1], out instant);
                WeatherManager wm      = ComponentManager <WeatherManager> .Value;
                Randomizer     weather = Traverse.Create(ComponentManager <WeatherManager> .Value).Field("weatherConnections").GetValue() as Randomizer;
                Weather        w       = null;
                foreach (Weather we in weather.GetAllItems <Weather>())
                {
                    if (we.name.Equals(weatherName))
                    {
                        w = we;
                    }
                }

                if (w != null)
                {
                    wm.StopAllCoroutines();
                    wm.StartCoroutine(wm.StartNewWeather(w, instant));
                }
                break;

            case "set_time":
                AzureSkyController skyController = ComponentManager <AzureSkyController> .Value;
                int hours = 1;
                int.TryParse(reward.args[0], out hours);
                int minutes = 1;
                int.TryParse(reward.args[1], out minutes);
                skyController.timeOfDay.GotoTime(hours, minutes);
                break;

            case "pickup_trash":
                WaterFloatSemih2[] floatingObjects = FindObjectsOfType <WaterFloatSemih2>();
                float radius = 100;
                float.TryParse(reward.args[0], out radius);
                foreach (WaterFloatSemih2 trash in floatingObjects)
                {
                    try
                    {
                        if (!trash.GetComponent <PickupItem>().isDropped&& Vector3.Distance(trash.transform.position, player.FeetPosition) < radius)
                        {
                            PickupItem_Networked pickup = trash.GetComponentInParent <PickupItem_Networked>();
                            PickupObjectManager.RemovePickupItemNetwork(pickup, SteamUser.GetSteamID());
                        }
                    }
                    catch
                    {
                    }
                }
                break;

            case "command":
                RConsole console = Traverse.Create(typeof(RConsole)).Field("ConsoleInstance").GetValue() as RConsole;
                console.sendCommand(string.Join(" ", reward.args));
                break;

            case "meteor_shower":
                int meteorsToSpawn = 1;
                if (reward.args.Length > 0)
                {
                    int.TryParse(reward.args[0], out meteorsToSpawn);
                }
                int spawnRadius = 1;
                if (reward.args.Length > 1)
                {
                    int.TryParse(reward.args[1], out spawnRadius);
                }
                int meteorDamage = 1;
                if (reward.args.Length > 2)
                {
                    int.TryParse(reward.args[2], out meteorDamage);
                }

                if (stoneDropPrefab == null)
                {
                    AI_NetworkBehaviour_StoneBird ainbsb = (AI_NetworkBehaviour_StoneBird)nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.StoneBird, player.FeetPosition, 0, SaveAndLoad.GetUniqueObjectIndex(), SaveAndLoad.GetUniqueObjectIndex(), null);
                    stoneDropPrefab = Traverse.Create(ainbsb.stateMachineStoneBird.dropStoneState).Field("stoneDropPrefab").GetValue() as StoneDrop;
                    ainbsb.Kill();
                }

                for (int i = 0; i < meteorsToSpawn; i++)
                {
                    Vector3 dropPosition = player.FeetPosition + new Vector3(UnityEngine.Random.Range(-spawnRadius, spawnRadius), 200, UnityEngine.Random.Range(-spawnRadius, spawnRadius));
                    meteors.Add(new Meteor(dropPosition, meteorDamage));
                }
                break;

            case "push_raft":
                float pushForce;
                float.TryParse(reward.args[0], out pushForce);
                body.AddForce(getBoundedRandVector(0.5f, 1) * pushForce, ForceMode.Impulse);
                break;

            case "rotate_raft":
                float rotationForce;
                float.TryParse(reward.args[0], out rotationForce);
                body.AddTorque(new Vector3(0, rotationForce, 0), ForceMode.Impulse);
                break;
            }
        }


        for (int i = statsEdited.Count - 1; i >= 0; i--)
        {
            StatData data = statsEdited[i];
            if ((currentTime - data.timeStarted).TotalMilliseconds > data.duration)
            {
                setStatVal(player, data.stat, data.originalValue);
                statsEdited.RemoveAt(i);
                chat.SendChatMessage(data.stat + " back to normal!", SteamUser.GetSteamID());
            }
        }

        for (int i = tempEntities.Count - 1; i >= 0; i--)
        {
            TempEntity ent = tempEntities[i];
            if ((currentTime - ent.spawned).TotalMilliseconds > ent.duration)
            {
                if (ent.ent != null)
                {
                    Network_Entity entity = ent.ent.networkEntity;
                    entity.Button_Kill();
                    AI_StateMachine stateMachine = ent.ent.GetComponent <AI_StateMachine>();
                    if (stateMachine is AI_StateMachine_Animal)
                    {
                        Traverse.Create((stateMachine as AI_StateMachine_Animal).deadState).Method("RemoveBody").GetValue();
                    }
                }
                tempEntities.RemoveAt(i);
            }
        }

        if (meteors.Count > 0)
        {
            meteorDelay--;
            if (meteorDelay <= 0)
            {
                meteorDelay = meteorDelayTot;
                StoneDrop stone = Instantiate(stoneDropPrefab, meteors.ElementAt(0).pos, Quaternion.identity);
                float     scale = UnityEngine.Random.Range(0.5f, 4f);
                stone.rigidBody.transform.localScale = new Vector3(scale, scale, scale);
                stone.rigidBody.AddForce(Vector3.down * meteors.ElementAt(0).damage, ForceMode.Impulse);
                meteors.RemoveAt(0);
            }
        }

        if (Input.GetKeyDown(KeyCode.Keypad1))
        {
            //Item_Base item = ItemManager.GetItemByName("Watermelon");
            //Helper.DropItem(new ItemInstance(item, 10, item.MaxUses), player.transform.position, player.CameraTransform.forward, player.transform.ParentedToRaft());
        }
        else if (Input.GetKeyDown(KeyCode.Keypad2))
        {
        }

        if (push)
        {
            player.PersonController.controller.SimpleMove(pushData.push);
            if ((currentTime - pushData.startTime).TotalMilliseconds > pushData.duration)
            {
                pushData.left--;
                if (pushData.left == 0)
                {
                    push = false;
                }
                else
                {
                    pushData.startTime = currentTime;
                    pushData.push      = getBoundedRandVector(3, 5);
                }
            }
        }
    }
Exemple #8
0
        protected override void Update()
        {
            Vector3 position = this.playerNetwork.transform.position;

            if (position.y <= -100f)
            {
                AchievementHandler.UnlockAchievement(AchievementType.ach_diveDeep);
            }
            if ((UnityEngine.Object) this.soundManager != (UnityEngine.Object)null)
            {
                SoundManager obj       = this.soundManager;
                Vector3      position2 = this.playerNetwork.transform.position;
                obj.SetOceanPlayerHeight(position2.y);
            }

            bool key  = UnityEngine.Input.GetKey(KeyCode.LeftShift);
            bool key2 = UnityEngine.Input.GetKey(KeyCode.LeftControl);

            if (ModAPI.Input.GetButtonDown("Paint"))
            {
                this.playerInventory.AddItem("PaintBrush", 1);
                this.playerInventory.AddItem("Color_Red", 10000);
                this.playerInventory.AddItem("Color_Yellow", 10000);
                this.playerInventory.AddItem("Color_Blue", 10000);
                this.playerInventory.AddItem("Color_Black", 10000);
                this.playerInventory.AddItem("Color_White", 10000);
                this.playerInventory.AddItem("Scrap", 10000);
                this.playerInventory.AddItem("Rope", 10000);
                this.playerInventory.AddItem("Thatch", 10000);
                this.playerInventory.AddItem("SeaVine", 10000);
                this.playerInventory.AddItem("Stone", 10000);
                this.playerInventory.AddItem("Plastic", 10000);
                this.playerInventory.AddItem("Plank", 10000);
                this.playerInventory.AddItem("MetalIngot", 10000);
                this.playerInventory.AddItem("Nail", 10000);
            }
            if (ModAPI.Input.GetButtonDown("Items"))
            {
                this.playerInventory.AddItem("Hammer", 1);
                this.playerInventory.AddItem("Axe", 1);
                this.playerInventory.AddItem("Hook_Plastic", 1);
                this.playerInventory.AddItem("Seed_Flower_Black", 500);
                this.playerInventory.AddItem("Seed_Flower_White", 500);
                this.playerInventory.AddItem("Seed_Flower_Yellow", 500);
                this.playerInventory.AddItem("Seed_Flower_Blue", 500);
                this.playerInventory.AddItem("Seed_Flower_Red", 500);
                this.playerInventory.AddItem("Raw_Beet", 500);
                this.playerInventory.AddItem("Raw_Potato", 500);
                this.playerInventory.AddItem("Raw_Mackerel", 500);
                this.playerInventory.AddItem("Raw_Shark", 500);
                this.playerInventory.AddItem("Seed_Palm", 500);
            }
            if (ModAPI.Input.GetButtonDown("StatFull"))
            {
                this.playerNetwork.Stats.stat_health.Value += 100f;
                this.playerNetwork.Stats.stat_thirst.Value += 100f;
                this.playerNetwork.Stats.stat_hunger.Value += 100f;
                this.playerNetwork.Stats.stat_oxygen.Value += 100f;
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.Delete))
            {
                this.playerInventory.Clear();
            }

            //AzureSkyController
            AzureSkyController skyController = SingletonGeneric <GameManager> .Singleton.skyController;

            if (ModAPI.Input.GetButtonDown("TimeScale"))
            {
                this.targetTimeScale += 10f;
            }
            else if (ModAPI.Input.GetButtonDown("TimeClear"))
            {
                this.targetTimeScale -= 10f;
            }
            else if (ModAPI.Input.GetButtonDown("CameraPause"))
            {
                if (Time.timeScale > 0f)
                {
                    Time.timeScale = 0f;
                }
                else
                {
                    this.targetTimeScale = 1f;
                    Time.timeScale       = 1f;
                }
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.B))
            {
                float azure_Timeline = skyController.Azure_Timeline;
                azure_Timeline = ((!key) ? (azure_Timeline + 0.1f) : (azure_Timeline + 0.2f));
                if (azure_Timeline >= 24f)
                {
                    azure_Timeline -= 24f;
                }
                skyController.AzureSetTime(azure_Timeline, skyController.Azure_DayCycle);
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.V))
            {
                float azure_Timeline2 = skyController.Azure_Timeline;
                azure_Timeline2 = ((!key) ? (azure_Timeline2 - 0.1f) : (azure_Timeline2 - 0.2f));
                if (azure_Timeline2 <= 0f)
                {
                    azure_Timeline2 += 24f;
                }
                skyController.AzureSetTime(azure_Timeline2, skyController.Azure_DayCycle);
            }
            this.targetTimeScale = Mathf.Clamp(this.targetTimeScale, 1f, 100f);
            if (Time.timeScale != 0f)
            {
                Time.timeScale = Helper.Damp(Time.timeScale, this.targetTimeScale, 0.5f, Time.deltaTime);
            }
            if (ModAPI.Input.GetButtonDown("CursorLock"))
            {
                this.SetMouseLookScripts(!this.mouseLookXScript.enabled);
                Helper.SetCursorVisibleAndLockState(!Cursor.visible, (CursorLockMode)((Cursor.lockState == CursorLockMode.None) ? 1 : 0));
            }
            base.Update();
        }
 private void Start()
 {
     m_skyController  = GetComponent <AzureSkyController>();
     m_timeController = GetComponent <AzureTimeController>();
 }
        private void OnEnable()
        {
            // Get target
            m_target = (AzureSkyController)target;

            // Find the serialized properties
            m_showReferencesHeaderGroup = serializedObject.FindProperty("showReferencesHeaderGroup");
            m_showProfilesHeaderGroup   = serializedObject.FindProperty("showProfilesHeaderGroup");
            m_showEventsHeaderGroup     = serializedObject.FindProperty("showEventsHeaderGroup");
            m_showOptionsHeaderGroup    = serializedObject.FindProperty("showOptionsHeaderGroup");
            m_showOutputsHeaderGroup    = serializedObject.FindProperty("showOutputsHeaderGroup");
            m_sunTransform                 = serializedObject.FindProperty("sunTransform");
            m_moonTransform                = serializedObject.FindProperty("moonTransform");
            m_directionalLight             = serializedObject.FindProperty("directionalLight");
            m_skyMaterial                  = serializedObject.FindProperty("skyMaterial");
            m_fogMaterial                  = serializedObject.FindProperty("fogMaterial");
            m_emptySkyShader               = serializedObject.FindProperty("emptySkyShader");
            m_staticCloudShader            = serializedObject.FindProperty("staticCloudShader");
            m_dynamicCloudShader           = serializedObject.FindProperty("dynamicCloudShader");
            m_defaultProfileList           = serializedObject.FindProperty("defaultProfileList");
            m_globalWeatherList            = serializedObject.FindProperty("globalWeatherList");
            m_weatherZoneList              = serializedObject.FindProperty("weatherZoneList");
            m_defaultWeatherTransitionTime = serializedObject.FindProperty("defaultWeatherTransitionTime");
            m_weatherZoneTrigger           = serializedObject.FindProperty("weatherZoneTrigger");
            m_onMinuteChange               = serializedObject.FindProperty("onMinuteChange");
            m_onHourChange                 = serializedObject.FindProperty("onHourChange");
            m_onDayChange                  = serializedObject.FindProperty("onDayChange");
            m_scatteringMode               = serializedObject.FindProperty("scatteringMode");
            m_cloudMode         = serializedObject.FindProperty("cloudMode");
            m_shaderUpdateMode  = serializedObject.FindProperty("shaderUpdateMode");
            m_dayTransitionTime = serializedObject.FindProperty("dayTransitionTime");
            m_mieDepth          = serializedObject.FindProperty("mieDepth");
            m_outputProfile     = serializedObject.FindProperty("outputProfile");

            // Create default profile list
            m_reorderableDefaultProfileList = new ReorderableList(serializedObject, m_defaultProfileList, true, true, true, true)
            {
                drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    rect.y += 2;
                    Rect fieldRect = new Rect(rect.x + 65, rect.y, rect.width - 65, EditorGUIUtility.singleLineHeight);

                    // Profile index
                    EditorGUI.LabelField(rect, "Profile " + index.ToString());

                    // Object field
                    GUI.color = m_greenColor;
                    if (!m_target.defaultProfileList[index])
                    {
                        GUI.color = m_redColor;
                    }
                    EditorGUI.PropertyField(fieldRect, m_defaultProfileList.GetArrayElementAtIndex(index), GUIContent.none);
                    GUI.color = Color.white;
                },

                onAddCallback = (ReorderableList l) =>
                {
                    var index = l.serializedProperty.arraySize;
                    l.serializedProperty.arraySize++;
                    l.index = index;
                },

                drawHeaderCallback = (Rect rect) =>
                {
                    EditorGUI.LabelField(rect, m_guiContent[5], EditorStyles.boldLabel);
                },

                drawElementBackgroundCallback = (rect, index, active, focused) =>
                {
                    if (active)
                    {
                        GUI.Box(new Rect(rect.x + 2, rect.y, rect.width - 4, rect.height + 1), "", "selectionRect");
                    }
                }
            };

            // Create global weather list
            m_reorderableGlobalWeatherList = new ReorderableList(serializedObject, m_globalWeatherList, true, false, true, true)
            {
                drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    rect.y += 2;
                    Rect fieldRect  = new Rect(rect.x + 65, rect.y, rect.width - 100 - 28, EditorGUIUtility.singleLineHeight);
                    var  element    = m_reorderableGlobalWeatherList.serializedProperty.GetArrayElementAtIndex(index);
                    var  profile    = element.FindPropertyRelative("profile");
                    var  transition = element.FindPropertyRelative("transitionTime");

                    // Profile index
                    EditorGUI.LabelField(rect, "Profile  " + index.ToString());

                    // Object field
                    GUI.color = m_greenColor;
                    if (!m_target.globalWeatherList[index].profile)
                    {
                        GUI.color = m_redColor;
                    }
                    EditorGUI.PropertyField(fieldRect, profile, GUIContent.none);
                    GUI.color = Color.white;

                    // Transition time field
                    fieldRect = new Rect(rect.x + rect.width - 61, rect.y, 28, EditorGUIUtility.singleLineHeight);
                    EditorGUI.PropertyField(fieldRect, transition, GUIContent.none);

                    // Go button
                    fieldRect = new Rect(rect.x + rect.width - 30, rect.y, 30, EditorGUIUtility.singleLineHeight);
                    if (GUI.Button(fieldRect, m_guiContent[6]))
                    {
                        if (Application.isPlaying)
                        {
                            m_target.SetNewWeatherProfile(index);
                        }
                        else
                        {
                            Debug.Log("To perform a weather transition, the application must be playing.");
                        }
                    }
                },

                onAddCallback = (ReorderableList l) =>
                {
                    var index = l.serializedProperty.arraySize;
                    l.serializedProperty.arraySize++;
                    l.index = index;

                    var element = l.serializedProperty.GetArrayElementAtIndex(index);
                    element.FindPropertyRelative("transitionTime").floatValue = 10.0f;
                },

                drawElementBackgroundCallback = (rect, index, active, focused) =>
                {
                    if (active)
                    {
                        GUI.Box(new Rect(rect.x + 2, rect.y, rect.width - 4, rect.height + 1), "", "selectionRect");
                    }
                }
            };

            // Create weather zone list
            m_reorderableWeatherZoneList = new ReorderableList(serializedObject, m_weatherZoneList, true, true, true, true)
            {
                drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    rect.y += 2;
                    Rect fieldRect = new Rect(rect.x + 65, rect.y, rect.width - 65, EditorGUIUtility.singleLineHeight);

                    // Profile index
                    EditorGUI.LabelField(rect, "Priority " + index.ToString());

                    // Object field
                    GUI.color = m_greenColor;
                    if (!m_target.weatherZoneList[index])
                    {
                        GUI.color = m_redColor;
                    }
                    EditorGUI.PropertyField(fieldRect, m_weatherZoneList.GetArrayElementAtIndex(index), GUIContent.none);
                    GUI.color = Color.white;
                },

                onAddCallback = (ReorderableList l) =>
                {
                    var index = l.serializedProperty.arraySize;
                    l.serializedProperty.arraySize++;
                    l.index = index;
                },

                drawElementBackgroundCallback = (rect, index, active, focused) =>
                {
                    if (active)
                    {
                        GUI.Box(new Rect(rect.x + 2, rect.y, rect.width - 4, rect.height + 1), "", "selectionRect");
                    }
                }
            };
        }
 private void Start()
 {
     m_skyController = GetComponent <AzureSkyController>();
     UpdateParticlesMaterials();
     UpdateParticlesPosition();
 }
 private void OnEnable()
 {
     m_skyController = GetComponent <AzureSkyController>();
 }