コード例 #1
0
        public void Execute()
        {
            if (infosWasChanged)
            {
                _cannonCooldownsController.Load(weaponInfos);
                var dict = new Dictionary <ushort, float>(weaponInfos.Length);
                for (ushort i = 0; i < weaponInfos.Length; i++)
                {
                    dict.Add(i, 0f);
                }
                approximator.Set(dict, Time.time);
                infosWasChanged = false;
            }

            _cannonCooldownsController.SetCooldowns(approximator.Get(Time.time).Values.ToArray());

            if (cooldownsWasChanged)
            {
                var dict = new Dictionary <ushort, float>(cooldowns.Length);
                for (ushort i = 0; i < cooldowns.Length; i++)
                {
                    dict.Add(i, cooldowns[i]);
                }
                approximator.Set(dict, Time.time);
                cooldownsWasChanged = false;
            }
        }
コード例 #2
0
        public void Execute()
        {
            if (maxCooldownWasChanged)
            {
                _cooldownInfo.Load(maxCooldown);
                maxCooldownWasChanged = false;
            }

            _cooldownInfo.SetCooldown(approximator.Get(Time.time)[0]);

            if (currentCooldownWasChanged)
            {
                approximator.Set(new Dictionary <ushort, float> {
                    { 0, currentCooldown }
                }, Time.time);
                currentCooldownWasChanged = false;
            }
        }
コード例 #3
0
        public void Execute()
        {
            lock (LockObj)
            {
                var radiuses = approximator.Get(Time.time);
                if (!wasProcessed)
                {
                    approximator.Set(new Dictionary <ushort, float>(UpdateRadiusSystem.radiuses), Time.time);
                    wasProcessed = true;
                }

                foreach (var radiusPair in radiuses)
                {
                    var entity = gameContext.GetEntityWithId(radiusPair.Key);

                    if (entity != null && entity.hasCircle)
                    {
                        entity.ReplaceCircle(radiusPair.Value);
                        entity.isHidden = false;
                        UpdateRadiusSystem.radiuses.Remove(radiusPair.Key);
                    }
                    else
                    {
                        //DebugLogWarning("Пришла информация об объекте, которого нет на карте: " + radiusPair.Key);
                    }
                }

                //Зона всегда является объектом с id = 0
                if (radiuses.TryGetValue(0, out var zoneRadius))
                {
                    if (gameContext.hasZoneInfo)
                    {
                        gameContext.zoneInfo.radius = zoneRadius;
                    }
                }

                wasProcessed = UpdateRadiusSystem.radiuses.Count == 0;
            }
        }
コード例 #4
0
        public void Execute()
        {
            var dict            = approximator.Get(Time.time);
            var serverDeltaTime = dict[0];

            lock (LockObj)
            {
                if (WasChanged)
                {
                    //log.Debug("Server FPS: " + 1f / _serverDeltaTime);
                    approximator.Set(new Dictionary <ushort, float>(1)
                    {
                        { 0, _serverDeltaTime }
                    }, Time.time);
                    WasChanged = false;
                }
            }

            var timeScale = ServerTimeConstants.MinDeltaTime / serverDeltaTime;

            Time.timeScale      = timeScale;
            Time.fixedDeltaTime = defaultFixedDeltaTime * timeScale;
        }