Commit d0ed256b authored by 16도재형's avatar 16도재형

플레이어 공격에도 GetButton 사용

parent e3a994bf
...@@ -4,10 +4,8 @@ using UnityEditor.Animations; ...@@ -4,10 +4,8 @@ using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public class PlayerAttack : MonoBehaviour { public class PlayerAttack : MonoBehaviour {
public float[] attackRaw = new float[3]; public bool[] attack = new bool[3];
public int[] attackKeyState = new int[3]; //0: released 1: push 2: pushing public bool cancel;
public float cancelRaw;
public int cancelKeyState;
public bool playingSkill; public bool playingSkill;
public float comboTime; public float comboTime;
public Text time, combo; public Text time, combo;
...@@ -36,22 +34,10 @@ public class PlayerAttack : MonoBehaviour { ...@@ -36,22 +34,10 @@ public class PlayerAttack : MonoBehaviour {
{ {
SetTimeText(comboTime, comboEndTime - Time.time); SetTimeText(comboTime, comboEndTime - Time.time);
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
attackRaw[i] = Input.GetAxisRaw("Fire" + (i+1)); attack[i] = Input.GetButtonDown("Fire" + (i+1));
cancelRaw = Input.GetAxisRaw("Stop"); cancel = Input.GetButtonDown("Stop");
for (int i = 0; i < 3; i++) if (cancel)
{
if (attackRaw[i] > 0 && attackKeyState[i] < 2)
attackKeyState[i]++;
else if (attackRaw[i] == 0)
attackKeyState[i] = 0;
}
if (cancelRaw > 0 && cancelKeyState < 2)
cancelKeyState++;
else if (cancelRaw == 0)
cancelKeyState = 0;
if (cancelKeyState == 1)
{ {
comboTimeOn = false; comboTimeOn = false;
} }
...@@ -59,7 +45,7 @@ public class PlayerAttack : MonoBehaviour { ...@@ -59,7 +45,7 @@ public class PlayerAttack : MonoBehaviour {
if (!playingSkill) if (!playingSkill)
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (attackKeyState[i] == 1) if (attack[i])
{ {
comboArray += (char)('A' + i); comboArray += (char)('A' + i);
CheckCombo(); CheckCombo();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment