Add mom's ability to spot the children who are not sleeping when she

enters the room
This commit is contained in:
Patrice Vignola 2015-08-22 04:34:26 -04:00
parent 0a1931c7d0
commit 5413a3bf20
4 changed files with 20 additions and 2 deletions

Binary file not shown.

View File

@ -15,6 +15,15 @@ public class Child : MonoBehaviour
private float _zValue;
private bool _isSleeping;
private int _index;
public int Index
{
get { return _index; }
set { _index = value; }
}
public bool IsSleeping
{
get { return _isSleeping; }
@ -28,8 +37,6 @@ public class Child : MonoBehaviour
void Update()
{
_isGrounded = IsGrounded();
Debug.Log(_isGrounded);
}
void OnTriggerEnter(Collider other) {

View File

@ -18,6 +18,7 @@ public class ChildController : MonoBehaviour
InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerButtons);
_child = GetComponent<Child>();
_child.Index = (int)PlayerNumber;
}
private void HandlePlayerAxis(MappedInput input)

View File

@ -36,6 +36,16 @@ public class MomBehavior : MonoBehaviour
WarningText.gameObject.SetActive(false);
_nextTriggerTime = GetNextTriggerTime();
foreach (Child child in Children)
{
if (!child.IsSleeping)
{
// TODO: Do something (end the game? kill the player? make him lose 1 life? etc.)
Debug.Log("Child " + child.Index + " got found by Mommy.");
}
}
_elapsedTime = 0f;
}
}