Hi!
I want the enemy to spawn at random inside my maze that I have done… as it is right now the enemy spawns at the same place all the time. Im not sure how to prolong with the code…
Here is my code.
using UnityEngine;
public class Target : MonoBehaviour {
private Vector3 startPosition;
private Quaternion startRotation;
private float startHealth;
public float health = 50f;
public void Start() {
startHealth = health;
startPosition = transform.position;
startRotation = transform.rotation;
}
public void TakeDamage ( float amount) {
health -= amount;
if (health <= 0f) {
KillAndReset();
}
}
public void KillAndReset() {
health = startHealth;
transform.position = startPosition;
transform.rotation = startRotation;
}
}