add some extra assets FX and SFX
This commit is contained in:
@@ -93,6 +93,9 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
|
||||
public string cancelBlockReactionStateName = "Disable Has Exit Time State";
|
||||
|
||||
public bool ignoreDeflectProjectilesOnAttackOnAllWeapons;
|
||||
public bool ignoreDeflectProjectilesOnBlockOnAllWeapons;
|
||||
|
||||
// [Space]
|
||||
// [Header ("Shield Settings")]
|
||||
// [Space]
|
||||
@@ -286,11 +289,30 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
public playerInputManager playerInput;
|
||||
|
||||
public Transform parentToPlaceTriggerInFrontOfCharacter;
|
||||
public Transform parentToPlaceTriggerInFrontOfCharacterFBA;
|
||||
|
||||
public meleeCombatThrowReturnWeaponSystem mainMeleeCombatThrowReturnWeaponSystem;
|
||||
|
||||
public meleeUISystem mainMeleeUISystem;
|
||||
|
||||
public bool useAttackInputStack;
|
||||
public int maxAmountOfAttackInputStack;
|
||||
|
||||
|
||||
public bool extraTriggerMultiplierScaleOnAllMeleeAttacksActive;
|
||||
public float extraTriggerMultiplierScaleOnAllMeleeAttacksAmount;
|
||||
|
||||
|
||||
bool attackInputStackComplete;
|
||||
|
||||
List<string> attackInputStackList = new List<string> ();
|
||||
|
||||
bool attackInputStackActive;
|
||||
|
||||
bool ignoreAddAttackInputToStackActive;
|
||||
|
||||
|
||||
Transform newParentToPlaceTrigger;
|
||||
|
||||
Transform objectRotationPoint;
|
||||
|
||||
@@ -399,6 +421,9 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
|
||||
string customSurfaceInfoOnMeleeAttackNameForSwingOnAir;
|
||||
|
||||
Coroutine updateCoroutine;
|
||||
|
||||
|
||||
private void InitializeAudioElements ()
|
||||
{
|
||||
bool mainAudioSourceLocated = mainAudioSource != null;
|
||||
@@ -434,6 +459,74 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
originalUseMatchTargetSystemOnAttack = useMatchTargetSystemOnAttack;
|
||||
}
|
||||
|
||||
|
||||
public void stopUpdateCoroutine ()
|
||||
{
|
||||
if (updateCoroutine != null) {
|
||||
StopCoroutine (updateCoroutine);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator updateSystemCoroutine ()
|
||||
{
|
||||
var waitTime = new WaitForFixedUpdate ();
|
||||
|
||||
while (true) {
|
||||
updateSystem ();
|
||||
|
||||
yield return waitTime;
|
||||
}
|
||||
}
|
||||
|
||||
void updateSystem ()
|
||||
{
|
||||
if (useAttackInputStack && attackInputStackActive) {
|
||||
if (attackInputStackList.Count > 0 && !attackInProcess && canUseWeaponsInput ()) {
|
||||
ignoreAddAttackInputToStackActive = true;
|
||||
|
||||
attackInputStackComplete = false;
|
||||
|
||||
activateGrabbedObjectMeleeAttack (attackInputStackList [0]);
|
||||
|
||||
attackInputStackList.RemoveAt (0);
|
||||
|
||||
ignoreAddAttackInputToStackActive = false;
|
||||
|
||||
if (attackInputStackList.Count == 0) {
|
||||
attackInputStackActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((isActionActive () && !attackInProcess) ||
|
||||
objectThrown ||
|
||||
cuttingModeActive ||
|
||||
blockActive ||
|
||||
(useThrowReturnMeleeWeaponSystemEnabled &&
|
||||
(mainMeleeCombatThrowReturnWeaponSystem.isReturningThrownObject ()))) {
|
||||
|
||||
resetAttackInputStack ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkIfAddAttackToStack (string attackType)
|
||||
{
|
||||
if (useAttackInputStack && !attackInputStackComplete) {
|
||||
|
||||
if (!ignoreAddAttackInputToStackActive) {
|
||||
if (attackInputStackList.Count < maxAmountOfAttackInputStack) {
|
||||
attackInputStackList.Add (attackType);
|
||||
|
||||
attackInputStackActive = true;
|
||||
}
|
||||
|
||||
if (attackInputStackList.Count >= maxAmountOfAttackInputStack) {
|
||||
attackInputStackComplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool isGrabbedObjectMeleeAttackEnabled ()
|
||||
{
|
||||
return grabbedObjectMeleeAttackEnabled;
|
||||
@@ -874,9 +967,9 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
mainDualWieldMeleeWeaponObjectSystem.enableDualWieldMeleeweapobObject (this, currentGrabbedWeaponInfo.useEventsOnDamageDetected);
|
||||
}
|
||||
|
||||
deflectProjectilesEnabled = currentMeleeWeapon.deflectProjectilesEnabled;
|
||||
deflectProjectilesEnabled = currentMeleeWeapon.deflectProjectilesEnabled && !ignoreDeflectProjectilesOnAttackOnAllWeapons;
|
||||
|
||||
deflectProjectilesOnBlockEnabled = currentMeleeWeapon.deflectProjectilesOnBlockEnabled;
|
||||
deflectProjectilesOnBlockEnabled = currentMeleeWeapon.deflectProjectilesOnBlockEnabled && !ignoreDeflectProjectilesOnBlockOnAllWeapons;
|
||||
|
||||
if (deflectProjectilesEnabled || deflectProjectilesOnBlockEnabled) {
|
||||
currentMeleeWeapon.mainArmoreSurfaceSystem.gameObject.SetActive (true);
|
||||
@@ -927,9 +1020,21 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
if (mainMeleeUISystem != null) {
|
||||
mainMeleeUISystem.enableOrDisableMeleeUI (true);
|
||||
|
||||
mainMeleeUISystem.setCurrentMeleeWeaponName (currentMeleeWeapon.getWeaponName ());
|
||||
string meleeWeaponNameForUI = currentMeleeWeapon.getWeaponName ();
|
||||
|
||||
mainMeleeUISystem.setCurrrentMeleeWeaponIcon (GKC_Utils.getInventoryObjectIconByName (currentMeleeWeapon.getWeaponName ()));
|
||||
if (currentGrabbedWeaponInfo.isEmptyWeaponToUseOnlyShield) {
|
||||
meleeWeaponNameForUI = mainMeleeWeaponsGrabbedManager.getCurrentShieldName ();
|
||||
}
|
||||
|
||||
mainMeleeUISystem.setCurrentMeleeWeaponName (meleeWeaponNameForUI);
|
||||
|
||||
mainMeleeUISystem.setCurrrentMeleeWeaponIcon (GKC_Utils.getInventoryObjectIconByName (meleeWeaponNameForUI));
|
||||
}
|
||||
|
||||
if (useAttackInputStack) {
|
||||
stopUpdateCoroutine ();
|
||||
|
||||
updateCoroutine = StartCoroutine (updateSystemCoroutine ());
|
||||
}
|
||||
} else {
|
||||
removeGrabPhysicalObjectMeleeAttackSystem ();
|
||||
@@ -959,6 +1064,10 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (useAttackInputStack) {
|
||||
stopUpdateCoroutine ();
|
||||
}
|
||||
|
||||
mainPlayerController.setPlayerUsingMeleeWeaponsState (false);
|
||||
|
||||
if (currentMeleeWeapon != null) {
|
||||
@@ -1142,21 +1251,21 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
|
||||
public void drawOrKeepMeleeWeapon ()
|
||||
{
|
||||
if (mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerActive) {
|
||||
if (mainMeleeWeaponsGrabbedManager.isMeleeWeaponsGrabbedManagerActive ()) {
|
||||
mainMeleeWeaponsGrabbedManager.inputDrawOrKeepMeleeWeapon ();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawOrKeepMeleeWeaponWithoutCheckingInputActive ()
|
||||
{
|
||||
if (mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerActive) {
|
||||
if (mainMeleeWeaponsGrabbedManager.isMeleeWeaponsGrabbedManagerActive ()) {
|
||||
mainMeleeWeaponsGrabbedManager.drawOrKeepMeleeWeaponWithoutCheckingInputActive ();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawMeleeWeaponGrabbedCheckingAnimationDelay ()
|
||||
{
|
||||
if (mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerActive) {
|
||||
if (mainMeleeWeaponsGrabbedManager.isMeleeWeaponsGrabbedManagerActive ()) {
|
||||
mainMeleeWeaponsGrabbedManager.drawMeleeWeaponGrabbedCheckingAnimationDelay ();
|
||||
}
|
||||
}
|
||||
@@ -1173,7 +1282,7 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
|
||||
public void checkIfDropThrownWeaponWhenUsingDevice ()
|
||||
{
|
||||
if (mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerActive) {
|
||||
if (mainMeleeWeaponsGrabbedManager.isMeleeWeaponsGrabbedManagerActive ()) {
|
||||
mainMeleeWeaponsGrabbedManager.checkIfDropThrownWeaponWhenUsingDevice ();
|
||||
}
|
||||
}
|
||||
@@ -1237,19 +1346,39 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
if (currentAttackInfo != null && currentAttackInfo.attackType != "") {
|
||||
ignoreTimeToPlayNextAttackActive = true;
|
||||
|
||||
//ignoreAddAttackInputToStackActive = true;
|
||||
ignoreAddAttackInputToStackActive = true;
|
||||
|
||||
activateGrabbedObjectMeleeAttack (currentAttackInfo.attackType);
|
||||
|
||||
ignoreTimeToPlayNextAttackActive = false;
|
||||
|
||||
//ignoreAddAttackInputToStackActive = false;
|
||||
ignoreAddAttackInputToStackActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkResetAttackInputStack ()
|
||||
{
|
||||
if (useAttackInputStack && attackInputStackActive) {
|
||||
resetAttackInputStack ();
|
||||
}
|
||||
}
|
||||
|
||||
public void resetAttackInputStack ()
|
||||
{
|
||||
if (attackInputStackActive) {
|
||||
attackInputStackList.Clear ();
|
||||
|
||||
attackInputStackActive = false;
|
||||
|
||||
attackInputStackComplete = false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool drawMeleeWeaponIfAttackInputPressedEnabled;
|
||||
|
||||
public bool useQuickDrawIfAttackInputPressed;
|
||||
|
||||
bool ignoreTimeToPlayNextAttackActive;
|
||||
|
||||
public void activateGrabbedObjectMeleeAttack (string attackType)
|
||||
@@ -1296,10 +1425,26 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (useAttackInputStack && attackInputStackActive) {
|
||||
if (attackInputStackComplete) {
|
||||
//print ("stack complete, cancelling input");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (drawMeleeWeaponIfAttackInputPressedEnabled) {
|
||||
if (!carryingObject) {
|
||||
if (useQuickDrawIfAttackInputPressed) {
|
||||
setIgnoreUseDrawKeepWeaponAnimationState (true);
|
||||
}
|
||||
|
||||
drawOrKeepMeleeWeapon ();
|
||||
|
||||
if (useQuickDrawIfAttackInputPressed) {
|
||||
setOriginalIgnoreUseDrawKeepWeaponAnimationState ();
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("draw weapon by attack input");
|
||||
}
|
||||
@@ -1385,6 +1530,8 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
|
||||
currentWaitTimeToNextAttack = 0;
|
||||
|
||||
checkIfAddAttackToStack (attackType);
|
||||
|
||||
return;
|
||||
} else {
|
||||
currentWaitTimeToNextAttack = currentAttackInfo.minDelayBeforeNextAttack;
|
||||
@@ -1462,6 +1609,10 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
if (cancelAttack) {
|
||||
print ("cancel attack");
|
||||
|
||||
checkIfAddAttackToStack (attackType);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2189,21 +2340,33 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
if (extraTriggerMultiplierScaleOnAllMeleeAttacksActive) {
|
||||
if (enableMainHitCombat) {
|
||||
setHitCombatScaleMultiplier (extraTriggerMultiplierScaleOnAllMeleeAttacksAmount);
|
||||
} else {
|
||||
mainDualWieldMeleeWeaponObjectSystem.setHitCombatScaleMultiplier (extraTriggerMultiplierScaleOnAllMeleeAttacksAmount);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentdamageTriggerActiveInfo.changeDamageTriggerToLimb || placeTriggerInFrontOfCharacterOnAllAttacksResult) {
|
||||
Transform newParent = null;
|
||||
newParentToPlaceTrigger = null;
|
||||
|
||||
if (currentdamageTriggerActiveInfo.placeTriggerInFrontOfCharacter || placeTriggerInFrontOfCharacterOnAllAttacksResult) {
|
||||
newParent = parentToPlaceTriggerInFrontOfCharacter;
|
||||
if (mainPlayerController.isFullBodyAwarenessActive ()) {
|
||||
newParentToPlaceTrigger = parentToPlaceTriggerInFrontOfCharacterFBA;
|
||||
} else {
|
||||
newParentToPlaceTrigger = parentToPlaceTriggerInFrontOfCharacter;
|
||||
}
|
||||
|
||||
if (newParent == null) {
|
||||
newParent = playerControllerGameObject.transform;
|
||||
if (newParentToPlaceTrigger == null) {
|
||||
newParentToPlaceTrigger = playerControllerGameObject.transform;
|
||||
}
|
||||
} else {
|
||||
newParent = getCharacterHumanBone (currentdamageTriggerActiveInfo.limbToPlaceTrigger);
|
||||
newParentToPlaceTrigger = getCharacterHumanBone (currentdamageTriggerActiveInfo.limbToPlaceTrigger);
|
||||
}
|
||||
|
||||
if (newParent != null) {
|
||||
attackHitCombat.transform.SetParent (newParent);
|
||||
if (newParentToPlaceTrigger != null) {
|
||||
attackHitCombat.transform.SetParent (newParentToPlaceTrigger);
|
||||
attackHitCombat.transform.localPosition = Vector3.zero;
|
||||
attackHitCombat.transform.localRotation = Quaternion.identity;
|
||||
|
||||
@@ -2894,7 +3057,7 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
{
|
||||
shieldActive = state;
|
||||
|
||||
// print ("shield state " + shieldActive + " " + carryingObject);
|
||||
//print ("shield state " + shieldActive + " " + carryingObject);
|
||||
|
||||
if (!carryingObject) {
|
||||
if (mainMeleeWeaponsGrabbedManager.isCurrentMeleeWeaponSheathedOrCarried ()) {
|
||||
@@ -2915,7 +3078,13 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
eventToActivateMeleeModeWhenUsingShieldWithoutMeleeWeapon.Invoke ();
|
||||
}
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.checkMeleeWeaponToUse (grabbedWeaponInfoList [i].Name, false);
|
||||
if (mainMeleeWeaponsGrabbedManager.isUseEquipShieldCheckWhenActivatingShieldActive ()) {
|
||||
mainMeleeWeaponsGrabbedManager.equipMeleeWeapon (grabbedWeaponInfoList [i].Name, false, true);
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.setUseEquipShieldCheckWhenActivatingShieldState (false);
|
||||
} else {
|
||||
mainMeleeWeaponsGrabbedManager.checkMeleeWeaponToUse (grabbedWeaponInfoList [i].Name, false);
|
||||
}
|
||||
|
||||
emptyMeleeWeaponForShieldFound = true;
|
||||
}
|
||||
@@ -3052,6 +3221,8 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
currentShieldGameObject.transform.localPosition = currentShieldBackMountPointTransformReference.localPosition;
|
||||
currentShieldGameObject.transform.localRotation = currentShieldBackMountPointTransformReference.localRotation;
|
||||
}
|
||||
|
||||
//print ("setShieldParentState " + state + " " + currentShieldGameObject.name);
|
||||
}
|
||||
|
||||
bool checkingSetShieldActiveIfCarryingShield;
|
||||
@@ -3196,6 +3367,13 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void setHitCombatScaleMultiplier (float newMultiplier)
|
||||
{
|
||||
if (currentHitCombatBoxCollider != null) {
|
||||
currentHitCombatBoxCollider.size *= newMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
void setHitCombatOffset (Vector3 newValue)
|
||||
{
|
||||
if (currentHitCombatBoxCollider != null) {
|
||||
@@ -3367,6 +3545,15 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
|
||||
void setAttackInfoTemplateByIndex (int newIndex)
|
||||
{
|
||||
if (currentGrabbedWeaponInfo.meleeWeaponAttackInfoList.Count == 0 ||
|
||||
newIndex >= currentGrabbedWeaponInfo.meleeWeaponAttackInfoList.Count) {
|
||||
|
||||
print ("setAttackInfoTemplateByIndex trying to use an index higher than" +
|
||||
" the amount of attack template list elements, cancelling");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
currentAttackIndex = 0;
|
||||
|
||||
currentAttackInfoTemplateIndex = newIndex;
|
||||
@@ -5075,6 +5262,24 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
setUseMatchTargetSystemOnAttackState (originalUseMatchTargetSystemOnAttack);
|
||||
}
|
||||
|
||||
public void enableOrDisableUseAttackInputStack (bool state)
|
||||
{
|
||||
useAttackInputStack = state;
|
||||
}
|
||||
|
||||
public void setPlaceTriggerInFrontOfCharacterOnAllAttacksState (bool state)
|
||||
{
|
||||
placeTriggerInFrontOfCharacterOnAllAttacks = state;
|
||||
}
|
||||
|
||||
public void setExtraTriggerMultiplierScaleOnAllMeleeAttacksActiveState (bool state, float value)
|
||||
{
|
||||
extraTriggerMultiplierScaleOnAllMeleeAttacksActive = state;
|
||||
|
||||
extraTriggerMultiplierScaleOnAllMeleeAttacksAmount = value;
|
||||
}
|
||||
|
||||
|
||||
//EDITOR FUNCTIONS
|
||||
public void setCheckDurabilityOnAttackEnabledStateFromEditor (bool state)
|
||||
{
|
||||
@@ -5138,6 +5343,13 @@ public class grabbedObjectMeleeAttackSystem : MonoBehaviour
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void enableOrDisableUseAttackInputStackFromEditor (bool state)
|
||||
{
|
||||
enableOrDisableUseAttackInputStack (state);
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void updateGrabbedWeaponReferenceValuesOnAllWeaponInfoList ()
|
||||
{
|
||||
int grabbedWeaponInfoListCount = grabbedWeaponInfoList.Count;
|
||||
|
||||
Reference in New Issue
Block a user