aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'nGJ2019')
-rw-r--r--nGJ2019/Assets/Scripts/DragonMovement.cs20
-rw-r--r--nGJ2019/ProjectSettings/InputManager.asset96
2 files changed, 113 insertions, 3 deletions
diff --git a/nGJ2019/Assets/Scripts/DragonMovement.cs b/nGJ2019/Assets/Scripts/DragonMovement.cs
index f2c1cb5..f3ae1d5 100644
--- a/nGJ2019/Assets/Scripts/DragonMovement.cs
+++ b/nGJ2019/Assets/Scripts/DragonMovement.cs
@@ -14,6 +14,8 @@ public class DragonMovement : MonoBehaviour
public HealthBar healthBar;
+ private float hurtCooldown = 0;
+
private SwarmSystem swarm;
private enum State {normal, swirl, slim, spread};
@@ -169,6 +171,9 @@ public class DragonMovement : MonoBehaviour
void Update()
{
+ if(hurtCooldown < 0)
+ hurtCooldown -= Time.deltaTime;
+
// keyboard scheme
if(Input.GetKey("w"))
moveUp();
@@ -196,11 +201,11 @@ public class DragonMovement : MonoBehaviour
// xbox scheme
- if(Input.GetAxis("JoystickY") > 0.5f)
+ if(Input.GetAxis("JoystickY") < -0.5f)
moveUp();
if(Input.GetAxis("JoystickX") < -0.5f)
moveLeft();
- if(Input.GetAxis("JoystickY") < -0.5f)
+ if(Input.GetAxis("JoystickY") > 0.5f)
moveDown();
if(Input.GetAxis("JoystickX") > 0.5f)
moveRight();
@@ -227,12 +232,21 @@ public class DragonMovement : MonoBehaviour
Gizmos.DrawWireCube(Vector3.zero, new Vector3(2*horizontalBound, 2*verticalBound, 0));
}
+ private void getHurt()
+ {
+ if(hurtCooldown <= 0)
+ {
+ healthBar.health--;
+ hurtCooldown = 3;
+ }
+ }
+
void OnTriggerEnter(Collider other)
{
EnemyCollider enemy = other.gameObject.GetComponent<EnemyCollider>();
if(enemy != null)
{
- healthBar.health--;
+ getHurt();
}
}
diff --git a/nGJ2019/ProjectSettings/InputManager.asset b/nGJ2019/ProjectSettings/InputManager.asset
index 17c8f53..9f66d1f 100644
--- a/nGJ2019/ProjectSettings/InputManager.asset
+++ b/nGJ2019/ProjectSettings/InputManager.asset
@@ -293,3 +293,99 @@ InputManager:
type: 0
axis: 0
joyNum: 0
+ - serializedVersion: 3
+ m_Name: JoystickX
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton:
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1
+ dead: 0.2
+ sensitivity: 1
+ snap: 0
+ invert: 0
+ type: 2
+ axis: 0
+ joyNum: 1
+ - serializedVersion: 3
+ m_Name: JoystickY
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton:
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1
+ dead: 0.2
+ sensitivity: 1
+ snap: 0
+ invert: 0
+ type: 2
+ axis: 1
+ joyNum: 1
+ - serializedVersion: 3
+ m_Name: A
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: joystick button 0
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 1
+ - serializedVersion: 3
+ m_Name: B
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: joystick button 1
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 1
+ - serializedVersion: 3
+ m_Name: X
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: joystick button 2
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 1
+ - serializedVersion: 3
+ m_Name: Y
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: joystick button 3
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 1