Пример #1
0
        void FilterCubemapCommon(CommandBuffer cmd,
                                 Texture source, RenderTexture target, int mipCount,
                                 Matrix4x4[] worldToViewMatrices)
        {
            // Solid angle associated with a texel of the cubemap.
            float invOmegaP = (6.0f * source.width * source.width) / (4.0f * Mathf.PI);

            m_GgxConvolveMaterial.SetTexture("_MainTex", source);
            m_GgxConvolveMaterial.SetTexture("_GgxIblSamples", m_GgxIblSampleData);
            m_GgxConvolveMaterial.SetFloat("_InvOmegaP", invOmegaP);

            for (int mip = 1; mip < ((int)EnvConstants.SpecCubeLodStep + 1); ++mip)
            {
                using (new ProfilingSample(cmd, "Filter Cubemap Mip {0}", mip))
                {
                    for (int face = 0; face < 6; ++face)
                    {
                        var faceSize  = new Vector4(source.width >> mip, source.height >> mip, 1.0f / (source.width >> mip), 1.0f / (source.height >> mip));
                        var transform = SkyManager.ComputePixelCoordToWorldSpaceViewDirectionMatrix(0.5f * Mathf.PI, faceSize, worldToViewMatrices[face], true);

                        var props = new MaterialPropertyBlock();
                        props.SetFloat("_Level", mip);
                        props.SetMatrix(ClusterShaderIDs._PixelCoordToViewDirWS, transform);

                        CoreUtils.SetRenderTarget(cmd, target, ClearFlag.None, mip, (CubemapFace)face);
                        CoreUtils.DrawFullScreen(cmd, m_GgxConvolveMaterial, props);
                    }
                }
            }
        }
Пример #2
0
    void Start()
    {
        rb = GetComponent <Rigidbody2D>();
        rb.gravityScale = 0;

        Collider2D col1 = GetComponent <Collider2D>();
        Collider2D col2 = person.GetComponent <Collider2D>();

        Debug.Log(col2);

        if (col1.IsTouching(col2))
        {
            Debug.Log("touching now");
            Vector3 screenSize = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));
            Vector3 spawnPos   = new Vector3(Random.Range(-screenSize.x, screenSize.x) * .9f,
                                             Random.Range(-screenSize.y * .7f, screenSize.y) * .9f, 0);
            transform.position = spawnPos;
        }

        _skyManager = FindObjectOfType <SkyManager>();

        // the image that gets darker as we lose stars
        _darker = FindObjectOfType <Darker>();

        _audioSource = gameObject.AddComponent <AudioSource>();
        fallFx       = Resources.Load <AudioClip>("Sounds/celestial1");
    }
Пример #3
0
 public static void PlayerLoginRPC_Prefix(string _playerId, out bool __state)
 {
     __state = false;
     try
     {
         if (_playerId != null && _playerId.Length == 17)
         {
             int __maxPlayers = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount);
             if (ReservedSlots.IsEnabled && ConnectionManager.Instance.ClientCount() > __maxPlayers)
             {
                 if (ReservedSlots.FullServer(_playerId))
                 {
                     GamePrefs.Set(EnumGamePrefs.ServerMaxPlayerCount, __maxPlayers + 1);
                     __state = true;
                     return;
                 }
             }
             if (NewPlayer.IsEnabled && NewPlayer.Block_During_Bloodmoon && SkyManager.BloodMoon())
             {
                 PersistentPlayerData _ppd = PersistentOperations.GetPersistentPlayerDataFromSteamId(_playerId);
                 if (_ppd == null)
                 {
                     ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_playerId);
                     if (_cInfo != null)
                     {
                         _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackagePlayerDenied>().Setup(new GameUtils.KickPlayerData(GameUtils.EKickReason.ManualKick, 0, default, "[ServerTools] - New players are kicked during the bloodmoon. Please return after the bloodmoon is over")));
Пример #4
0
        public void Update()
        {
#if DEBUG
            var oldIsNight     = _isNight;
            var oldIsBloodMoon = _isBloodMoon;
            var oldZombieSpeed = _zombieSpeed;
#endif
            var world = GameManager.Instance.World;
            _isNight     = world.IsDark();
            _isBloodMoon = SkyManager.BloodMoon();
            _zombieSpeed = CalculateZombieSpeed();
#if DEBUG
            if (oldIsNight != _isNight)
            {
                Log.Out("[WalkerSim] isNight, Old: {0}, New: {1}", oldIsNight, _isNight);
            }
            if (oldIsBloodMoon != _isBloodMoon)
            {
                Log.Out("[WalkerSim] isBloodMoon, Old: {0}, New: {1}", oldIsBloodMoon, _isBloodMoon);
            }
            if (oldZombieSpeed != _zombieSpeed)
            {
                Log.Out("[WalkerSim] zombieSpeed, Old: {0}, New: {1}", oldZombieSpeed, _zombieSpeed);
            }
#endif
        }
Пример #5
0
        protected override void Awake()
        {
            base.Awake();

            this.WindowTexture = GetComponent <WindowTextureManager>();
            this.SkyScraper    = GetComponent <SkyscraperManager>();
            this.Roads         = GetComponent <RoadsManager>();
            this.Cars          = GetComponent <CarsManager>();
            this.Decoration    = GetComponent <DecorationManager>();
            this.Sky           = GetComponent <SkyManager>();

            this.mover       = this.mover ?? Camera.main.GetComponent <CameraMover>();
            this.load        = this.load ?? Camera.main.GetComponent <Load>();
            this.buildScaler = this.buildScaler ?? FindObjectOfType <BuildScaler>();

            this.initializes = new List <Action>()
            {
                () => this.Sky.Initialize(),
                () => this.WindowTexture.Initialize(0),
                () => this.WindowTexture.Initialize(1),
                () => this.WindowTexture.Initialize(2),
                () => this.WindowTexture.Initialize(3),
                () => this.SkyScraper.Initialize(this.WindowTexture, this.Sky),
                () => this.buildScaler.Initialize(this.SkyScraper),
                () => this.Roads.Initialize(this.SkyScraper),
                () => this.Cars.Initialize(this.SkyScraper),
                () => this.Decoration.Initialize(this.SkyScraper),
                () => this.mover.Initialize(this.SkyScraper)
            };

            StartCoroutine(this.Initialize());
        }
Пример #6
0
        public void Update()
        {
#if DEBUG
            var oldIsNight     = IsNight;
            var oldIsBloodMoon = IsBloodMoon;
            var oldZombieSpeed = ZombieSpeed;
#endif
            var world = GameManager.Instance.World;
            IsNight     = world.IsDark();
            IsBloodMoon = SkyManager.BloodMoon();
            ZombieSpeed = CalculateZombieSpeed();
#if DEBUG
            if (oldIsNight != IsNight)
            {
                Logger.Debug("isNight, Old: {0}, New: {1}", oldIsNight, IsNight);
            }
            if (oldIsBloodMoon != IsBloodMoon)
            {
                Logger.Debug("isBloodMoon, Old: {0}, New: {1}", oldIsBloodMoon, IsBloodMoon);
            }
            if (oldZombieSpeed != ZombieSpeed)
            {
                Logger.Debug("zombieSpeed, Old: {0}, New: {1}", oldZombieSpeed, ZombieSpeed);
            }
#endif
            if (_invalidated)
            {
                if (OnChange != null)
                {
                    OnChange.Invoke();
                }
                _invalidated = false;
            }
        }
Пример #7
0
        public static void Exec(ClientInfo _cInfo)
        {
            int    _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime()));
            string _phrase301;
            string _phrase305;
            string _phrase306;

            if (!Phrases.Dict.TryGetValue(301, out _phrase301))
            {
                _phrase301 = "Next horde night is in {DaysUntilHorde} days";
            }
            if (!Phrases.Dict.TryGetValue(305, out _phrase305))
            {
                _phrase305 = "The horde is here!";
            }
            if (!Phrases.Dict.TryGetValue(306, out _phrase306))
            {
                _phrase306 = "Next horde night is today";
            }
            _phrase301 = _phrase301.Replace("{DaysUntilHorde}", _daysRemaining.ToString());
            if (_daysRemaining == 0 && !SkyManager.BloodMoon())
            {
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase306 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else if (SkyManager.BloodMoon())
            {
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase305 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase301 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #8
0
        public static void Vote(ClientInfo _cInfo)
        {
            int _playerCount = ConnectionManager.Instance.ClientCount();

            if (_playerCount > 9)
            {
                if (!StartedVote.Contains(_cInfo.entityId))
                {
                    if (!GameManager.Instance.World.IsDaytime())
                    {
                        if (!SkyManager.BloodMoon())
                        {
                            StartedVote.Clear();
                            StartedVote.Add(_cInfo.entityId);
                            VoteOpen = true;
                        }
                        else
                        {
                            string _phrase930;
                            if (!Phrases.Dict.TryGetValue(930, out _phrase930))
                            {
                                _phrase930 = "{PlayerName} you can not start a vote during a bloodmoon.";
                            }
                            _phrase930 = _phrase930.Replace("{PlayerName}", _cInfo.playerName);
                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase930), Config.Server_Response_Name, false, "ServerTools", false));
                        }
                    }
                    else
                    {
                        string _phrase931;
                        if (!Phrases.Dict.TryGetValue(931, out _phrase931))
                        {
                            _phrase931 = "{PlayerName} you can not start a vote during the day.";
                        }
                        _phrase931 = _phrase931.Replace("{PlayerName}", _cInfo.playerName);
                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase931), Config.Server_Response_Name, false, "ServerTools", false));
                    }
                }
                else
                {
                    string _phrase932;
                    if (!Phrases.Dict.TryGetValue(932, out _phrase932))
                    {
                        _phrase932 = "{PlayerName} you started the last vote. Someone else must start the vote.";
                    }
                    _phrase932 = _phrase932.Replace("{PlayerName}", _cInfo.playerName);
                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase932), Config.Server_Response_Name, false, "ServerTools", false));
                }
            }
            else
            {
                string _phrase933;
                if (!Phrases.Dict.TryGetValue(933, out _phrase933))
                {
                    _phrase933 = "{PlayerName} you can only start this vote if at least 10 players are online.";
                }
                _phrase933 = _phrase933.Replace("{PlayerName}", _cInfo.playerName);
                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase933), Config.Server_Response_Name, false, "ServerTools", false));
            }
        }
Пример #9
0
        public override void OnInspectorGUI()
        {
            UpdateSkyAndFogIntPopupData();

            EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Sky"), EditorStyles.miniLabel);
            using (new EditorGUILayout.HorizontalScope())
            {
                DrawOverrideCheckbox(m_SkyType);
                using (new EditorGUI.DisabledScope(!m_SkyType.overrideState.boolValue))
                {
                    EditorGUILayout.IntPopup(m_SkyType.value, m_SkyClassNames.ToArray(), m_SkyUniqueIDs.ToArray(), EditorGUIUtility.TrTextContent("Type", "Specifies the type of sky this Volume uses."));
                }
            }
            if (m_SkyType.value.intValue != 0)
            {
                EditorGUILayout.HelpBox("You need to also add a Volume Component matching the selected type.", MessageType.Info);
            }
            PropertyField(m_SkyAmbientMode, EditorGUIUtility.TrTextContent("Ambient Mode"));

            var staticLightingSky = SkyManager.GetStaticLightingSky();

            if (m_SkyAmbientMode.value.GetEnumValue <SkyAmbientMode>() == SkyAmbientMode.Static)
            {
                if (staticLightingSky == null)
                {
                    EditorGUILayout.HelpBox("Current Static Lighting Sky use None of profile None.", MessageType.Info);
                }
                else
                {
                    var skyType = staticLightingSky.staticLightingSkyUniqueID == 0 ? "None" : SkyManager.skyTypesDict[staticLightingSky.staticLightingSkyUniqueID].Name.ToString();
                    EditorGUILayout.HelpBox($"Current Static Lighting Sky use {skyType} of profile {staticLightingSky.profile?.name ?? "None"}.", MessageType.Info);
                }
            }
        }
 //private void UpdateOverlays(SkyTarget curSky)
 public static void Postfix(SkyManager __instance, Map ___map)
 {
     if (___map == Find.CurrentMap)
     {
         (BaseOverlay.GetOverlay(typeof(LightingOverlay)) as LightingOverlay).SetDirtySky(__instance.CurSkyGlow);
     }
 }
Пример #11
0
 public static void StatusCheck()
 {
     if (ConnectionManager.Instance.ClientCount() > 0)
     {
         int    _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime()));
         string _phrase301;
         string _phrase305;
         string _phrase306;
         if (!Phrases.Dict.TryGetValue(301, out _phrase301))
         {
             _phrase301 = "Next horde night is in {DaysUntilHorde} days";
         }
         if (!Phrases.Dict.TryGetValue(305, out _phrase305))
         {
             _phrase305 = "The horde is here!";
         }
         if (!Phrases.Dict.TryGetValue(306, out _phrase306))
         {
             _phrase306 = "Next horde night is today";
         }
         _phrase301 = _phrase301.Replace("{DaysUntilHorde}", _daysRemaining.ToString());
         if (_daysRemaining == 0 && !SkyManager.BloodMoon())
         {
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase306 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
         else if (SkyManager.BloodMoon())
         {
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase305 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase301 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
     }
 }
Пример #12
0
 public static void Exec()
 {
     if (!SkyManager.BloodMoon())
     {
         int _playerCount = ConnectionManager.Instance.ClientCount();
         if (_playerCount > 5)
         {
             int           _counter = 0;
             List <Entity> Entities = GameManager.Instance.World.Entities.list;
             for (int i = 0; i < Entities.Count; i++)
             {
                 Entity _entity = Entities[i];
                 if (_entity != null)
                 {
                     if (!_entity.IsClientControlled())
                     {
                         EntityType _type = _entity.entityType;
                         if (_type == EntityType.Zombie)
                         {
                             _counter++;
                         }
                     }
                 }
             }
             if (_counter < 30)
             {
                 GameManager.Instance.World.aiDirector.GetComponent <AIDirectorWanderingHordeComponent>().SpawnWanderingHorde(false);
                 Log.Out(string.Format("[SERVERTOOLS] Spawned a horde"));
             }
         }
     }
 }
Пример #13
0
        public override void CreateScene()
        {
            // Set some camera params
            camera.FarClipDistance  = 30000;
            camera.NearClipDistance = 20;

            camera.SetPosition(20000, 500, 20000);
            camera.SetDirection(1, 0, 0);

            // Create our text area for display SkyX parameters
            CreateTextArea();

            manager = new SkyManager(base.sceneMgr, base.camera);
            manager.Create();

            // Add our ground atmospheric scattering pass to terrain material
            MaterialPtr material = MaterialManager.Singleton.GetByName(TerrainMaterialName);

            manager.GPUManager.AddGroundPass(material.GetTechnique(0).CreatePass(), 5000, SceneBlendType.SBT_TRANSPARENT_COLOUR);

            // Create our terrain
            sceneMgr.SetWorldGeometry("Terrain.cfg");

            // Add a basic cloud layer
            manager.CloudsManager.Add(new CloudLayer.LayerOptions());

            //Add frame evnet
            root.FrameStarted += new FrameListener.FrameStartedHandler(FrameStarted);
        }
        public override void OnInspectorGUI()
        {
            UpdateSkyAndFogIntPopupData();

            EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Sky"), EditorStyles.miniLabel);
            using (new EditorGUILayout.HorizontalScope())
            {
                DrawOverrideCheckbox(m_SkyType);
                using (new EditorGUI.DisabledScope(!m_SkyType.overrideState.boolValue))
                {
                    EditorGUILayout.IntPopup(m_SkyType.value, m_SkyClassNames.ToArray(), m_SkyUniqueIDs.ToArray(), EditorGUIUtility.TrTextContent("Type", "Specifies the type of sky this Volume uses."));
                }
            }
            PropertyField(m_SkyAmbientMode, EditorGUIUtility.TrTextContent("Ambient Mode", "Specifies how the global ambient probe is computed. Dynamic will use the currently displayed sky and static will use the sky setup in the environment lighting panel."));

            var staticLightingSky = SkyManager.GetStaticLightingSky();

            if (m_SkyAmbientMode.value.GetEnumValue <SkyAmbientMode>() == SkyAmbientMode.Static)
            {
                if (staticLightingSky == null)
                {
                    EditorGUILayout.HelpBox("Current Static Lighting Sky use None of profile None.", MessageType.Info);
                }
                else
                {
                    var skyType = staticLightingSky.staticLightingSkyUniqueID == 0 ? "None" : SkyManager.skyTypesDict[staticLightingSky.staticLightingSkyUniqueID].Name.ToString();
                    EditorGUILayout.HelpBox($"Current Static Lighting Sky use {skyType} of profile {staticLightingSky.profile?.name ?? "None"}.", MessageType.Info);
                }
            }
        }
Пример #15
0
    void Start()
    {
        SkyManager skyManager = FindObjectOfType <SkyManager> ();

        callTripod = new EventName(CALL_TRIPOD);
        EventManager.StartListening(callTripod, SendTripod);
        skyManager.AddNightCallBack(new object[] { callTripod, new object[] { } });
    }
Пример #16
0
        public static bool Prefix(ref bool __result)
        {
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            SkyManager.SetSunIntensity(0.3f);
            __result = true;
            return(false);
        }
Пример #17
0
 public static void Vote(ClientInfo _cInfo)
 {
     if (!VoteOpen)
     {
         int _playerCount = ConnectionManager.Instance.ClientCount();
         if (_playerCount >= Players_Online)
         {
             if (!GameManager.Instance.World.IsDaytime())
             {
                 if (!SkyManager.BloodMoon())
                 {
                     VoteOpen = true;
                     string _phrase932;
                     if (!Phrases.Dict.TryGetValue(932, out _phrase932))
                     {
                         _phrase932 = "A vote to skip the night has begun. You have 60 seconds to type {CommandPrivate}{Command70}.";
                     }
                     _phrase932 = _phrase932.Replace("{CommandPrivate}", ChatHook.Command_Private);
                     _phrase932 = _phrase932.Replace("{Command70}", RestartVote.Command70);
                     ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase932 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 }
                 else
                 {
                     string _phrase930;
                     if (!Phrases.Dict.TryGetValue(930, out _phrase930))
                     {
                         _phrase930 = " you can not start a vote during a bloodmoon.";
                     }
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase930 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             else
             {
                 string _phrase931;
                 if (!Phrases.Dict.TryGetValue(931, out _phrase931))
                 {
                     _phrase931 = " you can not start a vote during the day.";
                 }
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase931 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         else
         {
             string _phrase933;
             if (!Phrases.Dict.TryGetValue(933, out _phrase933))
             {
                 _phrase933 = " you can only start this vote if at least {Count} players are online.";
             }
             _phrase933 = _phrase933.Replace("{Count}", Players_Online.ToString());
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase933 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
Пример #18
0
 public static void Exec()
 {
     if (ConnectionManager.Instance.ClientCount() > 0 && GameManager.Instance.World.IsDaytime())
     {
         ulong worldTime          = GameManager.Instance.World.worldTime;
         int   twentyFourHourTime = (int)(worldTime / 1000UL) % 24;
         int   dusk          = (int)SkyManager.GetDuskTime();
         int   timeRemaining = dusk - twentyFourHourTime;
         Phrases.Dict.TryGetValue("NightAlert1", out string phrase);
         phrase = phrase.Replace("{Value}", timeRemaining.ToString());
         ChatHook.ChatMessage(null, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
     }
 }
Пример #19
0
 public static void Exec()
 {
     if (ConnectionManager.Instance.ClientCount() > 0 && GameManager.Instance.World.IsDaytime())
     {
         ulong _worldTime     = GameManager.Instance.World.worldTime;
         int   _24HourTime    = (int)(_worldTime / 1000UL) % 24;
         int   _dusk          = (int)SkyManager.GetDuskTime();
         int   _timeRemaining = _dusk - _24HourTime;
         Phrases.Dict.TryGetValue(801, out string _phrase801);
         _phrase801 = _phrase801.Replace("{Value}", _timeRemaining.ToString());
         ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase801 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
     }
 }
 public static bool BloodMoonOver()
 {
     try
     {
         if (Shutdown.Bloodmoon && !SkyManager.BloodMoon() && !GameManager.Instance.World.IsDark())
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.BloodMoonOver: {0}", e.Message));
     }
     return(false);
 }
 public static bool BloodMoonSky()
 {
     try
     {
         if (SkyManager.BloodMoon())
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.BloodMoonSky: {0}.", e));
     }
     return(false);
 }
Пример #22
0
        public static void CheckBloodmoon()
        {
            ulong _worldTime      = GameManager.Instance.World.worldTime;
            int   _daysUntilHorde = Days_Until_Horde - GameUtils.WorldTimeToDays(_worldTime) % Days_Until_Horde;
            int   _worldHours     = (int)(_worldTime / 1000UL) % 24;

            if (_daysUntilHorde == Days_Until_Horde && (_worldHours >= (int)SkyManager.GetDuskTime() - 3) || SkyManager.BloodMoon())
            {
                Bloodmoon = true;
            }
            else
            {
                Bloodmoon = false;
                Auto_Shutdown();
            }
        }
Пример #23
0
        public static void Postfix(float ___sunIntensity, float ___sMaxSunIntensity)
        {
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return;
            }
            if (GameManager.Instance.World.GetPrimaryPlayer() == null)
            {
                return;
            }

            if (GameManager.Instance.World.GetPrimaryPlayer().position.y < 30)
            {
                SkyManager.SetSunIntensity(0.1f);
            }
        }
 public static void Exec()
 {
     if (GameManager.Instance.World.IsDaytime())
     {
         ulong  _worldTime  = GameManager.Instance.World.worldTime;
         int    _worldHours = (int)(_worldTime / 1000UL) % 24;
         int    _dusk       = (int)SkyManager.GetDuskTime();
         int    _hours      = _dusk - _worldHours;
         string _phrase940;
         if (!Phrases.Dict.TryGetValue(940, out _phrase940))
         {
             _phrase940 = "{Time} hours until night time.";
         }
         _phrase940 = _phrase940.Replace("{Time}", _hours.ToString());
         GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase940), Config.Server_Response_Name, false, "ServerTools", false);
     }
 }
Пример #25
0
    void Start()
    {
        _renderer   = GetComponent <SpriteRenderer>();
        _Color      = _renderer.color;
        targetColor = Camera.main.backgroundColor;

        darker_Event.AddListener(GetDarker);
        noStars_Event.AddListener(StarsGone);

        _skyManager = FindObjectOfType <SkyManager>();
        numOfStars  = _skyManager.numOfTotalStars;

        Vector3 screenSize = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));

        transform.localScale = Vector3.one * screenSize.y * .25f;
        transform.position   = new Vector3(0, -screenSize.y + _renderer.sprite.bounds.max.y * 2f, 0);
    }
 public static void Exec()
 {
     if (GameManager.Instance.World.IsDaytime())
     {
         ulong  _worldTime     = GameManager.Instance.World.worldTime;
         int    _24HourTime    = (int)(_worldTime / 1000UL) % 24;
         int    _dusk          = (int)SkyManager.GetDuskTime();
         int    _timeRemaining = _dusk - _24HourTime;
         string _phrase940;
         if (!Phrases.Dict.TryGetValue(940, out _phrase940))
         {
             _phrase940 = "{Time} hours until night time.";
         }
         _phrase940 = _phrase940.Replace("{Time}", _timeRemaining.ToString());
         ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase940 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
     }
 }
 public static bool DuskSky()
 {
     try
     {
         float _duskTime      = SkyManager.GetDuskTime();
         float _timeInMinutes = SkyManager.GetTimeOfDayAsMinutes();
         if (!SkyManager.BloodMoon() && _timeInMinutes > _duskTime && !GameManager.Instance.World.IsDark())
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.DuskSky: {0}.", e));
     }
     return(false);
 }
 public static bool BloodMoonDuskSky()
 {
     try
     {
         int   _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime()));
         float _duskTime      = SkyManager.GetDuskTime();
         float _timeInMinutes = SkyManager.GetTimeOfDayAsMinutes();
         if (_daysRemaining == 0 && !SkyManager.BloodMoon() && _timeInMinutes > _duskTime && !GameManager.Instance.World.IsDark())
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.BloodMoonDuskSky: {0}.", e));
     }
     return(false);
 }
Пример #29
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _sfxButtonPress  = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS);
            _sfxHit          = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT);
            _sfxScoreReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED);

            _spriteSheetTexture  = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET);
            _invertedSpriteSheet = _spriteSheetTexture.InvertColors(Color.Transparent);

            _fadeInTexture = new Texture2D(GraphicsDevice, 1, 1);
            _fadeInTexture.SetData(new Color[] { Color.White });

            _trex               = new Trex(_spriteSheetTexture, new Vector2(TREX_START_POS_X, TREX_START_POS_Y - Trex.TREX_DEFAULT_SPRITE_HEIGHT), _sfxButtonPress);
            _trex.DrawOrder     = 100;
            _trex.JumpComplete += trex_JumpComplete;
            _trex.Died         += trex_Died;

            _scoreBoard = new ScoreBoard(_spriteSheetTexture, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), _trex, _sfxScoreReached);
            //_scoreBoard.Score = 498;
            //_scoreBoard.HighScore = 12345;

            _inputController = new InputController(_trex);

            _groundManager   = new GroundManager(_spriteSheetTexture, _entityManager, _trex);
            _obstacleManager = new ObstacleManager(_entityManager, _trex, _scoreBoard, _spriteSheetTexture);
            _skyManager      = new SkyManager(_trex, _spriteSheetTexture, _invertedSpriteSheet, _entityManager, _scoreBoard);

            _gameOverScreen          = new GameOverScreen(_spriteSheetTexture, this);
            _gameOverScreen.Position = new Vector2(WINDOW_WIDTH / 2 - GameOverScreen.GAME_OVER_SPRITE_WIDTH / 2, WINDOW_HEIGHT / 2 - 30);

            _entityManager.AddEntity(_trex);
            _entityManager.AddEntity(_groundManager);
            _entityManager.AddEntity(_scoreBoard);
            _entityManager.AddEntity(_obstacleManager);
            _entityManager.AddEntity(_gameOverScreen);
            _entityManager.AddEntity(_skyManager);

            _groundManager.Initialize();

            LoadSaveState();
        }
        public static bool Prefix(ref UMA.UMAData ___umaData)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            ___umaData.AtlasSize = 512;

            // Changing the Atlas size down  for all UMAs
            if (SkyManager.BloodMoon() || SkyManager.IsDark())
            {
                ___umaData.AtlasSize = 128;
            }

            AdvLogging.DisplayLog(AdvFeatureClass, Feature + " - Atlas Size: " + ___umaData.AtlasSize);
            return(true);
        }