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;
- using UnityEngine.AI;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory("CombatFramework/NPCManager")]
- [Tooltip("Provides info is any npc in combat in current zone. ")]
- public class CF_AnyNpcInCombatInZone : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(NPCManager))]
- public FsmOwnerDefault gameObject;
- [ObjectType(typeof(NPCScript))]
- public FsmObject caller;
- [ActionSection("Return")]
- [UIHint(UIHint.FsmBool)]
- public FsmBool anyNpcInCombatInZone;
- public FsmBool everyFrame;
- NPCManager theScript;
- public override void Reset()
- {
- gameObject = null;
- caller = null;
- anyNpcInCombatInZone = false;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<NPCManager>();
- 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 cCaller = caller.Value as NPCScript;
- if (cCaller == null)
- {
- return;
- }
- anyNpcInCombatInZone.Value = theScript.AnyNpcInCombatInZone(cCaller);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement