Locked cursor during attack animations so user can't screw up animations while they are running

This commit is contained in:
Gregory Campbell
2020-04-28 20:20:32 -04:00
parent 5c003812e0
commit 7efe7b80fc
+21
View File
@@ -36,6 +36,7 @@ public class GMScript : MonoBehaviour
public Sprite[] Symbols; public Sprite[] Symbols;
private bool cursorLock = false;
private bool noRepeat = true; private bool noRepeat = true;
private bool shield = false; private bool shield = false;
private bool enemyShield = false; private bool enemyShield = false;
@@ -147,11 +148,15 @@ public class GMScript : MonoBehaviour
if(hit.collider.gameObject.tag == "Attack" && PartyMemberOrder[0] != null) if(hit.collider.gameObject.tag == "Attack" && PartyMemberOrder[0] != null)
{ {
cursorLock = true;
StartCoroutine(AttackParty(robotColour)); StartCoroutine(AttackParty(robotColour));
} else if (hit.collider.gameObject.tag == "Attack" } else if (hit.collider.gameObject.tag == "Attack"
&& PartyMemberOrder[0] == null) { && PartyMemberOrder[0] == null) {
cursorLock = true;
StartCoroutine(AttackStop()); StartCoroutine(AttackStop());
} }
@@ -190,6 +195,19 @@ public class GMScript : MonoBehaviour
} }
if(cursorLock)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
} else {
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
} }
void CheckParty(GameObject member) void CheckParty(GameObject member)
@@ -291,6 +309,7 @@ public class GMScript : MonoBehaviour
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1);
AttackStopSign.SetActive(false); AttackStopSign.SetActive(false);
cursorLock = false;
} }
@@ -843,6 +862,8 @@ public class GMScript : MonoBehaviour
{ {
yield return StartCoroutine(HitEffectEnemy(0, EnemyPartsColours[0])); yield return StartCoroutine(HitEffectEnemy(0, EnemyPartsColours[0]));
} }
cursorLock = false;
} }
void EnemyBuilder() void EnemyBuilder()