Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Darkhitori v1.0
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory("Emerald AI")]
- [Tooltip(" ")]
- public class EAI_AIReachedDestination : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(Emerald_AI))]
- public FsmOwnerDefault gameObject;
- [ActionSection("Return")]
- [UIHint(UIHint.FsmBool)]
- public FsmBool aIReachedDestination;
- public FsmBool everyFrame;
- Emerald_AI theScript;
- public override void Reset()
- {
- gameObject = null;
- aIReachedDestination = false;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<Emerald_AI>();
- if (!everyFrame.Value)
- {
- DoTheMagic();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMagic();
- }
- }
- void DoTheMagic()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- aIReachedDestination.Value = theScript.AIReachedDestination;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement