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 XftWeapon;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory("XWeaponTrail")]
- [Tooltip("you may pre-init the trail to save some performance. ")]
- public class XWT_Init : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(XWeaponTrail))]
- public FsmOwnerDefault gameObject;
- public FsmBool everyFrame;
- XWeaponTrail theScript;
- public override void Reset()
- {
- gameObject = null;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<XWeaponTrail>();
- 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.Init();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement