So I have a zombie arcade game in 3d, zombies can die, i do dmage, they fallow me, alls good. I Besides I need the zeds to be able to kill me as in 4 hits to me ends the game and switches to a GAME OVER scene. doesnt sound too complicated but ive been stuggling with this for the past 2 weeks. Also I would like if on each of the 4 hits blood goes on the screen and it gets redder (like in cod haha). Thanks anyone who helps!
Heres my EnemyController Script:
using UnityEngine;
using System.Collections;
using UnityEngine.AI;
public class EnemyController : MonoBehaviour {
NavMeshAgent nav;
Transform player;
Animator Controller;
// Use this for initialization
void Awake () {
nav = GetComponent <NavMeshAgent> ();
player = GameObject.FindGameObjectWithTag ("Player").transform;
Controller = GetComponentInParent<Animator> ();
}
// Update is called once per frame
void Update () {
nav.SetDestination (player.position);
Controller.SetFloat ("speed", Mathf.Abs (nav.velocity.x + nav.velocity.z));
}
}
HERES MY GAME MANAGMENT SCRIPT IF YOU MAY NEED IT?
using System.Collections;
using UnityEngine;
public class GameManagment : MonoBehaviour {
public int round = 1;
int zombiesInRound = 10000000;
int zombiesSpawnedInRound = 0;
float zombieSpawnTimer = 0;
public Transform[] zombieSpawnPoints;
public GameObject zombieEnemy;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (zombiesSpawnedInRound < zombiesInRound)
{
if (zombieSpawnTimer > 2.1)
{
SpawnZombie ();
zombieSpawnTimer = 0;
}
else
{
zombieSpawnTimer += Time.deltaTime;
}
}
}
void SpawnZombie()
{
Vector3 randomSpawnPoint = zombieSpawnPoints [Random.Range (0, zombieSpawnPoints.Length)].position;
Instantiate(zombieEnemy, randomSpawnPoint, Quaternion.identity);
zombiesSpawnedInRound++;
}
}