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

플레이어 공격에도 GetButton 사용

parent e3a994bf
......@@ -4,10 +4,8 @@ using UnityEditor.Animations;
using UnityEngine;
using UnityEngine.UI;
public class PlayerAttack : MonoBehaviour {
public float[] attackRaw = new float[3];
public int[] attackKeyState = new int[3]; //0: released 1: push 2: pushing
public float cancelRaw;
public int cancelKeyState;
public bool[] attack = new bool[3];
public bool cancel;
public bool playingSkill;
public float comboTime;
public Text time, combo;
......@@ -36,22 +34,10 @@ public class PlayerAttack : MonoBehaviour {
{
SetTimeText(comboTime, comboEndTime - Time.time);
for (int i = 0; i < 3; i++)
attackRaw[i] = Input.GetAxisRaw("Fire" + (i+1));
cancelRaw = Input.GetAxisRaw("Stop");
attack[i] = Input.GetButtonDown("Fire" + (i+1));
cancel = Input.GetButtonDown("Stop");
for (int i = 0; i < 3; i++)
{
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)
if (cancel)
{
comboTimeOn = false;
}
......@@ -59,7 +45,7 @@ public class PlayerAttack : MonoBehaviour {
if (!playingSkill)
{
for (int i = 0; i < 3; i++)
if (attackKeyState[i] == 1)
if (attack[i])
{
comboArray += (char)('A' + i);
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