start dealing with corutines
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Bed : BaseInteractableObject
|
||||
{
|
||||
@@ -8,9 +8,17 @@ public class Bed : BaseInteractableObject
|
||||
public override void Interact(Player player)
|
||||
{
|
||||
_player=player;
|
||||
Debug.Log("Sitting");
|
||||
player.SetPlayerAnimation(AnimationStates.Sitting);
|
||||
StartCoroutine(Sleep());
|
||||
}
|
||||
|
||||
private IEnumerator Sleep()
|
||||
{
|
||||
_player.SetPlayerAnimation(AnimationStates.Sitting);
|
||||
yield return StartCoroutine(_player.IsAnimationStatePlaying(0));
|
||||
print("sitting animation finished");
|
||||
TimeManager.Instance.FastForward(TimeSpan.FromHours(8), OnFastForwardEnd);
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
private void OnFastForwardEnd()
|
||||
|
||||
Reference in New Issue
Block a user