/// <summary> CallBack at the Start of the Dismount Animations</summary> public virtual void Start_Dismounting() { if (CreateColliderMounted) { MountingCollider(false); //Remove MountCollider } transform.parent = null; Montura.Mounted = Mounted = false; //Disable Mounted on everyone Montura.EnableInput(false); //Disable Montura Controls OnStartDismounting.Invoke(); if (Anim) { Anim.updateMode = Default_Anim_UpdateMode; //Restore Update mode to its original DisconectRiderAnims(); } else { End_Dismounting(); } UpdateCanMountDismount(); }
public virtual void MountTriggerExit() { MountTrigger = null; if (Montura) { Montura.EnableInput(false); Montura.OnCanBeMounted.Invoke(false); Montura.NearbyRider = false; } Montura = null; MonturaAI = null; MountInput = null; OnFindMount.Invoke(null); UpdateCanMountDismount(); }
/// <summary>CallBack at the End of the Dismount Animations</summary> public virtual void End_Dismounting() { IsOnHorse = false; //Is no longer on the Animal if (Montura) { Montura.EnableInput(false); //Disable Montura Controls Montura.Rider = null; Montura = null; //Reset the Montura MonturaAI = null; } ToggleCall = false; //Reset the Call Animal if (RB) //Reactivate stuffs for the Rider's Rigid Body { RB.useGravity = true; // RB.isKinematic = false; RB.constraints = DefaultConstraints; } if (Anim) { if (MountLayerIndex != -1) { Anim.SetLayerWeight(MountLayerIndex, 0); //Reset the Layer Weight to 0 when end dismounting } Anim.speed = 1; //Reset AnimatorSpeed MalbersTools.ResetFloatParameters(Anim); } t.rotation = Quaternion.FromToRotation(t.up, -Physics.gravity) * t.rotation; //Reset the Up Vector; ****IMPORTANT when CHANGE THE GRAVIY ToogleColliders(true); //Enabled colliders if (DisableComponents) { ToggleComponents(true); //Enable all Monobehaviours breaking the Mount System } OnEndDismounting.Invoke(); //Invoke UnityEvent when is off Animal UpdateCanMountDismount(); }
/// <summary>CallBack at the End of the Mount Animations </summary> public virtual void End_Mounting() { Montura.Mounted = Mounted = IsOnHorse = true; //Sync Mounted Values in Animal and Rider again Double Check if (Parent) { transform.localPosition = Vector3.zero; //Reset Position when PARENTED transform.localRotation = Quaternion.identity; //Reset Rotation when PARENTED } MountInput?.Enable(true); Montura.EnableInput(true); //Enable Animal Controls if (CreateColliderMounted) { MountingCollider(true); } if (Anim) { Anim.updateMode = Montura.Anim.updateMode; //Use the Same UpdateMode from the Animal // Anim.updateMode = AnimatorUpdateMode.Normal; //Use the Same UpdateMode from the Animal Anim.SetBool(Montura.Animal.hash_Grounded, Montura.Animal.Grounded); Anim.SetInteger(Montura.Animal.hash_State, Montura.Animal.ActiveStateID); Anim.SetInteger(Montura.Animal.hash_Mode, Montura.Animal.ModeAbility); Montura.Animal.OnGrounded.AddListener(AnimalGrounded); Montura.Animal.OnStateChange.AddListener(AnimalState); Montura.Animal.OnModeStart.AddListener(AnimalMode); Montura.Animal.OnStanceChange.AddListener(AnimalStance); Anim.SetInteger(Montura.Animal.hash_Stance, Montura.ID); } OnEndMounting.Invoke(); UpdateCanMountDismount(); }
public virtual void EnableMountInput(bool value) { Montura?.EnableInput(value); }