Skip to content
This repository has been archived by the owner on Aug 31, 2019. It is now read-only.

Commit

Permalink
ixtab lmao
Browse files Browse the repository at this point in the history
  • Loading branch information
ferociouself committed May 4, 2017
1 parent cda7af3 commit b928684
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@ public class IxtabInvisible : StateMachineBehaviour {

IxtabAI ai;

float invisTimer = 0.0f;
float maxTimer = 10.0f;

// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
ai = animator.transform.parent.GetComponent<IxtabAI>();
ai.GetComponent<Animator>().SetBool("Invisible", true);
ai.setInvisible(true);
invisTimer = 0.0f;
}

// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
if (stateInfo.IsName("Invisible_2")) {
if (ai.GetNumActiveMinions() == 0) {
if (invisTimer > maxTimer) {
animator.SetTrigger("Choke");
} else {
invisTimer += Time.deltaTime;
}
}
if (Random.Range(0.0f, 1.0f) > 0.9f) {
Expand Down

0 comments on commit b928684

Please sign in to comment.