Example #1
0
    void Jump(Vector3 uN, Vector3 vel)
    {
        //無理やり空中判定に
        aerialTimer = 0f;
        //音
        FootSEManager.PlayClip(0, tAvatar.position, tAvatar.rotation, 1f);
        //ジャンプした直後はステップできない
        stepCT = stepCT_Max / 2f;



        //
        restJumpCount--;
        jumpCT = 0.3f;


        //
        Vector3 jumpingVel = uN * tweakParam.jumpingPower;

        ballRB.velocity = (vel + jumpingVel);


        myContacts.Jump(jumpingVel);
        //ジャンプするたび、軸足は逆に
        animator.SetBool(animID_isLeft, !animator.GetBool(animID_isLeft));

        //(ジャンプする際、回転していると設置判定がバグるから回転を止める)
        ballRB.angularVelocity = Vector3.zero;

        if (myContacts.IsAnyContact)
        {
            //ジャンプする瞬間、アニメーション用のベクトルを更新
            animator.SetFloat(animID_speed_Y, 0f);
        }
    }
Example #2
0
 private void Start()
 {
     if (!main)
     {
         main = this;
     }
 }
 private void OnTriggerExit(Collider other)
 {
     if (exitPlay)
     {
         FootSEManager.PlayClip(0, transform.position, transform.rotation, rb.velocity.magnitude * 0.1f);
     }
     //        other.gameObject.GetComponent<I_FootEvent>()?.Enter(transform.position);
 }
Example #4
0
    void Step(Vector3 uN, Vector3 vel)
    {
        FootSEManager.PlayClip(0, tAvatar.position, tAvatar.rotation, 1f);

        restStepCount--;
        stepCT = stepCT_Max;


        if (vel.sqrMagnitude <= 0f)
        {
            vel = -animator.transform.forward;
        }

        ballRB.freezeRotation = false;

        Vector3 aerialVel = Vector3.zero;

        if (!myContacts.IsAnyContact)
        {
            aerialVel       = Vector3.up * 0.4f;
            ballRB.velocity = (Vector3.ProjectOnPlane(vel, uN).normalized + aerialVel) * states.agi * 2f;
        }
        else
        {
            aerialVel       = -uN * 0.5f;
            ballRB.velocity = (Vector3.ProjectOnPlane(vel, uN).normalized + aerialVel) * states.agi * 3f;
        }



        //        stepVel += vel*3f;
        //                ballRB.velocity = jumpingVel;
        //ballRB.AddForce(stepVel, ForceMode.VelocityChange);
        //myContacts.Jump(stepVel);


        //ジャンプするたび、軸足は逆に
        animator.SetBool(animID_isLeft, !animator.GetBool(animID_isLeft));

        //(ジャンプする際、回転していると設置判定がバグるから回転を止める)
        ballRB.angularVelocity = Vector3.zero;

        //ジャンプする瞬間、アニメーション用のベクトルを更新
        if (myContacts.IsAnyContact)
        {
            animator.SetFloat(animID_speed_Y, 0f);
        }



        //アニメーション速度変化
        Vector3 animatedVector = ballRB.velocity;

        animatedVector   = tAvatar.InverseTransformVector(animatedVector);
        animatedVector.y = 0f;
        float speed_Z = animatedVector.z;
        float speed_X = animatedVector.x;


        animator.SetFloat(animID_speed_X, speed_X);
        animator.SetFloat(animID_speed_Z, speed_Z);
        animator.SetFloat(animID_speed, 1f);

        //ステップトリガー

        animator.SetTrigger(animID_stepTrigger);
    }