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;
- using MLSpace;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory("CombatFramework/NPCGuardZone")]
- [Tooltip("Add npc to lists. ")]
- public class CF_addToZone : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(NPCGuardZone))]
- public FsmOwnerDefault gameObject;
- [ObjectType(typeof(NPCScript))]
- public FsmObject npc;
- public FsmBool everyFrame;
- NPCGuardZone theScript;
- public override void Reset()
- {
- gameObject = null;
- npc = null;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<NPCGuardZone>();
- if (!everyFrame.Value)
- {
- DoTheMethod();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMethod();
- }
- }
- void DoTheMethod()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- var cNpc = npc.Value as NPCScript;
- if (cNpc == null)
- {
- return;
- }
- theScript.addToZone(cNpc);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement