Added objective-classes
This commit is contained in:
parent
f5d75b7a35
commit
86c95a05ae
3 changed files with 55 additions and 9 deletions
35
Assets/Scripts/Objectives/EntityObjective.cs
Normal file
35
Assets/Scripts/Objectives/EntityObjective.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class EntityObjective : Objective{
|
||||||
|
List<Entity> entityList;
|
||||||
|
List<Transform> spawnPointList;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
public EntityObjective(Room objectiveCaller, List<Entity> entityList) : base(objectiveCaller)
|
||||||
|
{
|
||||||
|
this.entityList = entityList;
|
||||||
|
this.spawnPointList = spawnPointList;
|
||||||
|
spawnPointList = objectiveCaller.GetSpawnpoints ();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activates the objective to start progresstracking
|
||||||
|
public void Activate()
|
||||||
|
{
|
||||||
|
Random newRand = new Random ();
|
||||||
|
|
||||||
|
foreach(Entity i : entityList)
|
||||||
|
i.Spawn(spawnPointList[Random.Range(0, spawnPointList.Count)]);
|
||||||
|
|
||||||
|
objectiveCaller.Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removes the entity from the list and completes the objective, if the list is empty
|
||||||
|
public void Remove(Entity inputEntity)
|
||||||
|
{
|
||||||
|
entityList.Remove (inputEntity);
|
||||||
|
if (entityList.Count == 0)
|
||||||
|
objectiveCaller.Unlock ();
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Objectives/EntityObjective.cs.meta
Normal file
11
Assets/Scripts/Objectives/EntityObjective.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 566ba096ee42e114a9c0343e24a71992
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -2,15 +2,15 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Objective : MonoBehaviour {
|
public abstract class Objective {
|
||||||
|
protected Room objectiveCaller;
|
||||||
// Use this for initialization
|
|
||||||
void Start () {
|
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
public Objective(Room objectiveCaller)
|
||||||
|
{
|
||||||
|
this.objectiveCaller = objectiveCaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Activates the objective to start progresstracking
|
||||||
void Update () {
|
public virtual void Activate(){}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue