public override void EnterCoreAnimation() { SetStatus(0); if (animal.LastState.ID.ID != ID.ID) { animal.State_SetFloat(0); //Only Reset when it comes from Locomotino } UpImpulse = Vector3.Project(animal.DeltaPos, animal.UpVector); //Clean the Vector from Forward and Horizontal Influence IgnoreLowerStates = false; FallSpeed = new MSpeed(animal.CurrentSpeedModifier) { name = "FallSpeed", position = animal.HorizontalSpeed + animal.ExternalForceHSpeed, strafeSpeed = animal.HorizontalSpeed + animal.ExternalForceHSpeed, animator = 1, rotation = AirRotation.Value, }; animal.SetCustomSpeed(FallSpeed, true); if (animal.HasExternalForce && animal.Zone) { animal.UseGravity = false; //Disable again the Gravity if we are on an external force } Has_UP_Impulse = Vector3.Dot(UpImpulse, animal.UpVector) > 0; if (MTools.CompareOR(animal.LastState.ID, 0, 1, StateEnum.Swim, StateEnum.Climb) && Has_UP_Impulse || animal.HasExternalForce) //means it was on locomotion or idle //Remove Up Impulse HACK { UpImpulse = Vector3.zero; } }
/// <summary>Sets the weapon equipped by an External Source</summary> public virtual void Equip_External_Fast(GameObject WeaponGo) { if (Active && UseInventory && CheckRidingOnly) { if (!MTools.CompareOR(Mathf.Abs(WeaponAction), WA.Idle, WA.None)) { return; //If is not on any of these states then Dont Equip.. } StopAllCoroutines(); var Next_Weapon = WeaponGo != null?WeaponGo.GetComponent <MWeapon>() : null; if (Next_Weapon == null) //That means Store the weapon { UnEquip_FAST(); } else if (Weapon == null) //Means there's no ACTIVE weapon Equip the newone { TryInstantiateWeapon(Next_Weapon); Holster_SetActive(Weapon.HolsterID); Equip_FAST(); } else if (!Weapon.Equals(Next_Weapon)) //You are trying to draw the same weapon { UnEquip_FAST(); TryInstantiateWeapon(Next_Weapon); Equip_FAST(); if (debug) { Debug.Log("Active weapon is DIFFERENT to the NEXT weapon so Switch" + WeaponGo); } } } }
/// <summary>Sets the weapon equipped by an External Source</summary> public virtual void Equip_External(GameObject WeaponGo) { if (Active && UseInventory && !Paused && CheckRidingOnly) { var Next_Weapon = WeaponGo?.GetComponent <MWeapon>(); if (!MTools.CompareOR(Mathf.Abs(WeaponAction), WA.Idle, WA.None)) { return; //If is not on any of these states then Dont Equip.. } StopAllCoroutines(); if (Next_Weapon == null) //That means Store the weapon { Store_Weapon(); if (debug) { Debug.Log("Active Weapon is Empty or is not Compatible Store the Active Weapon"); } } else if (Weapon == null) //Means there's no weapon active so draw it { TryInstantiateWeapon(Next_Weapon); Holster_SetActive(Weapon.HolsterID); Draw_Weapon(); } else if (Weapon.Equals(Next_Weapon)) //You are trying to draw the same weapon { if (!CombatMode) { Draw_Weapon(); if (debug) { Debug.Log("Active weapon is the same as the NEXT Weapon and we are NOT in Combat so DRAW"); } } else { Store_Weapon(); if (debug) { Debug.Log("Active weapon is the same as the NEXT Weapon and we ARE in Combat so STORE"); } } } else //If the weapons are different Swap it { StartCoroutine(SwapWeaponsInventory(WeaponGo)); if (debug) { Debug.Log("Active weapon is DIFFERENT to the NEXT weapon so Switch" + WeaponGo); } } } }
public override void EnterCoreAnimation() { SetStatus(0); animal.State_SetFloat(0); UpImpulse = Vector3.Project(animal.DeltaPos, animal.UpVector); //Clean the Vector from Forward and Horizontal Influence GoingUPImpulse = Vector3.Dot(UpImpulse, animal.UpVector) > 0; if (MTools.CompareOR(animal.LastState.ID, 0, 1, 4, StateEnum.Climb) && GoingUPImpulse || animal.HasExternalForce) //means it was on locomotion or idle //Remove Up Impulse HACK { UpImpulse = Vector3.zero; } IgnoreLowerStates = false; FallSpeed = new MSpeed(animal.CurrentSpeedModifier) { name = "FallSpeed", position = animal.HorizontalSpeed + animal.ExternalForceHSpeed, animator = 1, rotation = AirRotation.Value }; animal.UpdateDirectionSpeed = AirControl; //Set the Directional Speed to be Updated depending the Air Control var IMPORTANT if (animal.HasExternalForce) //??? { animal.DirectionalSpeed = Vector3.ProjectOnPlane(animal.ExternalForce, animal.UpVector).normalized; } animal.SetCustomSpeed(FallSpeed, true); GoingUPImpulse = Vector3.Dot(UpImpulse, animal.UpVector) > 0; if (MTools.CompareOR(animal.LastState.ID, 0, 1, 4, StateEnum.Climb) && GoingUPImpulse || animal.HasExternalForce) //means it was on locomotion or idle //Remove Up Impulse HACK { UpImpulse = Vector3.zero; } }
public virtual void Holster_Equip_Fast(int HolsterID) { if (UseHolsters && Active && !Paused && CheckRidingOnly) { if (MTools.CompareOR(Mathf.Abs(WeaponAction), WA.None, WA.Idle)) //Change weapons from holsters only If we are on none,Idle or Aiming { if (ActiveHolster != HolsterID) //if there's a weapon on hand, Store it and draw the other weapon from the next holster { UnEquip_FAST(); Holster_SetActive(HolsterID); Equip_FAST(); } else { if (!CombatMode) { Equip_FAST(); // Draw a weapon if we are on Action None } // else UnEquip_FAST(); //Store a weapon if we are on Action Idle } } } }
public virtual void Holster_Equip(int HolsterID) { if (UseHolsters && Active && !Paused && CheckRidingOnly) { if (MTools.CompareOR(Mathf.Abs(WeaponAction), WA.None, WA.Idle)) //Change weapons from holsters only If we are on none,Idle or Aiming { if (ActiveHolster != HolsterID) //if there's a weapon on hand, Store it and draw the other weapon from the next holster { StartCoroutine(SwapWeaponsHolster(HolsterID)); } else { if (!CombatMode) { Draw_Weapon(); //Draw a weapon if we are on Action None } else { Store_Weapon(); //Store a weapon if we are on Action Idle } } } } }