3d game kit lite のアセットを使ってアクションゲームを作りたのですがプレイヤーの攻撃コンボの繋げ方が知りたいです。現在は一回の攻撃のみなのですが適切な連続コンボの実装方法が知りたいです。どんな実装方法が挙げられるのでしょうか?
cs
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class PlayerController : MonoBehaviour 6{ 7 8 9 bool isAttack1 = false; //攻撃 10 11 12 Vector3 moveVec; 13 const float moveSpeed = 3.0f; //移動速度 14 15 Rigidbody rb; 16 Animator anim; 17 18 19 // Start is called before the first frame update 20 void Start() 21 { 22 rb = GetComponent<Rigidbody>(); 23 anim = GetComponent<Animator>(); 24 25 moveVec = new Vector3(0,0,0); 26 } 27 28 void KeyInput() 29 { 30 //キー入力 31 if (Input.GetKey(KeyCode.W)) 32 { 33 moveVec.z = 1; 34 } 35 else if (Input.GetKey(KeyCode.S)) 36 { 37 moveVec.z = -1; 38 } 39 else 40 { 41 moveVec.z = 0; 42 } 43 44 if (Input.GetKey(KeyCode.A)) 45 { 46 moveVec.x = -1; 47 } 48 else if (Input.GetKey(KeyCode.D)) 49 { 50 moveVec.x = 1; 51 } 52 else 53 { 54 moveVec.x = 0; 55 } 56 57 //マウス左クリック 58 if(Input.GetMouseButtonDown(0)) 59 { 60 isAttack1 = true; 61 } 62 63 } 64 65 // Update is called once per frame 66 void Update() 67 { 68 KeyInput(); //キー入力 69 Move(); //移動 70 AnimationUpdate(); //アニメーション 71 72 73 } 74 75 //移動 76 void Move() 77 { 78 //X、Zのベクトルを得る 79 Vector3 cameraForward = Vector3.Scale(Camera.main.transform.forward, new Vector3(1, 0, 1)).normalized; 80 // 方向キーの入力値とカメラの向きから、移動方向を決定 81 Vector3 moveForward = (cameraForward * moveVec.z) + (Camera.main.transform.right * moveVec.x); 82 // キャラクターの向きを進行方向に 83 if (moveForward != Vector3.zero) 84 { 85 transform.rotation = Quaternion.LookRotation(moveForward); 86 } 87 rb.velocity = moveSpeed * moveForward; 88 89 } 90 91 //アニメーション更新 92 void AnimationUpdate() 93 { 94 anim.SetFloat("Speed",rb.velocity.magnitude); 95 96 if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1 && isAttack1 == true) 97 { 98 isAttack1 = false; 99 } 100 else 101 { 102 anim.SetBool("AttackCombo1", isAttack1); 103 } 104 } 105 106 void FixedUpdate() 107 { 108 109 } 110 111 112 113}
すみません。質問です。
”コンボ”というものは格ゲーなどのコンボをイメージされていますか?
あなたの回答
tips
プレビュー