mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-24 00:50:59 +00:00
Add the Awake/Sleep contexts
This commit is contained in:
parent
2af4b94ddc
commit
a3fe31e09b
@ -83,9 +83,16 @@ public class Child : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void Sleep()
|
||||
public bool Sleep()
|
||||
{
|
||||
_isSleeping = IsOnBed();
|
||||
|
||||
return _isSleeping;
|
||||
}
|
||||
|
||||
public void WakeUp()
|
||||
{
|
||||
_isSleeping = false;
|
||||
}
|
||||
|
||||
private bool IsOnBed()
|
||||
|
||||
@ -58,9 +58,14 @@ public class ChildController : MonoBehaviour
|
||||
_child.Jump();
|
||||
}
|
||||
|
||||
if (input.Actions.Contains("Sleep"))
|
||||
if (input.Actions.Contains("Sleep") && _child.Sleep())
|
||||
{
|
||||
_child.Sleep();
|
||||
InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
|
||||
}
|
||||
else if (input.Actions.Contains("WakeUp"))
|
||||
{
|
||||
_child.WakeUp();
|
||||
InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user