Pigman levelswitch implement
This commit is contained in:
29
Assets/Scripts/StateMachines/Dump/PigManBehaviour.cs
Normal file
29
Assets/Scripts/StateMachines/Dump/PigManBehaviour.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class PigManBehaviour : MonoBehaviour
|
||||
{
|
||||
private Animator _animator;
|
||||
public bool canEatCards;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
canEatCards = true;
|
||||
StartCoroutine(CheckIfShouldEatCard(2));
|
||||
_animator = GetComponent<Animator>();
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator CheckIfShouldEatCard(float seconds)
|
||||
{
|
||||
while(canEatCards)
|
||||
{
|
||||
yield return new WaitForSeconds(seconds);
|
||||
if (Random.value < 0.62f)
|
||||
{
|
||||
_animator.SetTrigger("eatCards");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07f9cf64792aa3e40819a65a1f1a3cc9
|
||||
@@ -44,6 +44,6 @@ public class TrashmazeClosedBehaviour : MonoBehaviour
|
||||
private void GiveCactusTimelineStopped(PlayableDirector director)
|
||||
{
|
||||
_director.stopped -= GiveCactusTimelineStopped;
|
||||
SwapPulverStung();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user