///────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── /// <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.EnableControls(false); //Disable Montura Controls } Montura = null; //Reset the Montura toogleCall = false; //Reset the Call Animal // isInMountTrigger = false; //Reset the CanMount if (_rigidbody) //Reactivate stuffs for the Rider's Rigid Body { _rigidbody.useGravity = true; // _rigidbody.isKinematic = false; _rigidbody.constraints = DefaultConstraints; } if (Anim) { Anim.speed = 1; //Reset AnimatorSpeed } _transform.rotation = Quaternion.FromToRotation(_transform.up, -Physics.gravity) * _transform.rotation; //Reset the Up Vector; ToogleColliders(true); //Enabled colliders }
public void Mounting() { base.Start_Mounting(); IsOnHorse = true; Montura.EnableControls(true); //Enable Animal Controls if (CreateColliderMounted) { MountingCollider(true); } Montura.ActiveRider = this; Vector3 AnimalForward = Montura.transform.forward; AnimalForward.y = 0; AnimalForward.Normalize(); transform.rotation = Quaternion.LookRotation(AnimalForward, -Physics.gravity); OnMount.Invoke(); }
///────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── /// <summary> /// CallBack at the End of the Mount Animations /// </summary> public virtual void End_Mounting() { IsOnHorse = true; Montura.Mounted = Mounted = true; //Sync Mounted Values in Animal and Rider again Double Check transform.localPosition = Vector3.zero; //Reset Position transform.localRotation = Quaternion.identity; //Reset Rotation Montura.EnableControls(true); //Enable Animal Controls if (CreateColliderMounted) { MountingCollider(true); } //Montura.ActiveRider = this; }
///────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── /// <summary> /// CallBack at the Start of the Dismount Animations /// </summary> public virtual void Start_Dismounting() { LinkToMount(false); //Unlink From Animal MountingCollider(false); //Remove the Mount Collider //Invoke UnityEvent when is off Animal if (CreateColliderMounted) { MountingCollider(false); //Remove MountCollider } Montura.EnableControls(false); //Disable Montura Controls Montura.ActiveRider = null; Montura.Mounted = mounted = false; //Disable Mounted on everyone if (!Anim) { End_Dismounting(); } }