2018-04-21 12:22:17 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2018-04-21 16:20:38 +02:00
|
|
|
|
public abstract class Entity {
|
2018-04-21 16:12:04 +02:00
|
|
|
|
EntityObjective referringObjective;
|
|
|
|
|
GameObject entityPrefab;
|
|
|
|
|
GameObject instance;
|
2018-04-21 12:22:17 +02:00
|
|
|
|
|
2018-04-21 16:12:04 +02:00
|
|
|
|
// Constructor
|
|
|
|
|
public Entity(EntityObjective referringObjective, GameObject entityPrefab)
|
|
|
|
|
{
|
|
|
|
|
this.referringObjective = referringObjective;
|
|
|
|
|
this.entityPrefab = entityPrefab;
|
2018-04-21 12:22:17 +02:00
|
|
|
|
}
|
2018-04-21 16:12:04 +02:00
|
|
|
|
|
|
|
|
|
// spawns the entity
|
|
|
|
|
public void Spawn(Transform spawnPoint)
|
|
|
|
|
{
|
2018-04-21 16:18:16 +02:00
|
|
|
|
// instance = GameObject.Instantiate (entityPrefab);
|
|
|
|
|
// instance.transform = spawnPoint;
|
2018-04-21 16:12:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// kills the entity
|
|
|
|
|
public void Kill()
|
|
|
|
|
{
|
|
|
|
|
GameObject.Destroy (instance);
|
|
|
|
|
referringObjective.Remove (this);
|
|
|
|
|
|
|
|
|
|
instance = null;
|
2018-04-21 12:22:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|