Exemple #1
0
        public IEnumerator OpenRadial(Vector2 startPosition, MenuActionLayer menuAction)
        {
            if (_state != State.Disabled)
            {
                StartCloseRadial();
                while (_state != State.Disabled)
                {
                    yield return(null);
                }
            }
            _currentLayer           = menuAction;
            PanelTransform.position = startPosition;
            var point = PanelTransform.anchoredPosition;

            point.x = Mathf.Clamp(point.x, -_positionLimit.x, _positionLimit.x);
            point.y = Mathf.Clamp(point.y, -_positionLimit.y, _positionLimit.y);
            PanelTransform.anchoredPosition = point;
            if (GameOptions.PauseForInput)
            {
                Game.Pause("Radial");
            }
            Game.CursorUnlock("Radial");
            _clickTimer.StartTimer();
            _state = State.Opening;
            DetermineTargetAngle(_currentControl);
            _currentLayer.Init(this, _cursorTargetAngle);
            _fadeIn.Restart(0, 1);
            _canvasGroup.SetActive(true);
        }
Exemple #2
0
 public void OnSystemUpdate(float dt, float unscaledDt)
 {
     if (!IsActive || _updateTimer.IsActive)
     {
         return;
     }
     _updateTimer.StartTimer();
     for (int i = _entities.Count - 1; i >= 0; i--)
     {
         if (_entities[i] == null || _entities[i].Pooled)
         {
             _entities.RemoveAt(i);
             continue;
         }
         var entity = _entities[i];
         var pos    = entity.transform.position.WorldToGenericGrid(_sectorSize);
         if (pos == entity.SectorPosition)
         {
             continue;
         }
         GetList(entity.SectorPosition).Remove(entity);
         entity.SectorPosition = pos;
         SetEntityList(entity);
     }
 }
Exemple #3
0
 public void OnSystemUpdate(float dt)
 {
     if (_checkTimer && !_timer.IsActive)
     {
         _timer.StartTimer();
         UpdateText();
     }
 }
 private void StatusMessages(Entity item, string message)
 {
     if (_statusTimer.IsActive)
     {
         return;
     }
     _statusTimer.StartTimer();
     UIFloatingText.Spawn(message, transform as RectTransform, Color.yellow, _textOrientation);
 }
 protected void StatusMessages(string message, Color color)
 {
     if (_statusTimer.IsActive)
     {
         return;
     }
     _statusTimer.StartTimer();
     UIFloatingText.Spawn(message, transform as RectTransform, color, UIFloatingText.Orietation.Center);
 }
Exemple #6
0
 public static void PlayClipBuffered(AudioClip clip, Vector3 position, float spatialBlend = 0.5f, float volume = 1)
 {
     if (_bufferTimer.IsActive)
     {
         return;
     }
     _bufferTimer.StartTimer();
     PlayClip(clip, position, spatialBlend);
 }
Exemple #7
0
 public void ResetAnimation(SpriteAnimation spriteAnimation)
 {
     _currentFrameIndex = 0;
     _animation         = spriteAnimation;
     if (_animation == null)
     {
         _playing = false;
         return;
     }
     _playing = true;
     _frameTimer.StartTimer();
 }
Exemple #8
0
        //public static void TestAnimationEvent(int entityId, string clip) {
        //    var entity = EntityController.GetEntity(entityId);
        //    if (entity == null) {
        //        return;
        //    }
        //    var handle = new TestReceiver<AnimatorEvent>();
        //    entity.AddObserver(handle);
        //    entity.Post(new PlayAnimation(entity, clip, new AnimatorEvent(entity, clip, true, true)));
        //    handle.OnDel += receiver => entity.RemoveObserver(handle);
        //}

        private static IEnumerator RunTimerTest(float length)
        {
            var watch = new System.Diagnostics.Stopwatch();

            watch.Start();
            var timer = new UnscaledTimer(length);

            timer.StartTimer();
            var startTime = TimeManager.TimeUnscaled;

            while (timer.IsActive)
            {
                yield return(null);
            }
            watch.Stop();
            Debug.LogFormat("Stop Watch Seconds {0} Ms {1} Manual {2} Timer {3}", watch.Elapsed.TotalSeconds, watch.Elapsed.Milliseconds, TimeManager.TimeUnscaled - startTime, length);
        }
Exemple #9
0
 void Update()
 {
     _fpsBuffer[_fpsBufferIndex++] = (int)(1f / Time.unscaledDeltaTime);
     if (_fpsBufferIndex >= _frameRange)
     {
         _fpsBufferIndex = 0;
     }
     CalculateFPS();
     if (_updateRate.IsActive)
     {
         return;
     }
     _updateRate.StartTimer();
     Display(_frameLabel, _averageFps);
     Display(_highLabel, _highestFps);
     Display(_lowLabel, _lowestFps);
 }