Files

33 lines
635 B
C#
Raw Permalink Normal View History

2025-05-13 05:18:03 +03:00
using UnityEngine;
using System.Collections;
public interface ISpawner{
void Respawn ();
}
public class Spawner : MonoBehaviour, ISpawner {
public bool spawnOnStart = true;
public GameObject source;
// Use this for initialization
void Start () {
if (spawnOnStart) {
Respawn();
}
}
// Update is called once per frame
void Update () {
}
public void Respawn(){
GameObject obj = (GameObject)Instantiate (source);
RespawnNotify notify = obj.AddComponent<RespawnNotify> ();
notify.spawner = this;
notify.destroyOnRespawn = true;
obj.transform.position = transform.position;
obj.SetActive (true);
}
}