Commit 5f74a86d authored by Andrew's avatar Andrew

Merge branch 'EnemyRanged' of https://git.gmu.edu/gadig/necronomiconn.git into EnemyRanged

parents 7ee47c8b c575b2af
......@@ -48,6 +48,8 @@ public class EnemyRanged : MonoBehaviour
void Update()
{
LookAtPlayer();
DecideToMove();
CheckHealth();
}
......@@ -66,21 +68,30 @@ public class EnemyRanged : MonoBehaviour
void DecideToMove()
{
// Call this function every frame to compare distance from Player before choosing to Move(), Aim(), as well as Teleport().
// "Vector3.Distance" or "(vector_A - vector_B).magnitude" to get distance between two Transforms
}
// Call this function every frame to compare distance from Player before choosing to Move(), Aim(), as well as Teleport().
// "Vector3.Distance" or "(vector_A - vector_B).magnitude" to get distance between two Transforms
if (Vector3.Distance(player.transform.position, this.transform.position) > teleportDecisionThreshold)
{
Teleport();
}
else if (Vector3.Distance(player.transform.position, this.transform.position) > moveDecisionThreshold)
{
Move();
}
}
void Move()
{
// Call this function if EnemyRanged has decided to move towards the Player.
// Various ways to do this, such as "Vector3.MoveTowards" or "Vector3.Lerp"
// Call this function if EnemyRanged has decided to move towards the Player.
// Various ways to do this, such as "Vector3.MoveTowards" or "Vector3.Lerp"
this.transform.position = Vector3.MoveTowards(this.transform.position, player.transform.position, moveSpeed * Time.deltaTime);
Debug.Log(this.name + " is moving!");
}
void Teleport()
{
// Call this function if Player is over "teleportDecisionThreshold" distance away from EnemyRanged.
// Call this function if Player is over "teleportDecisionThreshold" distance away from EnemyRanged.
this.transform.position = Vector3.MoveTowards(this.transform.position, player.transform.position, moveSpeed);
Debug.Log(this.name + " teleported!");
}
#endregion
......@@ -107,15 +118,14 @@ public class EnemyRanged : MonoBehaviour
#region health
void CheckHealth()
{
// Call this function every frame for conditionals based on remaining health, such as Die().
// Call this function every frame for conditionals based on remaining health, such as Die().
if (health <= 0) { Die(); }
}
void Die()
{
// Call this function when health hits 0 -
// add X "insanityRefillAmount" to player's Insanity and have a Y percent "chanceToDropAmmo" of dropping "ammoPrefab"
//player.insanity += insanityRefill; //we don't have a specific name for the Player's insanity variable yet, "player.insanity" is filler. Once we do, add "insanityRefill" to it.
Debug.Log(this.name + " died!");
}
......
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