Skip to content

Commit

Permalink
Updated Readme & Enemies do Contact Damage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Retl committed Apr 6, 2014
1 parent 36eb7cf commit 9d6b9a1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 11 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -5,6 +5,17 @@ The Seas Have Eyes is a first-person arcade horror game developed by Blue Husky


*REMEMBER: When running in the preview window in Unity, use ctrl+p to start and stop, as the cursor will be locked.* *REMEMBER: When running in the preview window in Unity, use ctrl+p to start and stop, as the cursor will be locked.*


*Controls*

* Keyboard WASD – Forward, Left strafe, Backward, Right strafe (respectively)
* Keyboard Shift – Boost (takes up stamina)
* Keyboard Space - Swim up. (Kinda like an infinite jump.)
* Keyboard Ctrl – Brake
* Mouse movement – Pitch, yaw
* Mouse left click – Forward
* Mouse right click - Attack
* Mouse middle click - Change Movement Style

*Credits* *Credits*
* Programming: https://github.com/Supuhstar & https://github.com/Retl * Programming: https://github.com/Supuhstar & https://github.com/Retl
* Grahpical Assets: https://github.com/Supuhstar & https://github.com/Retl * Grahpical Assets: https://github.com/Supuhstar & https://github.com/Retl
Expand Down
Expand Up @@ -46,7 +46,11 @@ void OnTriggerStay(Collider other)
{ {
print("Trigger Stay by: " + other.ToString()); print("Trigger Stay by: " + other.ToString());
} }
PlayerController playerController = other.transform.parent.GetComponent<PlayerController>();
PlayerController playerController;

//If the parent of the object we're colliding with is the player, Check to see if we are looking at eachother before dealing damage.
playerController = other.transform.parent.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.attackCooldownTime <= 0) if (playerController != null && genericEnemy.attackCooldownTime <= 0)
{ {
genericEnemy.SmoothLookAt(playerController.transform.position); genericEnemy.SmoothLookAt(playerController.transform.position);
Expand All @@ -56,6 +60,16 @@ void OnTriggerStay(Collider other)
genericEnemy.attackCooldownTime = attackRate; //Wait one second before able to attack again. genericEnemy.attackCooldownTime = attackRate; //Wait one second before able to attack again.
} }
} }

//If the object we're colliding with is the player, immediately attempt to deal damage.
playerController = other.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.attackCooldownTime <= 0)
{
genericEnemy.SmoothLookAt(playerController.transform.position);
playerController.TakeDamage(DAMAGE);
genericEnemy.attackCooldownTime = attackRate; //Wait one second before able to attack again.
}

} }
} }


Expand Down
Expand Up @@ -47,16 +47,29 @@ void OnTriggerStay(Collider other)
{ {
print("Trigger Stay by: " + other.ToString()); print("Trigger Stay by: " + other.ToString());
} }
PlayerController playerController = other.transform.parent.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.attackCooldownTime <= 0) PlayerController playerController;
{
genericEnemy.SmoothLookAt(playerController.transform.position); //If the parent of the object we're colliding with is the player, Check to see if we are looking at eachother before dealing damage.
if (genericEnemy.IsFacingPlayer(attackRange)) playerController = other.transform.parent.GetComponent<PlayerController>();
{ if (playerController != null && genericEnemy.attackCooldownTime <= 0)
playerController.TakeDamage(DAMAGE); {
genericEnemy.attackCooldownTime = attackRate; //Wait one second before able to attack again. genericEnemy.SmoothLookAt(playerController.transform.position);
} if (genericEnemy.IsFacingPlayer(attackRange))
} {
playerController.TakeDamage(DAMAGE);
genericEnemy.attackCooldownTime = attackRate; //Wait one second before able to attack again.
}
}

//If the object we're colliding with is the player, immediately attempt to deal damage.
playerController = other.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.attackCooldownTime <= 0)
{
genericEnemy.SmoothLookAt(playerController.transform.position);
playerController.TakeDamage(DAMAGE);
genericEnemy.attackCooldownTime = attackRate; //Wait one second before able to attack again.
}
} }
} }


Expand Down
21 changes: 21 additions & 0 deletions Unity Project/Assets/TSHE_Scripts/PlayerController.cs
Expand Up @@ -235,6 +235,27 @@ void HandlePlayerInput()
* Mouse right click - Attack? Or is attacking automatic? - Moore * Mouse right click - Attack? Or is attacking automatic? - Moore
*/ */


//Misc Options Section
if (Input.GetButtonDown("Fire2"))
{
//If the player just used Fire2 (Middleclick) change the movement control style to the next level up. This may be better suited to an on screen button or options menu.
switch (controlStyle)
{
case ControlStyle.Advanced:
controlStyle = ControlStyle.Basic;
break;
case ControlStyle.Basic:
controlStyle = ControlStyle.Normal;
break;
case ControlStyle.Normal:
controlStyle = ControlStyle.Advanced;
break;

default:
break;
}
}

//Movement Section //Movement Section


gamepadLeftHorizontalOffset = Input.GetAxis("Horizontal"); gamepadLeftHorizontalOffset = Input.GetAxis("Horizontal");
Expand Down

0 comments on commit 9d6b9a1

Please sign in to comment.