mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-25 17:40:59 +00:00
Add mom's ability to spot the children who are not sleeping when she
enters the room
This commit is contained in:
parent
0a1931c7d0
commit
5413a3bf20
Binary file not shown.
@ -15,6 +15,15 @@ public class Child : MonoBehaviour
|
|||||||
private float _zValue;
|
private float _zValue;
|
||||||
private bool _isSleeping;
|
private bool _isSleeping;
|
||||||
|
|
||||||
|
private int _index;
|
||||||
|
|
||||||
|
public int Index
|
||||||
|
{
|
||||||
|
get { return _index; }
|
||||||
|
set { _index = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool IsSleeping
|
public bool IsSleeping
|
||||||
{
|
{
|
||||||
get { return _isSleeping; }
|
get { return _isSleeping; }
|
||||||
@ -28,8 +37,6 @@ public class Child : MonoBehaviour
|
|||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
_isGrounded = IsGrounded();
|
_isGrounded = IsGrounded();
|
||||||
|
|
||||||
Debug.Log(_isGrounded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTriggerEnter(Collider other) {
|
void OnTriggerEnter(Collider other) {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ public class ChildController : MonoBehaviour
|
|||||||
InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerButtons);
|
InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerButtons);
|
||||||
|
|
||||||
_child = GetComponent<Child>();
|
_child = GetComponent<Child>();
|
||||||
|
_child.Index = (int)PlayerNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandlePlayerAxis(MappedInput input)
|
private void HandlePlayerAxis(MappedInput input)
|
||||||
|
|||||||
@ -36,6 +36,16 @@ public class MomBehavior : MonoBehaviour
|
|||||||
WarningText.gameObject.SetActive(false);
|
WarningText.gameObject.SetActive(false);
|
||||||
_nextTriggerTime = GetNextTriggerTime();
|
_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;
|
_elapsedTime = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user