/// <summary>Unequip Weapon from holster or from Inventory (Called by the Animator)</summary> public virtual void Unequip_Weapon() { // if (!Active) return; ResetCombat(); if (Weapon == null) { return; } if (debug) { Debug.Log($"<b>{name}:<color=cyan> [Unequip -> {Weapon.name}]</color> </b>"); //Debug } OnUnequipWeapon.Invoke(Weapon.gameObject); //Let the rider know that the weapon has been unequiped. if (UseHolsters) //If Use holster Parent the ActiveMWeapon the the holster { Weapon.transform.parent = ActiveHolster.Transform; //Parent the weapon to his original holster StartCoroutine(MTools.AlignTransform(Weapon.transform, Weapon.HolsterOffset, HolsterTime)); } else if (!AlreadyInstantiated) { Destroy(Weapon.gameObject); } Weapon = null; //IMPORTANT }
private IEnumerator C_MountAnim() { var rot = Quaternion.FromToRotation(Montura.MountPoint.up, -Gravity.Value) * Montura.MountPoint.rotation; yield return(MTools.AlignTransform(transform, Montura.MountPoint.position, rot, MountTime, MountAnim)); End_Mounting(); // transform.rotation = Quaternion.identity; MainCollider.enabled = true; }