void SetModesListeners(MEventListener listener, string EventName, string ModeName) { MEvent e = MalbersTools.GetInstance <MEvent>(EventName); if (listener.Events.Find(item => item.Event == e) == null) { var item = new MEventItemListener() { Event = e, useVoid = true, useInt = true, useBool = true, }; ModeID att2 = MalbersTools.GetInstance <ModeID>(ModeName); UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <ModeID>(item.ResponseBool, Mode_Pin, att2); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseBool, Mode_Pin_Input); UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <ModeID>(item.ResponseInt, Mode_Pin, att2); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseInt, Mode_Pin_Ability); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.Response, Mode_Interrupt); listener.Events.Add(item); Debug.Log("<B>" + EventName + "</B> Added to the Event Listeners"); } }
public override void Reset() { ID = MalbersTools.GetInstance <StateID>("Jump"); Input = "Jump"; SleepFromState = new List <StateID>() { MalbersTools.GetInstance <StateID>("Fall"), MalbersTools.GetInstance <StateID>("Fly") }; SleepFromMode = new List <ModeID>() { MalbersTools.GetInstance <ModeID>("Action"), MalbersTools.GetInstance <ModeID>("Attack1") }; General = new AnimalModifier() { RootMotion = false, Grounded = false, Sprint = false, OrientToGround = false, CustomRotation = false, IgnoreLowerStates = true, //IMPORTANT! Persistent = false, AdditivePosition = true, Colliders = true, Gravity = true, modify = (modifier)(-1), }; ExitFrame = false; }
public override void Reset() { ID = MalbersTools.GetInstance <StateID>("Jump"); Input = "Jump"; General = new AnimalModifier() { RootMotion = true, Grounded = false, Sprint = false, OrientToGround = false, CustomRotation = false, IgnoreLowerStates = true, //IMPORTANT! Persistent = false, AdditivePosition = true, //AdditiveRotation = true, Colliders = true, Gravity = false, modify = (modifier)(-1), }; jumpProfiles = new List <JumpProfile>() { new JumpProfile() { name = "Jump", stepHeight = 0.1f, fallingTime = 0.7f, fallRay = 2, /* ForwardMultiplier = 1,*/ HeightMultiplier = 1, JumpLandDistance = 1.7f } }; }
void Reset() { SetOwner(transform.root); EnemyStatEnter = new StatModifier() { ID = MalbersTools.GetInstance <StatID>("Health"), modify = StatOption.SubstractValue, Value = new Scriptables.FloatReference() { UseConstant = true, ConstantValue = 10 }, }; Trigger = GetComponent <Collider>(); if (!Trigger) { Trigger = gameObject.AddComponent <BoxCollider>(); } Trigger.isTrigger = true; Owner = transform.root; //Set which is the owner of this AttackTrigger this.enabled = false; IMHitLayer mHit = GetComponentInParent <IMHitLayer>(); if (mHit != null) { HitLayer = mHit.HitLayer; TriggerInteraction = mHit.TriggerInteraction; } }
void Reset() { MEventListener MeventL = GetComponent <MEventListener>(); if (MeventL == null) { MeventL = gameObject.AddComponent <MEventListener>(); } MeventL.Events = new System.Collections.Generic.List <MEventItemListener>(1) { new MEventItemListener() }; var listener = MeventL.Events[0]; listener.useTransform = true; listener.useVector3 = true; listener.useVoid = false; listener.Event = MalbersTools.GetInstance <MEvent>("Follow UI Transform"); if (listener.Event != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(listener.ResponseTransform, SetTransform); UnityEditor.Events.UnityEventTools.AddPersistentListener(listener.ResponseVector3, SetScreenCenter); } }
private void Reset() { DismountInput.GetPressed = InputButton.LongPress; #if UNITY_EDITOR MEvent Dismountkey = MalbersTools.GetInstance <MEvent>("Dismount Key"); MEvent MountDismountUI = MalbersTools.GetInstance <MEvent>("Mount Dismount UI"); if (Dismountkey) { UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnLongPress, Dismountkey.Invoke); UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnPressedNormalized, Dismountkey.Invoke); UnityEditor.Events.UnityEventTools.AddIntPersistentListener(DismountInput.OnInputDown, Dismountkey.Invoke, 0); UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnInputUp, Dismountkey.Invoke); } if (MountDismountUI) { OnStartMounting = new UnityEvent(); UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnStartMounting, MountDismountUI.Invoke, false); } var malbersinput = GetComponent <MalbersInput>(); if (malbersinput) { UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnStartMounting, malbersinput.EnableMovement, false); UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnEndDismounting, malbersinput.EnableMovement, true); } #endif }
void Reset() { ModeID modeID = MalbersTools.GetInstance<ModeID>("Attack1"); animal = GetComponent<MAnimal>(); if (modeID != null) { this.ModeID = modeID; } }
void Reset() { MalbersTools.SetLayer(transform, 20); //Set all the Childrens to Animal Layer . gameObject.tag = "Animal"; //Set the Animal to Tag Animal AnimatorSpeed = 1; Anim = GetComponentInParent <Animator>(); //Cache the Animator RB = GetComponentInParent <Rigidbody>(); //Catche the Rigid Body if (RB == null) { RB = gameObject.AddComponent <Rigidbody>(); RB.useGravity = false; RB.constraints = RigidbodyConstraints.FreezeRotation; RB.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; } speedSets = new List <MSpeedSet>(1) { new MSpeedSet() { name = "Ground", StartVerticalIndex = new Scriptables.IntReference(1), TopIndex = new Scriptables.IntReference(2), states = new List <StateID>(2) { MalbersTools.GetInstance <StateID>("Idle"), MalbersTools.GetInstance <StateID>("Locomotion") }, Speeds = new List <MSpeed>(3) { new MSpeed("Walk", 1, 4, 4), new MSpeed("Trot", 2, 4, 4), new MSpeed("Run", 3, 4, 4) } } }; BoolVar useCameraInp = MalbersTools.GetInstance <BoolVar>("Global Camera Input"); BoolVar globalSmooth = MalbersTools.GetInstance <BoolVar>("Global Smooth Vertical"); FloatVar globalTurn = MalbersTools.GetInstance <FloatVar>("Global Turn Multiplier"); if (useCameraInp != null) { useCameraInput.Variable = useCameraInp; } if (globalSmooth != null) { SmoothVertical.Variable = globalSmooth; } if (globalTurn != null) { TurnMultiplier.Variable = globalTurn; } CalculateHeight(); }
private void Reset() { Director = GetComponent <PlayableDirector>(); MEvent timelineMEvent = MalbersTools.GetInstance <MEvent>("Timeline"); if (timelineMEvent != null) { UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnTimelinePlay, timelineMEvent.Invoke, true); UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnTimelineStop, timelineMEvent.Invoke, false); } }
public override void Reset() { ID = MalbersTools.GetInstance <StateID>("Death"); General = new AnimalModifier() { modify = (modifier)(-1), Persistent = true, LockInput = true, LockMovement = true, Colliders = false, }; }
private void Reset() { pointClickData = MalbersTools.GetInstance <PointClickData>("PointClickData"); PointUI = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Malbers Animations/Common/Prefabs/Interactables/ClickPoint.prefab"); var aiControl = GetComponent <IAIControl>(); if (aiControl != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnPointClick, aiControl.SetDestination); UnityEditor.Events.UnityEventTools.AddPersistentListener(OnInteractableClick, aiControl.SetTarget); } }
private void Reset() { Animal = GetComponent <MAnimal>(); StraightSpineOffsetTransform = transform; MEvent RiderMountUIE = MalbersTools.GetInstance <MEvent>("Rider Mount UI"); OnCanBeMounted = new BoolEvent(); if (RiderMountUIE != null) { UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <Transform>(OnCanBeMounted, RiderMountUIE.Invoke, transform); UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanBeMounted, RiderMountUIE.Invoke); } }
void Reset() { remainInState = MalbersTools.GetInstance <MAIState>("Remain in State"); Animal.isPlayer.Value = false; //Make sure this animal is not the Main Player AIMovement = GetComponent <MAnimalAIControl>(); if (AIMovement) { AIMovement.AutoInteract = false; AIMovement.AutoNextTarget = false; AIMovement.UpdateTargetPosition = false; AIMovement.MoveAgentOnMovingTarget = false; AIMovement.LookAtTargetOnArrival = false; } }
private void OnValidate() { #if UNITY_EDITOR if (MountPoint != null) { MEvent MountDismountUI = MalbersTools.GetInstance <MEvent>("Mount Dismount UI"); if (MountDismountUI) { UnityEditor.Events.UnityEventTools.RemovePersistentListener(OnCanBeMounted, MountDismountUI.Invoke); UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <Transform>(OnCanBeMounted, MountDismountUI.Invoke, MountPoint); UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanBeMounted, MountDismountUI.Invoke); } } #endif }
void Reset() { ID = MalbersTools.GetInstance <StateID>("Climb"); General = new AnimalModifier() { RootMotion = true, AdditivePosition = true, Grounded = false, Sprint = false, OrientToGround = false, //Colliders = true, Gravity = false, CustomRotation = true, modify = (modifier)(-1), FreeMovement = false, IgnoreLowerStates = true, }; }
void CreateEventListeners() { MEvent RiderSetMount = MalbersTools.GetInstance <MEvent>("Rider Set Mount"); MEvent RiderSetDismount = MalbersTools.GetInstance <MEvent>("Rider Set Dismount"); MEventListener listener = GetComponent <MEventListener>(); if (listener == null) { listener = gameObject.AddComponent <MEventListener>(); } if (listener.Events == null) { listener.Events = new List <MEventItemListener>(); } if (listener.Events.Find(item => item.Event == RiderSetMount) == null) { var item = new MEventItemListener() { Event = RiderSetMount, useVoid = true, }; UnityEditor.Events.UnityEventTools.AddPersistentListener(item.Response, MountAnimal); listener.Events.Add(item); Debug.Log("<B>Rider Set Mount</B> Added to the Event Listeners"); } if (listener.Events.Find(item => item.Event == RiderSetDismount) == null) { var item = new MEventItemListener() { Event = RiderSetDismount, useVoid = true, }; UnityEditor.Events.UnityEventTools.AddPersistentListener(item.Response, DismountAnimal); listener.Events.Add(item); Debug.Log("<B>Rider Set Dismount</B> Added to the Event Listeners"); } }
public override void Reset() { ID = MalbersTools.GetInstance <StateID>("Idle"); General = new AnimalModifier() { RootMotion = true, Grounded = true, Sprint = false, OrientToGround = true, CustomRotation = false, Colliders = true, FreeMovement = false, AdditivePosition = true, Gravity = false, modify = (modifier)(-1), }; }
void Reset() { ID = MalbersTools.GetInstance <StateID>("Jump"); Input = "Jump"; SleepFromState = new List <StateID>() { MalbersTools.GetInstance <StateID>("Fall"), MalbersTools.GetInstance <StateID>("Fly") }; SleepFromMode = new List <ModeID>() { MalbersTools.GetInstance <ModeID>("Action"), MalbersTools.GetInstance <ModeID>("Attack1") }; General = new AnimalModifier() { RootMotion = true, Grounded = false, Sprint = false, OrientToGround = false, CustomRotation = false, IgnoreLowerStates = true, //IMPORTANT! Persistent = false, AdditivePosition = true, //AdditiveRotation = true, // Colliders = true, Gravity = false, modify = (modifier)(-1), }; ExitFrame = false; jumpProfiles = new List <JumpProfile>() { new JumpProfile() { name = "Jump", /*stepHeight = 0.1f,*/ fallingTime = 0.7f, /* fallRay = 2, ForwardMultiplier = 1,*/ HeightMultiplier = 1, JumpLandDistance = 1.7f } }; }
private void Reset() { BoolVar RiderCombatMode = MalbersTools.GetInstance <BoolVar>("RC Combat Mode"); MEvent RCCombatMode = MalbersTools.GetInstance <MEvent>("RC Combat Mode"); MEvent RCEquipedWeapon = MalbersTools.GetInstance <MEvent>("RC Equiped Weapon"); MEvent SetCameraSettings = MalbersTools.GetInstance <MEvent>("Set Camera Settings"); if (RiderCombatMode != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCombatMode, RiderCombatMode.SetValue); } if (RCCombatMode != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCombatMode, RCCombatMode.Invoke); } if (RCEquipedWeapon != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnEquipWeapon, RCEquipedWeapon.Invoke); } if (SetCameraSettings != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnAiming, SetCameraSettings.Invoke); UnityEditor.Events.UnityEventTools.AddPersistentListener(OnAimSide, SetCameraSettings.Invoke); } UnityEditor.Events.UnityEventTools.AddStringPersistentListener(OnEquipWeapon, DisableMountInput, "Attack1"); UnityEditor.Events.UnityEventTools.AddStringPersistentListener(OnEquipWeapon, DisableMountInput, "Attack2"); UnityEditor.Events.UnityEventTools.AddStringPersistentListener(OnUnequipWeapon, EnableMountInput, "Attack1"); UnityEditor.Events.UnityEventTools.AddStringPersistentListener(OnUnequipWeapon, EnableMountInput, "Attack2"); var aimer = GetComponent <Aim>(); if (aimer == null) { aimer = gameObject.AddComponent <Aim>(); } }
void Reset() { EnemyStatEnter = new StatModifier() { ID = MalbersTools.GetInstance <StatID>("Health"), modify = StatOption.SubstractValue, Value = new Scriptables.FloatReference() { UseConstant = true, ConstantValue = 10 }, }; Trigger = GetComponentInChildren <Collider>(); if (!Trigger) { Trigger = GetComponentInChildren <Collider>();; Trigger.isTrigger = true; } Owner = transform.root; //Set which is the owner of this AttackTrigger this.enabled = false; }
public override void Reset() { ID = MalbersTools.GetInstance <StateID>("Swim"); WaterCollider = new Collider[1]; //Set the Array to 1 General = new AnimalModifier() { RootMotion = true, Grounded = false, Sprint = true, OrientToGround = false, CustomRotation = true, IgnoreLowerStates = true, //IMPORTANT AdditivePosition = true, Colliders = true, //AdditiveRotation = true, Gravity = false, modify = (modifier)(-1), //KeepInertia = true }; // SpeedIndex = 0; }
/// <summary>This is Executed when the Asset is created for the first time </summary> public override void Reset() { ID = MalbersTools.GetInstance <StateID>("Fall"); General = new AnimalModifier() { RootMotion = false, AdditivePosition = true, Grounded = false, Sprint = false, OrientToGround = false, Colliders = true, Gravity = true, CustomRotation = false, modify = (modifier)(-1), }; LowerBlendDistance = 0.1f; FallRayForward = 0.1f; fallRayMultiplier = 1f; FallSpeed.name = "FallSpeed"; ExitFrame = false; //IMPORTANT }
void Reset() { MalbersTools.SetLayer(transform, 20); //Set all the Childrens to Animal Layer . gameObject.tag = "Animal"; //Set the Animal to Tag Animal AnimatorSpeed = 1; speedSets = new List <MSpeedSet>(1) { new MSpeedSet() { name = "Ground", StartVerticalIndex = new Scriptables.IntReference(1), TopIndex = new Scriptables.IntReference(2), states = new List <StateID>(2) { MalbersTools.GetInstance <StateID>("Idle"), MalbersTools.GetInstance <StateID>("Locomotion") }, Speeds = new List <MSpeed>(3) { new MSpeed("Walk", 0, 4, 4), new MSpeed("Trot", 0, 4, 4), new MSpeed("Run", 0, 4, 4) } } }; }
void SetStateListeners(MEventListener listener, string EventName, string statename) { MEvent e = MalbersTools.GetInstance <MEvent>(EventName); if (listener.Events.Find(item => item.Event == e) == null) { var item = new MEventItemListener() { Event = e, useVoid = false, useInt = true, useBool = true, }; StateID ss = MalbersTools.GetInstance <StateID>(statename); UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <StateID>(item.ResponseBool, State_Pin, ss); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseBool, State_Pin_ByInput); listener.Events.Add(item); Debug.Log("<B>" + EventName + "</B> Added to the Event Listeners"); } }
void ConnectToInput() { MInput input = GetComponent <MInput>(); if (input == null) { input = gameObject.AddComponent <MInput>(); } BoolVar RiderCombatMode = MalbersTools.GetInstance <BoolVar>("RC Combat Mode"); BoolVar RCWeaponInput = MalbersTools.GetInstance <BoolVar>("RC Weapon Input"); var inv = GetComponent <MInventory>(); #region AIM INPUT var AIM = input.FindInput("Aim"); if (AIM == null) { AIM = new InputRow("Aim", "Aim", KeyCode.Mouse1, InputButton.Press, InputType.Key); input.inputs.Add(AIM); AIM.active.Variable = RiderCombatMode; AIM.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(AIM.OnInputChanged, SetAim); Debug.Log("<B>Aim</B> Input created and connected to RiderCombat.SetAim()"); } #endregion #region RiderAttack1 INPUT var RCA1 = input.FindInput("RiderAttack1"); if (RCA1 == null) { RCA1 = new InputRow("RiderAttack1", "RiderAttack1", KeyCode.Mouse0, InputButton.Press, InputType.Key); input.inputs.Add(RCA1); RCA1.active.Variable = RiderCombatMode; RCA1.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(RCA1.OnInputDown, MainAttack); UnityEditor.Events.UnityEventTools.AddPersistentListener(RCA1.OnInputUp, MainAttackReleased); Debug.Log("<B>RiderAttack1</B> Input created and connected to RiderCombat.MainAttack() and RiderCombat.MainAttackReleased() "); } #endregion #region RiderAttack2 INPUT var RCA2 = input.FindInput("RiderAttack2"); if (RCA2 == null) { RCA2 = new InputRow("RiderAttack2", "RiderAttack2", KeyCode.Mouse1, InputButton.Press, InputType.Key); input.inputs.Add(RCA2); RCA2.active.Variable = RiderCombatMode; RCA2.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(RCA2.OnInputDown, SecondAttack); UnityEditor.Events.UnityEventTools.AddPersistentListener(RCA2.OnInputUp, SecondAttackReleased); Debug.Log("<B>RiderAttack2</B> Input created and connected to RiderCombat.SecondAttack() and RiderCombat.SecondAttackReleased() "); } #endregion #region Reload INPUT var Reload = input.FindInput("Reload"); if (Reload == null) { Reload = new InputRow("Reload", "Reload", KeyCode.R, InputButton.Down, InputType.Key); input.inputs.Add(Reload); Reload.active.Variable = RiderCombatMode; Reload.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(Reload.OnInputDown, ReloadWeapon); Debug.Log("<B>Reload</B> Input created and connected to RiderCombat.ReloadWeapon() "); } #endregion #region Weapon1 INPUT var w1 = input.FindInput("Weapon1"); if (w1 == null) { w1 = new InputRow("Weapon1", "Weapon1", KeyCode.Alpha4, InputButton.Down, InputType.Key); input.inputs.Add(w1); w1.active.Variable = RCWeaponInput; w1.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(w1.OnInputDown, Change_Weapon_Holder_Back); if (inv) { UnityEditor.Events.UnityEventTools.AddIntPersistentListener(w1.OnInputDown, inv.EquipItem, 0); } Debug.Log("<B>Weapon1</B> Input created and connected to RiderCombat.Change_Weapon_Holder_Back() "); } #endregion #region Weapon2 INPUT var w2 = input.FindInput("Weapon2"); if (w2 == null) { w2 = new InputRow("Weapon2", "Weapon2", KeyCode.Alpha5, InputButton.Down, InputType.Key); input.inputs.Add(w2); w2.active.Variable = RCWeaponInput; w2.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(w2.OnInputDown, Change_Weapon_Holder_Left); if (inv) { UnityEditor.Events.UnityEventTools.AddIntPersistentListener(w2.OnInputDown, inv.EquipItem, 1); } Debug.Log("<B>Weapon2</B> Input created and connected to RiderCombat.Change_Weapon_Holder_Left() "); } #endregion #region Weapon3 INPUT var w3 = input.FindInput("Weapon3"); if (w3 == null) { w3 = new InputRow("Weapon3", "Weapon3", KeyCode.Alpha6, InputButton.Down, InputType.Key); input.inputs.Add(w3); w3.active.Variable = RCWeaponInput; w3.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(w3.OnInputDown, Change_Weapon_Holder_Right); if (inv) { UnityEditor.Events.UnityEventTools.AddIntPersistentListener(w3.OnInputDown, inv.EquipItem, 2); } Debug.Log("<B>Weapon3</B> Input created and connected to RiderCombat.Change_Weapon_Holder_Right() "); } #endregion }
void ConnectToInput() { MInput input = GetComponent <MInput>(); if (input == null) { input = gameObject.AddComponent <MInput>(); } #region Mount Input var mountInput = input.FindInput("Mount"); if (mountInput == null) { mountInput = new InputRow("Mount", "Mount", KeyCode.F, InputButton.Down, InputType.Key); input.inputs.Add(mountInput); mountInput.active.Variable = MalbersTools.GetInstance <BoolVar>("Can Mount"); mountInput.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(mountInput.OnInputDown, MountAnimal); Debug.Log("<B>Mount</B> Input created and connected to Rider.MountAnimal"); } #endregion #region Dismount Input var DismountInput = input.FindInput("Dismount"); if (DismountInput == null) { DismountInput = new InputRow("Dismount", "Dismount", KeyCode.F, InputButton.LongPress, InputType.Key); DismountInput.LongPressTime = 0.2f; input.inputs.Add(DismountInput); DismountInput.active.Variable = MalbersTools.GetInstance <BoolVar>("Can Dismount"); DismountInput.active.UseConstant = false; var RiderDismountUI = MalbersTools.GetInstance <MEvent>("Rider Dismount UI"); UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnLongPress, DismountAnimal); if (RiderDismountUI != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnLongPress, RiderDismountUI.Invoke); UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnPressedNormalized, RiderDismountUI.Invoke); UnityEditor.Events.UnityEventTools.AddPersistentListener(DismountInput.OnInputUp, RiderDismountUI.Invoke); UnityEditor.Events.UnityEventTools.AddIntPersistentListener(DismountInput.OnInputDown, RiderDismountUI.Invoke, 0); } Debug.Log("<B>Dismount</B> Input created and connected to Rider.DismountAnimal"); } #endregion #region CanCallMount Input var CanCallMount = input.FindInput("Call Mount"); if (CanCallMount == null) { CanCallMount = new InputRow("Call Mount", "Call Mount", KeyCode.F, InputButton.Down, InputType.Key); input.inputs.Add(CanCallMount); CanCallMount.active.Variable = MalbersTools.GetInstance <BoolVar>("Can Call Mount"); CanCallMount.active.UseConstant = false; UnityEditor.Events.UnityEventTools.AddPersistentListener(CanCallMount.OnInputDown, CallAnimalToggle); Debug.Log("<B>Call Mount</B> Input created and connected to Rider.CallAnimalToggle"); } #endregion }
void CreateListeners() { MEventListener listener = GetComponent <MEventListener>(); if (listener == null) { listener = gameObject.AddComponent <MEventListener>(); } if (listener.Events == null) { listener.Events = new List <MEventItemListener>(); } MEvent MovementMobile = MalbersTools.GetInstance <MEvent>("Set Movement Mobile"); if (listener.Events.Find(item => item.Event == MovementMobile) == null) { var item = new MEventItemListener() { Event = MovementMobile, useVoid = true, useVector2 = true, }; UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseVector2, SetInputAxis); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.Response, UseCameraBasedInput); listener.Events.Add(item); Debug.Log("<B>Set Movement Mobile</B> Added to the Event Listeners"); } //********************************// SetModesListeners(listener, "Set Attack1", "Attack1"); SetModesListeners(listener, "Set Attack2", "Attack2"); SetModesListeners(listener, "Set Action", "Action"); /************************/ MEvent actionstatus = MalbersTools.GetInstance <MEvent>("Set Action Status"); if (listener.Events.Find(item => item.Event == actionstatus) == null) { var item = new MEventItemListener() { Event = actionstatus, useVoid = false, useInt = true, useFloat = true }; ModeID ac = MalbersTools.GetInstance <ModeID>("Action"); UnityEditor.Events.UnityEventTools.AddObjectPersistentListener(item.ResponseInt, Mode_Pin, ac); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseInt, Mode_Pin_Status); UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseFloat, Mode_Pin_Time); listener.Events.Add(item); Debug.Log("<B>Set Action Status</B> Added to the Event Listeners"); } /************************/ SetStateListeners(listener, "Set Jump", "Jump"); SetStateListeners(listener, "Set Fly", "Fly"); /************************/ }
void CreateEventListeners() { MEvent RCSetAim = MalbersTools.GetInstance <MEvent>("RC Set Aim"); MEvent RCMainAttack = MalbersTools.GetInstance <MEvent>("RC Main Attack"); MEvent RCSecondaryAttack = MalbersTools.GetInstance <MEvent>("RC Secondary Attack"); MEventListener listener = GetComponent <MEventListener>(); if (listener == null) { listener = gameObject.AddComponent <MEventListener>(); } if (listener.Events == null) { listener.Events = new List <MEventItemListener>(); } //*******************// if (listener.Events.Find(item => item.Event == RCSetAim) == null) { var item = new MEventItemListener() { Event = RCSetAim, useVoid = false, useBool = true, }; UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseBool, SetAim); listener.Events.Add(item); Debug.Log("<B>RC Set Aim</B> Added to the Event Listeners"); } //*******************// if (listener.Events.Find(item => item.Event == RCMainAttack) == null) { var item = new MEventItemListener() { Event = RCMainAttack, useVoid = false, useBool = true }; UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseBool, MainAttack); listener.Events.Add(item); Debug.Log("<B>RC MainAttack</B> Added to the Event Listeners"); } //*******************// if (listener.Events.Find(item => item.Event == RCSecondaryAttack) == null) { var item = new MEventItemListener() { Event = RCSecondaryAttack, useVoid = false, useBool = true }; UnityEditor.Events.UnityEventTools.AddPersistentListener(item.ResponseBool, SecondAttack); listener.Events.Add(item); Debug.Log("<B>RC SecondaryAttack</B> Added to the Event Listeners"); } }
private void Reset() { BoolVar CanMountV = MalbersTools.GetInstance <BoolVar>("Can Mount"); BoolVar CanDismount = MalbersTools.GetInstance <BoolVar>("Can Dismount"); MEvent CanMountE = MalbersTools.GetInstance <MEvent>("Rider Can Mount"); MEvent CanDismountE = MalbersTools.GetInstance <MEvent>("Rider Can Dismount"); MEvent RiderMountUI = MalbersTools.GetInstance <MEvent>("Rider Mount UI"); BoolVar CanCallMountV = MalbersTools.GetInstance <BoolVar>("Can Call Mount"); MEvent CanCallMountE = MalbersTools.GetInstance <MEvent>("Rider Can Call Mount"); MEvent RiderisRiding = MalbersTools.GetInstance <MEvent>("Rider is Riding"); MEvent SetCameraSettings = MalbersTools.GetInstance <MEvent>("Set Camera Settings"); BoolVar RCWeaponInput = MalbersTools.GetInstance <BoolVar>("RC Weapon Input"); OnCanMount = new BoolEvent(); OnCanDismount = new BoolEvent(); CanCallMount = new BoolEvent(); OnStartMounting = new UnityEvent(); OnEndMounting = new UnityEvent(); OnStartMounting = new UnityEvent(); OnStartDismounting = new UnityEvent(); if (CanMountV != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanMount, CanMountV.SetValue); } if (CanMountE != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanMount, CanMountE.Invoke); } if (CanDismount != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanDismount, CanDismount.SetValue); } if (CanDismountE != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanDismount, CanDismountE.Invoke); } if (CanCallMountV != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(CanCallMount, CanCallMountV.SetValue); } if (CanCallMountE != null) { UnityEditor.Events.UnityEventTools.AddPersistentListener(CanCallMount, CanCallMountE.Invoke); } if (RiderMountUI != null) { UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnStartMounting, RiderMountUI.Invoke, false); } if (RiderisRiding != null) { UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnEndMounting, RiderisRiding.Invoke, true); UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnStartDismounting, RiderisRiding.Invoke, false); } if (SetCameraSettings != null) { UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <Transform>(OnStartDismounting, SetCameraSettings.Invoke, transform); } if (RCWeaponInput != null) { UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnStartDismounting, RCWeaponInput.SetValue, false); UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnEndMounting, RCWeaponInput.SetValue, true); } var malbersinput = GetComponent <MalbersInput>(); if (malbersinput) { UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnStartMounting, malbersinput.SetMoveCharacter, false); UnityEditor.Events.UnityEventTools.AddBoolPersistentListener(OnEndDismounting, malbersinput.SetMoveCharacter, true); } }