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