Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9039088561
6 changed files with 17 additions and 8 deletions
|
@ -10,7 +10,7 @@ public class Door : MonoBehaviour {
|
|||
BoxCollider2D triggerBox;
|
||||
|
||||
// Use this for initialization
|
||||
void Start() {
|
||||
void Awake() {
|
||||
BoxCollider2D[] colliders = GetComponents<BoxCollider2D>();
|
||||
foreach ( BoxCollider2D collider in colliders ) {
|
||||
if ( collider.isTrigger ) {
|
||||
|
@ -21,7 +21,6 @@ public class Door : MonoBehaviour {
|
|||
//Debug.Log("Found Door collider");
|
||||
}
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -176,7 +176,7 @@ public class GameController : MonoBehaviour {
|
|||
spawnpointRoot.transform.position = new Vector3(dg.start.roomPosition.x, dg.start.roomPosition.y, 0);
|
||||
GameObject spawn = new GameObject();
|
||||
spawn.transform.SetParent(spawnpointRoot.transform);
|
||||
spawn.transform.position = new Vector3(3, 3, 0);
|
||||
spawn.transform.position = new Vector3(dg.start.GetCenter().x, dg.start.GetCenter().y, 0);
|
||||
start.SetSpawnPointsRootObject(spawnpointRoot);
|
||||
|
||||
start.Reload();
|
||||
|
|
|
@ -24,6 +24,9 @@ public class EntityObjective : Objective {
|
|||
/// </summary>
|
||||
/// <param name="ply">Player</param>
|
||||
public override void ActivateGoal(Player ply) {
|
||||
if ( activated )
|
||||
return;
|
||||
activated = true;
|
||||
base.ActivateGoal(ply);
|
||||
foreach ( GameObject i in prefabList ) {
|
||||
Debug.Log("[ROOMS] Spawning Entity...");
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
public abstract class Objective {
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class Objective {
|
||||
protected Room room;
|
||||
protected Player player;
|
||||
bool activated;
|
||||
bool finished;
|
||||
protected bool activated;
|
||||
protected bool finished;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new Objective instance.
|
||||
|
@ -34,6 +36,7 @@
|
|||
protected virtual void ReachedGoal() {
|
||||
finished = true;
|
||||
room.Unlock();
|
||||
Debug.Log("[ROOM] Goal reached. Doors will open.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -20,11 +20,14 @@ public class StartObjective : Objective {
|
|||
/// </summary>
|
||||
/// <param name="ply">Player is ignored </param>
|
||||
public override void ActivateGoal(Player player) {
|
||||
if ( activated )
|
||||
return;
|
||||
if ( room.GetSpawnpoints().Count > 0 ) {
|
||||
GameObject ply = GameObject.Instantiate(playerPrefab);
|
||||
ply.transform.position = room.GetSpawnpoints()[0].position;
|
||||
player = ply.GetComponent<Player>();
|
||||
base.ActivateGoal(player);
|
||||
UpdateGoal();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class Room : MonoBehaviour {
|
|||
private Objective objective;
|
||||
|
||||
// Use this for initialization
|
||||
void Start() {
|
||||
void Awake() {
|
||||
doors = new List<Door>();
|
||||
if ( doorsRootObject != null ) {
|
||||
foreach ( Door d in doorsRootObject.GetComponentsInChildren<Door>() ) {
|
||||
|
@ -38,7 +38,7 @@ public class Room : MonoBehaviour {
|
|||
}
|
||||
//Debug.Log("[ROOMS] Spawnpoints: " + spawnpoints.Count);
|
||||
}
|
||||
//Unlock();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,6 +62,7 @@ public class Room : MonoBehaviour {
|
|||
}
|
||||
//Debug.Log("[ROOMS] Spawnpoints: " + spawnpoints.Count);
|
||||
}
|
||||
Unlock(); // Ok to do so?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Reference in a new issue