コード例 #1
0
ファイル: Gyroscope.cs プロジェクト: EngineerDDP/RPiClient
        private void Device_OnInterrupt(GpioPin sender, GpioPinValueChangedEventArgs args)
        {
            if (Device == null)
            {
                return;
            }
            int interruptStatus = Device.getIntStatus();

            if ((interruptStatus & 0x10) != 0)
            {
                Device.resetFIFO();
            }
            else if ((interruptStatus & 0x02) != 0)
            {
                int count = Device.getFIFOCount();
                while (count >= Constants.DMPPacketSize)
                {
                    byte[] buffer = Device.getFIFOBytes(Constants.DMPPacketSize);
                    count -= Constants.DMPPacketSize;

                    Quaternion               q    = Device.dmpGetQuaternion(buffer);
                    GravityVector            g    = Device.dmpGetGravity(q);
                    YawPitchRoll             y    = Device.dmpGetYawPitchRoll(q, g);
                    GyroscopeSensorEventArgs argv = new GyroscopeSensorEventArgs(y, g, q, SimpleRate);

                    OnInterrupt?.Invoke(this, argv);
                }
            }
        }
コード例 #2
0
 public void LockActionType(GameInfo.ActionType actionType, byte priority = 1)
 {
     if (_actionLocks[(int)actionType] < priority)
     {
         _actionLocks[(int)actionType] = priority;
         OnInterrupt?.Invoke(this, actionType, priority);
     }
 }
コード例 #3
0
 public void LockAllActions(byte priority)
 {
     for (int i = 0; i < _actionLocks.Length; i++)
     {
         if (_actionLocks[i] > priority)
         {
             continue;
         }
         _actionLocks[i] = priority;
         OnInterrupt?.Invoke(this, (GameInfo.ActionType)i, priority);
     }
 }
コード例 #4
0
        public void Damage(Vector3 pos, AttackData attackData)
        {
            if (isDead == true || isInvulnerable == true)
                return;

            /*if (characterAnimation.State == CharacterState.Dash)
            {
                OnInterrupt.Invoke();
            }*/

            DamageMessage msg = characterBodyPartController.Damage(attackData, characterMovement.CharacterDirection.DirectionTransform);
            //DamageMessage msg = attackData.AttackProcessor.ProcessAttack(attackData.AttackDataStat, characterStatController);
            msg.SetDamagePosition(pos);

            if (OnHit != null) OnHit.Invoke(msg);

            if(characterStatController.Hp <= 0)
            {
                Death(attackData);
                return;
            }
            if(msg.damageRaw + msg.damageScratch > 0)
                shakeSprite.Shake(0.05f, 0.2f);

            if(isInterruptable == true)
            {
                if (airborneClip != null)
                    AudioManager.Instance.PlaySound(airborneClip);
                Knockback();
                if(OnInterrupt != null) OnInterrupt.Invoke();
                isInterruptable = false;
            }

            if (isKnockback == false && msg.knockback == true)
                Knockback();
            else if (isKnockback == true)
                Knockback();

            if (isKnockback == true && msg.launch == true)
                CheckLaunch(attackData);
        }
コード例 #5
0
 internal void Interupt()
 {
     m_IsInterrupt = true;
     m_Inner?.Interupt();
     OnInterrupt?.Invoke();
 }