Finished secretary
This commit is contained in:
24
Assets/Scripts/Animation/AnimationEvents.cs
Normal file
24
Assets/Scripts/Animation/AnimationEvents.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using Core.Lifecycle;
|
||||
using Core.SaveLoad;
|
||||
|
||||
public class AnimationEvents : ManagedBehaviour
|
||||
{
|
||||
[HideInInspector]
|
||||
public AppleMachine stateMachine;
|
||||
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
stateMachine = GetComponentInParent<AppleMachine>();
|
||||
if (stateMachine == null)
|
||||
{
|
||||
Debug.Log($"[AnimationEvent] Animated state {name} does not have a valid state machine!");
|
||||
}
|
||||
}
|
||||
|
||||
public void AnimSwitchState(string stateToGoTo)
|
||||
{
|
||||
stateMachine.ChangeState(stateToGoTo);
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/Animation/AnimationEvents.cs.meta
Normal file
2
Assets/Scripts/Animation/AnimationEvents.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7d19342242409e4583ce050712ec0c5
|
||||
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using Core.Lifecycle;
|
||||
using Core.SaveLoad;
|
||||
using System.Collections;
|
||||
|
||||
public class CanStealFlowerStateBehaviour : AppleState
|
||||
{
|
||||
public ReceptionistBehaviour receptionistObject;
|
||||
|
||||
public override void OnEnterState()
|
||||
{
|
||||
|
||||
StartCoroutine(holdStateForSeconds(receptionistObject.holdFlowerDuration));
|
||||
}
|
||||
|
||||
public override void OnRestoreState(string data)
|
||||
{
|
||||
base.OnRestoreState(data);
|
||||
StartCoroutine(holdStateForSeconds(receptionistObject.holdFlowerDuration));
|
||||
}
|
||||
|
||||
IEnumerator holdStateForSeconds(int seconds)
|
||||
{
|
||||
yield return new WaitForSeconds(seconds);
|
||||
ChangeState("ThrowAwayFlower");
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c58863fe98ab1064883ff19770b1fe73
|
||||
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
using Core.Lifecycle;
|
||||
using Core.SaveLoad;
|
||||
|
||||
public class ReceptionistBehaviour : MonoBehaviour
|
||||
{
|
||||
public int holdFlowerDuration;
|
||||
public bool flowerWasStolen;
|
||||
|
||||
public void FlowerHasBeenStolen()
|
||||
{
|
||||
flowerWasStolen = true;
|
||||
GetComponentInChildren<AppleMachine>().ChangeState("FlowerWasStolen");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09b8ca1e43adc5d479def14f3927b5bb
|
||||
Reference in New Issue
Block a user