Hello! Sorry if this is a dumb question but i'm new to unity. Right now i have a script that makes the enemies spawn in four positions with a delay, but now i need the enemy to attack the player a couple seconds after it spawns. I'm having trouble doing that, but also when the enemy attacks an image should appear on the screen to make the player realize it has been attack, and i don't know how to do that without a bullet or something that collides with the player. Here's my spawn script
public class TimedSpawn : MonoBehaviour {
public GameObject spawnee;
public bool stopSpawning;
public float spawnTime;
public float spawnDelay;
// Use this for initialization
void Start () {
InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
}
public void SpawnObject (){
Instantiate (spawnee, transform.position, transform.rotation);
if (stopSpawning) {
CancelInvoke ("SpawnObject");
}
}
}
↧