Ejemplo n.º 1
0
    IEnumerator AddForceToLimb(BulletHitInfo_AF bulletHitInfo)
    {
        if (!IsInvincible && !IsAxe)
        {
            yield return(new WaitForFixedUpdate());

            if (bulletHitInfo.hitTransform != null)
            {
                if (bulletHitInfo.hitTransform.GetComponent <Rigidbody>() != null)
                {
                    bulletHitInfo.hitTransform.GetComponent <Rigidbody>().AddForceAtPosition(bulletHitInfo.bulletForce, bulletHitInfo.hitPoint);
                }
            }
            playerMove.AddForceSpeed(bulletHitInfo.bulletForce / 100f);

            // 最好設成一個Global Ienumertor 比較方便
            if (gamepad != null)
            {
                gamepad.SetMotorSpeeds(0.8f, 1f);
                yield return(new WaitForSecondsRealtime(0.2f));

                gamepad.PauseHaptics();
            }
        }
    }