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/Player")]
- [Tooltip("Control player. ")]
- public class CF_control : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(Player))]
- public FsmOwnerDefault gameObject;
- public enum Control
- {
- horiz_vert_speed_jump_dive_crouch_bodyLookDirection_diveDirection_side,
- move_speed_jump_dive_crouch_bodyLookDirection_diveDirection_side
- }
- public Control methods;
- public FsmFloat horiz;
- public FsmFloat vert;
- public FsmVector3 move;
- public FsmFloat speed;
- public FsmBool jump;
- public FsmBool dive;
- public FsmBool crouch;
- public FsmVector3 bodyLookDirection;
- public FsmVector3 diveDirection;
- public FsmFloat side;
- public FsmBool everyFrame;
- Player theScript;
- public override void Reset()
- {
- gameObject = null;
- methods = Control.horiz_vert_speed_jump_dive_crouch_bodyLookDirection_diveDirection_side;
- horiz = null;
- vert = null;
- move = new Vector3(0,0,0);
- speed = null;
- jump = false;
- dive = false;
- crouch = false;
- bodyLookDirection = new Vector3(0,0,0);
- diveDirection = new Vector3(0,0,0);
- side = null;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<Player>();
- if (!everyFrame.Value)
- {
- DoTheMethod();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMethod();
- }
- }
- void DoTheMethod()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- switch(methods)
- {
- case Control.horiz_vert_speed_jump_dive_crouch_bodyLookDirection_diveDirection_side:
- theScript.control(horiz.Value,
- vert.Value,
- speed.Value,
- jump.Value,
- dive.Value,
- crouch.Value,
- bodyLookDirection.Value,
- diveDirection.Value,
- side.Value);
- break;
- case Control.move_speed_jump_dive_crouch_bodyLookDirection_diveDirection_side:
- theScript.control(move.Value,
- speed.Value,
- jump.Value,
- dive.Value,
- crouch.Value,
- bodyLookDirection.Value,
- diveDirection.Value,
- side.Value);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement