void OnTriggerExit(Collider other) { if (!gameObject.activeInHierarchy || other.isTrigger) { return; // Do not allow triggers } rider = other.FindComponent <MRider>(); if (rider != null) { col_amount--; if (col_amount == 0) { if (rider.IsMountingDismounting) { return; //You Cannot Mount if you are already mounted } if (rider.MountTrigger == this && !Montura.Mounted) //When exiting if we are exiting From the Same Mount Trigger means that there's no mountrigger Nearby { rider.MountTriggerExit(); } rider = null; if (WasAutomounted) { WasAutomounted = false; } } } }
private void GetAnimal(Collider other) { if (!Montura) { Debug.LogError("No Mount Script Found... please add one"); return; } if (!Montura.Mounted && Montura.CanBeMounted) //If there's no other Rider on the Animal or the the Animal isn't death { rider = other.FindComponent <MRider>(); if (rider != null) { col_amount++; if (rider.IsMountingDismounting) { return; //Means the Rider is already mounting an animal } rider.MountTriggerEnter(Montura, this); //Set Everything Requiered on the Rider in order to Mount if (AutoMount.Value && !WasAutomounted) { rider.MountAnimal(); } } } }
private void GetAnimal(Collider other) { if (!Montura) { Debug.LogError("No Mount Script Found... please add one"); return; } if (!Montura.Mounted && Montura.CanBeMounted) //If there's no other Rider on the Animal or the the Animal isn't death { rider = other.GetComponentInChildren <MRider>(); if (rider == null) { rider = other.GetComponentInParent <MRider>(); } if (rider != null) { if (rider.IsRiding) { return; //Means the Rider is already mounting an animal } rider.MountTriggerEnter(Montura, this); //Set Everything Requiered on the Rider in order to Mount } } }
void OnTriggerExit(Collider other) { rider = other.GetComponentInChildren <MRider>(); if (rider == null) { rider = other.GetComponentInParent <MRider>(); } if (rider != null) { if (rider.IsMountingDismounting) { return; //You Cannot Mount if you are already mounted } if (rider.MountTrigger == this && !Montura.Mounted) //When exiting if we are exiting From the Same Mount Trigger means that there's no mountrigger Nearby { rider.MountTriggerExit(); } rider = null; if (WasAutomounted) { WasAutomounted = false; } } }
// Use this for initialization void OnEnable() { if (Montura == null) { Montura = GetComponentInParent <Mount>(); //Get the Mountable in the parents } col_amount = 0; rider = null; }
//bool EventHelp = false; //bool CallHelp = false; protected virtual void OnEnable() { M = (MRider)target; script = MonoScript.FromMonoBehaviour(M); MountStored = serializedObject.FindProperty("MountStored"); animator = serializedObject.FindProperty("animator"); m_rigidBody = serializedObject.FindProperty("m_rigidBody"); m_root = serializedObject.FindProperty("m_root"); StartMounted = serializedObject.FindProperty("StartMounted"); Parent = serializedObject.FindProperty("Parent"); MountLayer = serializedObject.FindProperty("MountLayer"); LayerPath = serializedObject.FindProperty("LayerPath"); // Editor_RiderCallAnimal = serializedObject.FindProperty("Editor_RiderCallAnimal"); Editor_Tabs1 = serializedObject.FindProperty("Editor_Tabs1"); OnCanMount = serializedObject.FindProperty("OnCanMount"); OnCanDismount = serializedObject.FindProperty("OnCanDismount"); OnStartMounting = serializedObject.FindProperty("OnStartMounting"); OnEndMounting = serializedObject.FindProperty("OnEndMounting"); OnStartDismounting = serializedObject.FindProperty("OnStartDismounting"); OnEndDismounting = serializedObject.FindProperty("OnEndDismounting"); OnFindMount = serializedObject.FindProperty("OnFindMount"); CanCallMount = serializedObject.FindProperty("CanCallMount"); OnAlreadyMounted = serializedObject.FindProperty("OnAlreadyMounted"); CreateColliderMounted = serializedObject.FindProperty("CreateColliderMounted"); Col_Center = serializedObject.FindProperty("Col_Center"); Col_height = serializedObject.FindProperty("Col_height"); Col_radius = serializedObject.FindProperty("Col_radius"); Col_Trigger = serializedObject.FindProperty("Col_Trigger"); CallAnimalA = serializedObject.FindProperty("CallAnimalA"); StopAnimalA = serializedObject.FindProperty("StopAnimalA"); RiderAudio = serializedObject.FindProperty("RiderAudio"); LinkUpdate = serializedObject.FindProperty("LinkUpdate"); //CanMount = serializedObject.FindProperty("CanMount"); //CanDismount = serializedObject.FindProperty("CanDismount"); debug = serializedObject.FindProperty("debug"); AlingMountTrigger = serializedObject.FindProperty("AlingMountTrigger"); DismountType = serializedObject.FindProperty("DismountType"); //MainCamera = serializedObject.FindProperty("MainCamera"); //Target = serializedObject.FindProperty("Target"); DisableComponents = serializedObject.FindProperty("DisableComponents"); DisableList = serializedObject.FindProperty("DisableList"); // DismountMountOnDeath = serializedObject.FindProperty("DismountMountOnDeath"); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { MTools.ResetFloatParameters(animator); rider = animator.FindComponent <MRider>(); rider.SetMountSide(0); //Remove the side of the mounted **IMPORTANT*** otherwise it will keep trying to dismount ScaleFactor = rider.Montura.Animal.ScaleFactor; //Get the scale Factor from the Montura MountPoint = rider.Montura.MountPoint; Fix = rider.MountTrigger.Adjustment; //Get the Fix fo the Dismount rider.Start_Dismounting(); LastRelativeRiderPosition = MountPoint.InverseTransformPoint(rider.transform.position); //Get the Relative position of the Rider Position }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { animator.SetInteger(Hash.MountSide, 0); //Remove the side of the mounted ****IMPORTANT rider = animator.GetComponent <MRider>(); //Get the Rider alignTime = rider.AlingMountTrigger; //Get the Mount Trigger Time transform = animator.transform; //Get the transform MountTrigger = rider.MountTrigger.transform; //Get the MountTrigger for the Position AnimalScaleFactor = rider.Montura.Animal.ScaleFactor; //Get the Scale Factor on the Mount MalbersTools.ResetFloatParameters(animator); //Set All Float values to their defaut (For all the Float Values on the Controller while is not riding) Fix = rider.MountTrigger.Adjustment; //Get the Fix for the Mount Trigger rider.Start_Mounting(); //Call Start Mounting }
private void OnDisable() { rider = null; col_amount = 0; }