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/TPCharacter")]
- [Tooltip("Apply extra rotation for faster turning. ")]
- public class CF_applyExtraTurnRotation : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(TPCharacter))]
- public FsmOwnerDefault gameObject;
- public FsmFloat extraSpeed;
- public FsmBool everyFrame;
- TPCharacter theScript;
- public override void Reset()
- {
- gameObject = null;
- extraSpeed = 1.0f;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<TPCharacter>();
- if (!everyFrame.Value)
- {
- DoTheMethod();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMethod();
- }
- }
- void DoTheMethod()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- theScript.applyExtraTurnRotation(extraSpeed.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement