public void StartInactivityControl(TimeSpan timeOut)
        {
            _activityTimer = new DispatcherTimer {
                Interval = timeOut, IsEnabled = true
            };
            _activityTimer.Tick += (sender, args) =>
            {
                _inactiveMousePosition = Mouse.GetPosition(MainDockerPanel);

                Inactivity?.Invoke(sender, args);
            };

            _inactivityControlEnabled = true;
        }
Beispiel #2
0
 private void InactivityTimerElapsed(object sender, ElapsedEventArgs e)
 {
     Inactivity?.Invoke(sender, null);
 }
Beispiel #3
0
        private void HandleMinionInactivity()
        {
            foreach (Minion minion in this.minions)
            {
                if (minion.IsDead || !minion.IsActive)
                {
                    continue;
                }
                Inactivity inactivity = minion.GetComponent <Inactivity>();
                if (inactivity == null)
                {
                    continue;
                }
                float distance = Vector3.Distance(
                    this.Player.transform.position,
                    minion.transform.position
                    );
                int index = this.minions.IndexOf(minion);
                if (index < 0 || index >= this.minionIcons.Count)
                {
                    continue;
                }
                GameObject minionIcon = this.minionIcons[index];
                Animator   animator   = minionIcon.GetComponent <Animator>();
                if (distance > 0.8f * inactivity.Range)
                {
                    if (
                        animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 &&
                        !animator.IsInTransition(0))
                    {
                        if (index == currentMinionIdx)
                        {
                            animator.Play("MiddleIconBlink");
                        }
                        else if (index == (currentMinionIdx - 1 + this.minionIcons.Count) % this.minionIcons.Count)
                        {
                            animator.Play("LeftIconBlink");
                        }
                        else if (index == (currentMinionIdx + 1) % this.minionIcons.Count)
                        {
                            animator.Play("RightIconBlink");
                        }
                    }
                }
                else
                {
                    AnimatorClipInfo[] info = animator.GetCurrentAnimatorClipInfo(0);
                    foreach (AnimatorClipInfo i in info)
                    {
                        switch (i.clip.name)
                        {
                        case "LeftIconBlink":
                            animator.Play("LeftIconIdle");
                            break;

                        case "MiddleIconBlink":
                            animator.Play("MiddleIconIdle");
                            break;

                        case "RightIconBlink":
                            animator.Play("RightIconIdle");
                            break;
                        }
                    }
                }
            }
        }