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/PlayerControlBase")]
- [Tooltip("Notify game character on attack end. ")]
- public class CF_attack_end_notify : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(PlayerControlBase))]
- public FsmOwnerDefault gameObject;
- [ObjectType(typeof(IGameCharacter))]
- public FsmObject attacker;
- public FsmInt attackType;
- public FsmBool everyFrame;
- PlayerControlBase theScript;
- public override void Reset()
- {
- gameObject = null;
- attacker = null;
- attackType = null;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<PlayerControlBase>();
- 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 cAttacker = attacker.Value as IGameCharacter;
- if (cAttacker == null)
- {
- return;
- }
- theScript.attack_end_notify(cAttacker, attackType.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement