Darkhitori

vMeleeManager/SetActiveAttack

Jan 13th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. //Darkhitori v1.0
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using Invector;
  6.  
  7. namespace HutongGames.PlayMaker.Actions
  8. {
  9.     [ActionCategory("Invector/vMeleeManager")]
  10.     [Tooltip("Set active Single Part to attack ")]
  11.     public class vMM_SetActiveAttack : FsmStateAction
  12.     {
  13.         [RequiredField]
  14.         [CheckForComponent(typeof(vMeleeManager))]
  15.         public FsmOwnerDefault gameObject;
  16.        
  17.         public FsmString bodyPart;
  18.         public vAttackType type;
  19.         public FsmBool active;
  20.         public FsmInt damageMultiplier;
  21.         public FsmInt recoilID;
  22.         public FsmInt reactionID;
  23.         public FsmBool ignoreDefense;
  24.         public FsmBool activeRagdoll;
  25.         public FsmString attackName;
  26.         public FsmBool everyFrame;
  27.  
  28.         vMeleeManager theScript;
  29.  
  30.         public override void Reset()
  31.         {
  32.             gameObject = null;
  33.             bodyPart = "";
  34.             type = vAttackType.Unarmed;
  35.             active = true;
  36.             damageMultiplier = null;
  37.             recoilID = null;
  38.             reactionID = null;
  39.             ignoreDefense = false;
  40.             activeRagdoll = false;
  41.             attackName = "";
  42.             everyFrame = true;
  43.         }
  44.        
  45.         public override void OnEnter()
  46.         {
  47.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  48.  
  49.             theScript = go.GetComponent<vMeleeManager>();
  50.  
  51.  
  52.             if (!everyFrame.Value)
  53.             {
  54.                 DoTheMagic();
  55.                 Finish();
  56.             }
  57.  
  58.         }
  59.  
  60.         public override void OnUpdate()
  61.         {
  62.             if (everyFrame.Value)
  63.             {
  64.                 DoTheMagic();
  65.             }
  66.         }
  67.  
  68.         void DoTheMagic()
  69.         {
  70.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  71.             if (go == null)
  72.             {
  73.                 return;
  74.             }
  75.            
  76.             theScript.SetActiveAttack(bodyPart.Value, type, active.Value, damageMultiplier.Value, recoilID.Value, reactionID.Value, ignoreDefense.Value, activeRagdoll.Value, attackName.Value);            
  77.         }
  78.  
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment