Little fix on player, added trigger collider on usp

@juliuse98 needs to fix when looking up the weapon gets to far away an the hands look strange. Tried to fix it a bit. Its no a little better but NOT completely fixed.

USP has now a collider that is a trigger. When the weapon is clipping through the wall (befor that the collider should trigger and the player puts the weapon upright) ITS NOT WORKING but the structure is there... (All collider gets disabled when you pick up a weapon)
This commit is contained in:
Noah4ever
2021-12-15 13:19:10 +01:00
parent bdf043d299
commit 572344254d
9 changed files with 174 additions and 109 deletions

View File

@@ -23,13 +23,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1029209707363336683}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0.7071068, w: 0}
m_LocalPosition: {x: -0.039, y: -0.0474, z: -0.2881}
m_LocalRotation: {x: 0.04839414, y: 0.7054488, z: 0.7054488, w: -0.04839414}
m_LocalPosition: {x: -0.048699856, y: -0.058, z: -0.1693}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8797726366404580855}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: -90, y: 180, z: 0}
m_LocalEulerAnglesHint: {x: -90, y: 180, z: 7.848999}
--- !u!1 &1880099159927430553
GameObject:
m_ObjectHideFlags: 0
@@ -42,6 +43,8 @@ GameObject:
- component: {fileID: 1078062810013672401}
- component: {fileID: 1672832146417829139}
- component: {fileID: 6050550425513890989}
- component: {fileID: 1514911119484970353}
- component: {fileID: 2772737694660170496}
m_Layer: 7
m_Name: USP 1
m_TagString: Weapon
@@ -59,6 +62,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6108047450985722759}
- {fileID: 5139256649524637864}
@@ -92,17 +96,20 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
weaponKind: 1
active: 0
dropForce: 10
hitForce: 100
damage: 35
firerate: 352
roundsPerShot: 1
recoilStrength: 22
currentAmmunition: 12
magazinSize: 12
totalAmmunition: 24
bulletExit: {fileID: 7014992348987952529}
toCloseToWall: 0
allowAction: 1
weaponAnimator: {fileID: 0}
gunRightREF: {fileID: 0}
gunLeftREF: {fileID: 0}
--- !u!65 &6050550425513890989
BoxCollider:
m_ObjectHideFlags: 0
@@ -114,8 +121,34 @@ BoxCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.059358627, y: 0.19563963, z: 0.2655142}
m_Center: {x: -0.00082542, y: -0.00907933, z: -0.10297042}
m_Size: {x: 0.059358627, y: 0.19563963, z: 0.1087072}
m_Center: {x: -0.00082542, y: -0.00907933, z: -0.044957932}
--- !u!65 &1514911119484970353
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880099159927430553}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.058347225, y: 0.08560109, z: 0.15380552}
m_Center: {x: -0.00016379356, y: 0.046416283, z: 0.087245554}
--- !u!65 &2772737694660170496
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880099159927430553}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.32707262, y: 0.28505918, z: 0.3238248}
m_Center: {x: -0.00073075294, y: 0.0064445883, z: 0.056424513}
--- !u!1 &4999713445390711574
GameObject:
m_ObjectHideFlags: 0
@@ -140,31 +173,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4999713445390711574}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0.7071068, w: 0}
m_LocalPosition: {x: 0.034, y: -0.0177, z: -0.2867}
m_LocalPosition: {x: 0.0425, y: -0.0467, z: -0.1904}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8797726366404580855}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: -90, y: 180, z: 0}
--- !u!95 &4797094208700084232
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6885991082275612989}
m_Enabled: 1
m_Avatar: {fileID: 9000000, guid: d1ac7df45c0d7e84993ff57afe3c4d6f, type: 3}
m_Controller: {fileID: 9100000, guid: daf332133edb41440a3abb1cf6e24558, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 1
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &7014992348987952529
GameObject:
m_ObjectHideFlags: 0
@@ -189,8 +204,9 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7014992348987952529}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.008, y: 0.055, z: 0.167}
m_LocalPosition: {x: -0.008, y: 0.055, z: 0.091}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8797726366404580855}
m_RootOrder: 1
@@ -232,7 +248,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3}
propertyPath: m_LocalPosition.z
value: 0.137
value: 0.060999997
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3}
propertyPath: m_LocalRotation.w
@@ -334,3 +350,23 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3}
m_PrefabInstance: {fileID: 6002908758433764460}
m_PrefabAsset: {fileID: 0}
--- !u!95 &4797094208700084232
Animator:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6885991082275612989}
m_Enabled: 1
m_Avatar: {fileID: 9000000, guid: d1ac7df45c0d7e84993ff57afe3c4d6f, type: 3}
m_Controller: {fileID: 9100000, guid: daf332133edb41440a3abb1cf6e24558, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 1
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0

View File

@@ -31,8 +31,8 @@ MonoBehaviour:
m_MainLightShadowsSupported: 1
m_MainLightShadowmapResolution: 2048
m_AdditionalLightsRenderingMode: 1
m_AdditionalLightsPerObjectLimit: 4
m_AdditionalLightShadowsSupported: 0
m_AdditionalLightsPerObjectLimit: 6
m_AdditionalLightShadowsSupported: 1
m_AdditionalLightsShadowmapResolution: 2048
m_AdditionalLightsShadowResolutionTierLow: 256
m_AdditionalLightsShadowResolutionTierMedium: 512
@@ -40,14 +40,14 @@ MonoBehaviour:
m_ReflectionProbeBlending: 0
m_ReflectionProbeBoxProjection: 0
m_ShadowDistance: 50
m_ShadowCascadeCount: 1
m_ShadowCascadeCount: 3
m_Cascade2Split: 0.25
m_Cascade3Split: {x: 0.1, y: 0.3}
m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467}
m_CascadeBorder: 0.2
m_ShadowDepthBias: 1
m_ShadowNormalBias: 1
m_SoftShadowsSupported: 0
m_SoftShadowsSupported: 1
m_ConservativeEnclosingSphere: 1
m_NumIterationsEnclosingSphere: 64
m_AdditionalLightsCookieResolution: 2048

View File

@@ -281,12 +281,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2992488853448454767}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.266}
m_LocalPosition: {x: 0, y: -0.085, z: 0.252}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6272346181657429396}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &3761705133811313241
GameObject:
@@ -972,9 +972,9 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4074665071222326704}
- {fileID: 1979435770070801855}
- {fileID: 1468248131875751636}
- {fileID: 4074665071222326704}
m_Father: {fileID: 981273033772084037}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -1001,15 +1001,15 @@ Camera:
y: 0
width: 1
height: 1
near clip plane: 0.1
near clip plane: 0.01
far clip plane: 1000
field of view: 61.4
orthographic: 0
orthographic size: 5
m_Depth: -1
m_Depth: 1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 2147483647
m_RenderingPath: 3
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
@@ -1057,7 +1057,7 @@ MonoBehaviour:
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 1
m_Antialiasing: 0
m_Antialiasing: 1
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
@@ -1131,7 +1131,7 @@ Transform:
- {fileID: 3309817799560628973}
- {fileID: 7900289367890373129}
m_Father: {fileID: 6272346181657429396}
m_RootOrder: 0
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &909517976577723968
MonoBehaviour:
@@ -1214,12 +1214,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8043317747957554736}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.108, y: -0.084, z: 0.266}
m_LocalPosition: {x: 0.108, y: -0.1107, z: 0.186}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6272346181657429396}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8483875681964867841
GameObject:
@@ -1663,26 +1663,6 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 01316cb596562384da845bc519fb90de, type: 3}
--- !u!1 &6576156620079053231 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &5767109144009335573 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &8334588817950881727 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -6617984589164989631, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &5739201115059209923 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1740614089614901821, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1706812538552309319 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -4598867093515939143, guid: 01316cb596562384da845bc519fb90de, type: 3}
@@ -1703,6 +1683,26 @@ Transform:
m_CorrespondingSourceObject: {fileID: -5815427104119794202, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &8334588817950881727 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -6617984589164989631, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &5739201115059209923 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1740614089614901821, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!4 &5767109144009335573 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6576156620079053231 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 01316cb596562384da845bc519fb90de, type: 3}
m_PrefabInstance: {fileID: 6305701708507383038}
m_PrefabAsset: {fileID: 0}
--- !u!95 &1978909962
Animator:
serializedVersion: 4
@@ -1840,19 +1840,9 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
--- !u!4 &365391085992511043 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6708222704297240606, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}
--- !u!4 &8787644481610465855 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2448190575139433570, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}
--- !u!1 &4484858124630204699 stripped
--- !u!1 &4484858124469057131 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7365407325624913734, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_CorrespondingSourceObject: {fileID: 7365407325767981110, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}
--- !u!4 &4484858124469057129 stripped
@@ -1860,8 +1850,18 @@ Transform:
m_CorrespondingSourceObject: {fileID: 7365407325767981108, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}
--- !u!1 &4484858124469057131 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7365407325767981110, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
--- !u!4 &8787644481610465855 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2448190575139433570, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}
--- !u!4 &365391085992511043 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6708222704297240606, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}
--- !u!1 &4484858124630204699 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7365407325624913734, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
m_PrefabInstance: {fileID: 6343958082870406749}
m_PrefabAsset: {fileID: 0}

View File

@@ -760,7 +760,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 9082234699677627348, guid: bd217f9f85ce78e46a925776562625e8, type: 3}
propertyPath: explosionForce
value: 1000
value: 800
objectReference: {fileID: 0}
- target: {fileID: 9082234699677627348, guid: bd217f9f85ce78e46a925776562625e8, type: 3}
propertyPath: explodeParticle
@@ -1727,7 +1727,8 @@ PrefabInstance:
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 7e832beb11d0b11499c8a1b3b4e52e78, type: 2}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 724190973095527901, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3}
--- !u!1 &589432432 stripped
GameObject:
@@ -2557,7 +2558,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 9082234699677627348, guid: bd217f9f85ce78e46a925776562625e8, type: 3}
propertyPath: explosionForce
value: 1000
value: 800
objectReference: {fileID: 0}
- target: {fileID: 9082234699677627348, guid: bd217f9f85ce78e46a925776562625e8, type: 3}
propertyPath: explodeParticle
@@ -5690,7 +5691,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 9082234699677627348, guid: bd217f9f85ce78e46a925776562625e8, type: 3}
propertyPath: explosionForce
value: 1000
value: 800
objectReference: {fileID: 0}
- target: {fileID: 9082234699677627348, guid: bd217f9f85ce78e46a925776562625e8, type: 3}
propertyPath: explodeParticle

View File

@@ -259,6 +259,8 @@ public class ProcedualAnimationController : NetworkBehaviour
{
if (positionMod[i] != null)
totalPosition += positionMod[i];
//if (i == 3)
//Debug.Log(positionMod[i]);
}
/*-----Apply Gun Rotation-----*/
@@ -302,18 +304,21 @@ public class ProcedualAnimationController : NetworkBehaviour
aimVal = gravityValue(aimVal, aimSpeed, 1, 0, isAiming);
positionMod[2] = Vector3.Lerp(HoldPoint.transform.localPosition, AimPoint.transform.localPosition, Mathf.Pow(aimVal, 1.3f));
}
public void weaponToCloseToWall(bool state) {
int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber(); // Only for debugging
//Debug.Log("PAC.cs (function at line:" + (lineNumber-1) + "): Weapon is to close to wall: Weapon should get upright or to normal position now depending on state!");
}
public void changePistole(bool isSwitching) { // Moves hands doooown ;) and up again NOT WORKING
//aimVal = gravityValue(aimVal, aimSpeed, 1, 0, isSwitching);
Vector3 b = new Vector3(HoldPoint.transform.localPosition.x, 1, HoldPoint.transform.localPosition.z);
//Debug.Log("HALLO: " + positionMod[3]);
//Debug.Log("PositionMod[3]: " + positionMod[3]);
positionMod[3] = Vector3.Lerp(HoldPoint.transform.localPosition, b, 0.5f);
//Debug.Log("HALLO: " + positionMod[3]);
//Debug.Log("PositionMod[3]: " + positionMod[3]);
}
public void changeRifle(bool isSwitching) { // Moves hands up and doooown again ;)
//aimVal = gravityValue(aimVal, aimSpeed, 1, 0, isSwitching);
Vector3 b = new Vector3(HoldPoint.transform.localPosition.x, HoldPoint.transform.localPosition.y + 1, HoldPoint.transform.localPosition.z);
positionMod[3] = Vector3.Lerp(HoldPoint.transform.localPosition, b, 0);
//Vector3 b = new Vector3(HoldPoint.transform.localPosition.x, HoldPoint.transform.localPosition.y + 1, HoldPoint.transform.localPosition.z);
//positionMod[3] = Vector3.Lerp(HoldPoint.transform.localPosition, b, 0);
//Debug.Log("HALLO2");
}

View File

@@ -144,7 +144,7 @@ public class Shoot : NetworkBehaviour
}
public bool setWeapon(GameObject newWeapon) {
Debug.Log("Switch weapon to: " + newWeapon.transform.name);
//Debug.Log("Switch weapon to: " + newWeapon.transform.name);
weapon = newWeapon.GetComponent<Weapon>();
curAmmo = weapon.CurrentAmmunition;
totalAmmo = weapon.TotalAmmunition;

View File

@@ -19,6 +19,7 @@ public class Weapon : MonoBehaviour
[SerializeField] int magazinSize = 0;
[SerializeField] int totalAmmunition = 0;
[SerializeField] GameObject bulletExit;
[SerializeField] bool toCloseToWall = false;
[SerializeField] bool allowAction = true;
[Header("")]
[SerializeField] Animator weaponAnimator;
@@ -37,6 +38,7 @@ public class Weapon : MonoBehaviour
public int MagazinSize { get => magazinSize; set => magazinSize = value; }
public int TotalAmmunition { get => totalAmmunition; set => totalAmmunition = value; }
public GameObject BulletExit { get => bulletExit; }
public bool ToCloseToWall { get => toCloseToWall; set => toCloseToWall = value; }
public bool AllowAction { get => allowAction; set => allowAction = value; }
public Animator WeaponAnimator { get => weaponAnimator; }
public Transform GunLeftREF { get => gunLeftREF; }
@@ -48,4 +50,13 @@ public class Weapon : MonoBehaviour
CurrentAmmunition = MagazinSize;
}
// When to close to a wall, the player puts the weapon upright (Change size on weapon collider where isTrigger == true)
/*private void OnCollisionEnter(Collision collision) {
toCloseToWall = true;
Debug.Log(collision.transform.name);
}
private void OnCollisionExit(Collision collision) {
toCloseToWall = false;
}*/
}

View File

@@ -6,11 +6,11 @@ using Mirror;
public class WeaponManager : NetworkBehaviour
{
public int currentWeaponIndex = 0;
public int currentWeaponIndex = 2; // Hand
private int lastWeaponIndex = 0;
private int counter = 0;
public List<GameObject> activeWeapons = new List<GameObject>();
private ProcedualAnimationController procedualAnimationController;
private Weapon weaponData;
[SerializeField] Shoot shoot;
[SerializeField] GameObject gunHolster;
@@ -20,6 +20,8 @@ public class WeaponManager : NetworkBehaviour
private void Awake()
{
procedualAnimationController = GetComponent<ProcedualAnimationController>();
currentWeaponIndex = 2; // Hand
weaponData = activeWeapons[currentWeaponIndex].GetComponent<Weapon>(); // Hand
}
void Update() {
@@ -45,13 +47,23 @@ public class WeaponManager : NetworkBehaviour
}
}
private void FixedUpdate() {
/*if(currentWeaponIndex != 2) {
if (weaponData.ToCloseToWall) {
procedualAnimationController.weaponToCloseToWall(true);
} else {
procedualAnimationController.weaponToCloseToWall(false);
}
}*/
}
public bool switchWeapon(int direction) {
// Get next active weapon index
int nextActive = searchForNext(activeWeapons, lastWeaponIndex, direction);
currentWeaponIndex = nextActive;
procedualAnimationController.OnSwitchWeapon(activeWeapons[currentWeaponIndex]);
shoot.setWeapon(activeWeapons[currentWeaponIndex]);
Weapon weaponData = activeWeapons[currentWeaponIndex].GetComponent<Weapon>();
weaponData = activeWeapons[currentWeaponIndex].GetComponent<Weapon>();
procedualAnimationController.GunRightHandREF = weaponData.GunRightREF;
procedualAnimationController.GunLeftHandREF = weaponData.GunLeftREF;
// Play weapon switch animation
@@ -111,7 +123,7 @@ public class WeaponManager : NetworkBehaviour
hit.rigidbody.useGravity = false;
// Disable all Collider
SetAllColliderStatus(hit.transform.gameObject, false);
// Adding weapon to inventory slot
// Adding weapon to correct inventory slot
switch (hit.transform.GetComponent<Weapon>().WeaponKind.ToString()) {
case "Rifle": putWeaponInArray(0, hit); break;
case "Pistole": putWeaponInArray(1, hit); break;

View File

@@ -119,7 +119,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 200}
m_MaxSize: {x: 32384, y: 16192}
vertical: 0
controlID: 12157
controlID: 39
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -144,7 +144,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 1
controlID: 12158
controlID: 40
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -170,7 +170,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 8096}
vertical: 0
controlID: 12159
controlID: 41
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -274,7 +274,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 12102
controlID: 61
--- !u!114 &12
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -346,8 +346,8 @@ MonoBehaviour:
y: 0
width: 461
height: 1307
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 21}
m_Panes:
- {fileID: 21}
@@ -476,9 +476,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 4e700000
m_LastClickedID: 28750
m_ExpandedIDs: ccf9ffff
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: baf8ffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -819,9 +819,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: -47.67771, y: -22.28258, z: -42.074715}
m_Target: {x: -78.60157, y: -36.421288, z: -33.39213}
speed: 2
m_Value: {x: -47.67771, y: -22.28258, z: -42.074715}
m_Value: {x: -78.60157, y: -36.421288, z: -33.39213}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@@ -868,13 +868,13 @@ MonoBehaviour:
m_GridAxis: 1
m_gridOpacity: 0.5
m_Rotation:
m_Target: {x: 0.072064266, y: -0.88201773, z: 0.14362824, w: 0.44292492}
m_Target: {x: 0.11389863, y: -0.81114566, z: 0.16859324, w: 0.54827297}
speed: 2
m_Value: {x: 0.0720657, y: -0.8820353, z: 0.1436311, w: 0.44293377}
m_Value: {x: 0.11390107, y: -0.81116307, z: 0.16859686, w: 0.5482847}
m_Size:
m_Target: 45.54132
m_Target: 55.953186
speed: 2
m_Value: 45.54132
m_Value: 55.953186
m_Ortho:
m_Target: 0
speed: 2
@@ -955,7 +955,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 04ca9a3b
m_LastClickedID: 1000000004
m_ExpandedIDs: 00000000d2760000d4760000d676000000ca9a3b
m_ExpandedIDs: 000000000c7600000e7600001076000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -983,7 +983,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000d2760000d4760000d676000000ca9a3b
m_ExpandedIDs: 000000000c7600000e76000010760000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name: