//Darkhitori v1.0 using System.Collections; using System.Collections.Generic; using UnityEngine; using Invector.ItemManager; namespace HutongGames.PlayMaker.Actions { [ActionCategory("Invector/vItemManager")] [Tooltip(" ")] public class vIM_DropItem : FsmStateAction { [RequiredField] [CheckForComponent(typeof(vItemManager))] public FsmOwnerDefault gameObject; [ObjectType(typeof(vItem))] public FsmObject item; public FsmInt amount; public FsmBool everyFrame; vItemManager theScript; public override void Reset() { gameObject = null; item = null; amount = null; everyFrame = true; } public override void OnEnter() { var go = Fsm.GetOwnerDefaultTarget(gameObject); theScript = go.GetComponent(); if (!everyFrame.Value) { DoTheMagic(); Finish(); } } public override void OnUpdate() { if (everyFrame.Value) { DoTheMagic(); } } void DoTheMagic() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } var iItem = item.Value as vItem; if (iItem == null) { return; } theScript.DropItem(iItem, amount.Value); } } }