IEnumerator Attack()
    {
        yield return(new WaitForSeconds(1.2f));

        _isAttacking = false;
        Idle?.Invoke();
    }
Example #2
0
 private void Inputs()
 {
     if (Input.GetKey(KeyCode.Space) && _isGrounded)
     {
         _isJumping = true;
         Jump?.Invoke();
     }
     if (Input.GetKeyDown(KeyCode.LeftShift) && !_beganFall && _isMoving)
     {
         _isSprinting = true;
         Sprint?.Invoke();
     }
     if (Input.GetKeyUp(KeyCode.LeftShift) && !_beganFall)
     {
         _isSprinting = false;
         if (_isMoving)
         {
             StartRunning?.Invoke();
         }
         else
         {
             Idle?.Invoke();
         }
     }
     if (Input.GetKeyDown(KeyCode.Mouse0) && !cooldown)
     {
         loadout.UseEquppiedAbility(transform, abilityTarget);
         StartCoroutine(Cooldown());
     }
     //if (Input.GetKeyDown(KeyCode.F)) loadout.EquipAbility(_newAbilityToTest);
     if (Input.GetKeyDown(KeyCode.Tab))
     {
         abilityTarget = transform;
     }
 }
 private void OnTimer(object state)
 {
     if (_timer != null && (DateTime.Now - _lastActivityTime) >= IdleInterval)
     {
         Idle?.Invoke(this, EventArgs.Empty);
     }
 }
Example #4
0
 private void OnTimer(object state)
 {
     if ((DateTime.Now - _lastActivityTime).TotalMilliseconds >= 100 && _timer != null)
     {
         Idle?.Invoke(this, EventArgs.Empty);
     }
 }
 private void CheckIfStoppedMoving()
 {
     if (_isMoving == true)
     {
         Idle?.Invoke();
         Debug.Log("Stopped");
     }
     if (_isSprinting == true)
     {
         Idle?.Invoke();
         Debug.Log("Stopped");
     }
     if (_isBlocking == true)
     {
         Idle?.Invoke();
         Debug.Log("Stopped");
     }
     if (_allowAttack == false)
     {
         StartCoroutine("Attack");
         Debug.Log("Stopped");
     }
     if (_isDamaged)
     {
         StartCoroutine("Damage");
         Debug.Log("Stopped");
     }
     _isMoving    = false;
     _isSprinting = false;
     _isBlocking  = false;
     _allowBlock  = true;
     _allowAttack = true;
     _isDamaged   = false;
 }
        /// <summary>
        /// Creates a new <c>SystemEventNotifier</c> instance and sets up some
        /// required resources.
        /// </summary>
        /// <param name="maxIdleSeconds">The maximum system idle time in seconds before the
        /// <c>Idle</c> event is being raised.</param>
        public SystemEventNotifier(int maxIdleSeconds)
        {
            _maxIdleSeconds = maxIdleSeconds;
            _helperWindow   = new SystemEventHelperWindow(this);
            _cts            = new CancellationTokenSource();
            _ct             = _cts.Token;

            _pollTask = new Task(() =>
            {
                Log.Information("SystemEventNotifier polling task started");

                while (!_ct.IsCancellationRequested)
                {
                    // Check for screensaver activation
                    if (IsScreensaverRunning())
                    {
                        if (!_screensaverDetected)
                        {
                            Screensaver?.Invoke(this, new SystemEventArgs("Screensaver"));
                            Log.Information("Detected screensaver start");
                            _screensaverDetected = true;
                        }
                    }
                    else
                    {
                        if (_screensaverDetected)
                        {
                            _screensaverDetected = false;
                        }
                    }

                    // Check system idle time
                    uint idleTime = GetIdleTimeSeconds();
                    Log.Debug("Idle time: {IdleTime}", idleTime);
                    if (idleTime > _maxIdleSeconds)
                    {
                        if (!_idleDetected)
                        {
                            Idle?.Invoke(this, new SystemEventArgs("Idle Timeout"));
                            Log.Information("Detected idle timeout");
                            _idleDetected = true;
                        }
                    }
                    else
                    {
                        if (_idleDetected)
                        {
                            _idleDetected = false;
                        }
                    }

                    Thread.Sleep(POLL_INTERVAL);
                }

                Log.Information("SystemEventNotifier polling task ending");
            }, _ct);

            _pollTask.Start();
        }
Example #7
0
        private async void Ready()
        {
            await SwitchRelayAsync(true);//turn green

            Display(LEDOptions.WelcomeMessage.Template, LEDOptions.WelcomeMessage.ShowConfig);

            Idle?.Invoke(this, new EventArgs());
        }
 private void Start()
 {
     Idle?.Invoke();
     _isAlive            = true;
     currentPushStrength = 1;
     PushBar.SetMaxStrength(maxPushStrength);
     PushBar.SetStrength(currentPushStrength);
 }
    // reverts flag for player movement
    private void CheckIfStoppedMoving()
    {
        if (IsRunning && !IsJumping && _canBasic)
        {
            Idle?.Invoke();
        }

        IsRunning = false;
    }
Example #10
0
 private void CheckIfStoppedMoving()
 {
     if (_isMoving == true)
     {
         Idle?.Invoke();
         Debug.Log("Stopped");
     }
     _isMoving = false;
 }
Example #11
0
 private void CheckIfStoppedMoving()
 {
     if (_isMoving == true && _movement.IsGrounded == true)
     {
         Idle?.Invoke();
         //Debug.Log("Stopped Running");
     }
     _isMoving = false;
 }
Example #12
0
    //Checks if grounded
    public void FixedUpdate()
    {
        bool Grounded = OnGround;

        OnGround = false;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(ObjectCheck.position, HeadCollider, IsGround);
        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].gameObject != gameObject)
            {
                OnGround = true;
                if (!Grounded)
                {
                    OnLandEvent.Invoke();
                }
            }
        }

        if (OnGround == true)
        {
            //Attack Command
            if (Input.GetButtonDown("Fire1"))
            {
                Attack.Invoke();
            }


            Vector3 targetVelocity = new Vector2(MoveSpeed * Input.GetAxis("Horizontal"), Controller.velocity.y);

            //Moves Character
            Controller.velocity = Vector3.SmoothDamp(Controller.velocity, targetVelocity, ref C_Velocity, MoveSmoother);

            Walking.Invoke();

            //Flips Character direction
            if (Input.GetAxis("Horizontal") > 0 && !FaceRight || Input.GetAxis("Horizontal") < 0 && FaceRight)
            {
                FaceRight = !FaceRight;
                Vector3 CScale = transform.localScale;
                CScale.x            *= -1;
                transform.localScale = CScale;
            }
            //Activate jump
            if (Input.GetButton("Jump"))
            {
                OnGround = false;
                Controller.AddForce(new Vector2(0f, JumpSpeed));
            }

            if (!Input.GetButton("Horizontal"))
            {
                Idle.Invoke();
            }
        }
    }
Example #13
0
 public override void OnCallStateChanged(CallState state, string phoneNumber)
 {
     if (state == CallState.Idle)
     {
         Idle?.Invoke(this, phoneNumber);
     }
     else if (state == CallState.Ringing)
     {
         IncomingCall?.Invoke(this, phoneNumber);
     }
 }
 private void CheckIfStoppedMoving()
 {
     if (_isMoving == true)
     {
         //our velocity says we're moving, but previously were
         //this means we've stoppred!
         Idle?.Invoke();
         Debug.Log("Stopped");
     }
     _isMoving = false;
 }
 private void CheckIfStoppedMoving()
 {
     if ((_isRunning || _isSprinting || _player.HasThrown || _health.TakenDamage) && !_player.IsCharging && !_takingDamage)
     {
         Idle?.Invoke();
     }
     _isRunning          = false;
     _isSprinting        = false;
     _player.HasThrown   = false;
     _health.TakenDamage = false;
 }
Example #16
0
        public int FDoIdle(uint grfidlef)
        {
            if (!_startupComplete)
            {
                ApplicationStarted?.Invoke(this, EventArgs.Empty);
                _startupComplete = true;
            }

            Idle?.Invoke(this, EventArgs.Empty);
            return(VSConstants.S_OK);
        }
Example #17
0
 private void CheckIfStoppedMoving()
 {
     if (_isJumping || _beganFall)
     {
         return;
     }
     if (_isMoving)
     {
         Idle?.Invoke();
     }
     _isMoving = false;
 }
        protected virtual void OnIdle(object sender, EventArgs args)
        {
            GLWrapper.Reset();
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            UpdateSubTree();
            DrawSubTree();

            Idle?.Invoke(this, EventArgs.Empty);

            GLControl.SwapBuffers();
        }
Example #19
0
 private void HandleIdle()
 {
     lock (_lock) {
         if ((DateTime.Now - _lastActivityTime).TotalMilliseconds > IdleDelay)
         {
             _timesFired++;
             if (_timesFired > MaxTimesFired)
             {
                 StopTimer();
             }
             _mainThread.Post(() => Idle?.Invoke(this, EventArgs.Empty), ThreadPostPriority.IdleOnce);
         }
     }
 }
Example #20
0
        private void OnTimerElapsed(object sender, ElapsedEventArgs args)
        {
            try
            {
                IdleScanAnalysis analysis = new IdleScanAnalysis(this);

                Scan?.Invoke(this, analysis);

                try
                {
                    if (analysis.Busy)
                    {
                        IdleCount = 0;

                        Busy?.Invoke(this, analysis);
                    }
                    else
                    {
                        IdleCount++;

                        Idle?.Invoke(this, analysis);
                    }
                }
                catch (Exception e)
                {
                    EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 18);

                    analysis.Error = true;
                }

                Eval?.Invoke(this, analysis);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 19);
            }
        }
Example #21
0
 public void RecheckRunSprintIdle()
 {
     if (_movement.IsGrounded)
     {
         if (_isMoving)
         {
             if (_isSprinting)
             {
                 StartSprinting?.Invoke();
                 //Debug.Log("Land & Sprint");
             }
             else
             {
                 StartRunning?.Invoke();
                 //Debug.Log("Land & Run");
             }
         }
         else
         {
             Idle?.Invoke();
             //Debug.Log("Land & Idle");
         }
     }
 }
Example #22
0
 public void DoIdle()
 {
     Idle?.Invoke(null, EventArgs.Empty);
     DoEvents();
 }
Example #23
0
 public void ResetIdle()
 {
     Idle?.Invoke();
 }
Example #24
0
 protected void OnIdle(object source, EventArgs e)
 {
     Idle?.Invoke(this, e);
 }
 /// <summary>
 /// Occurs when an event is received from MPV.
 /// </summary>
 private void Mpv_EventReceived(object sender, MpvMessageEventArgs e)
 {
     if (e.EventName == "start-file")
     {
         StartFile?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "end-file" && EndFile != null)
     {
         var args = new EndFileEventArgs();
         if (Enum.TryParse(e.Data["reason"], true, out EndReason reason))
         {
             args.Reason = reason;
         }
         else
         {
             args.Reason = EndReason.Unknown;
         }
         EndFile?.Invoke(this, args);
     }
     else if (e.EventName == "file-loaded")
     {
         FileLoaded?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "seek")
     {
         Seek?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "playback-restart")
     {
         PlaybackRestart?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "idle")
     {
         Idle?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "tick")
     {
         Tick?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "shutdown")
     {
         Shutdown?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "log-message" && LogMessage != null)
     {
         var args = new LogMessageEventArgs
         {
             Prefix = e.Data["prefix"] ?? string.Empty,
             Level  = FlagExtensions.ParseMpvFlag <LogLevel>(e.Data["level"]) ?? LogLevel.No,
             Text   = e.Data["text"] ?? string.Empty
         };
         LogMessage?.Invoke(this, args);
     }
     else if (e.EventName == "video-reconfig")
     {
         VideoReconfig?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "audio-reconfig")
     {
         AudioReconfig?.Invoke(this, new EventArgs());
     }
     else if (e.EventName == "property-change" && PropertyChanged != null)
     {
         var args = new PropertyChangedEventArgs()
         {
             Id   = e.Data["id"].Parse <int>() ?? 0,
             Data = e.Data["data"] ?? string.Empty,
             Name = e.Data["name"] ?? string.Empty
         };
         PropertyChanged?.Invoke(this, args);
     }
 }
 protected async Task IdleDelayTask()
 {
     Idle?.Invoke(this, IdleDelay);
     await Task.Delay(IdleDelay, CancellationToken);
 }
Example #27
0
 private void Start()
 {
     Idle?.Invoke();
 }
Example #28
0
 public void DoIdle()
 {
     UIThreadHelper.Instance.Invoke(() => Idle?.Invoke(null, EventArgs.Empty));
     DoEvents();
 }
Example #29
0
 public void DoIdle()
 {
     Idle?.Invoke(this, EventArgs.Empty);
 }
Example #30
0
 private void FireIdle()
 {
     Idle?.Invoke(null, EventArgs.Empty);
 }