diff --git a/Assets/Scenes/TestScene.unity b/Assets/Scenes/TestScene.unity index 33a5ec3..da18163 100644 --- a/Assets/Scenes/TestScene.unity +++ b/Assets/Scenes/TestScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -659,6 +659,88 @@ MeshCollider: m_Convex: 0 m_CookingOptions: 30 m_Mesh: {fileID: -2138796739762357153, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3} +--- !u!1001 &680590968 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1672832146417829139, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: weaponKind + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1880099159927430553, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_Name + value: GranadeUSP 1 (1) + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_RootOrder + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalPosition.x + value: 10.12892 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalPosition.y + value: 0.30300653 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalRotation.w + value: 0.9999914 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalRotation.z + value: 0.0041435333 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8797726366404580855, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0.475 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} +--- !u!1 &680590969 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1880099159927430553, guid: 6f5ccb6e55f1676429c170257dc7a411, type: 3} + m_PrefabInstance: {fileID: 680590968} + m_PrefabAsset: {fileID: 0} +--- !u!54 &680590970 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 680590969} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -909,6 +991,92 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3} +--- !u!1001 &863637338 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_RootOrder + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalPosition.x + value: 10.188591 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalPosition.y + value: 0.51 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalPosition.z + value: 1.174 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5071598280516985511, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_Name + value: M92 (1) + objectReference: {fileID: 0} + - target: {fileID: 5071598280516985511, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: m_TagString + value: Weapon + objectReference: {fileID: 0} + - target: {fileID: 5204381087217674634, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + propertyPath: weaponKind + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: bd217f9f85ce78e46a925776562625e8, type: 3} +--- !u!1 &863637339 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5071598280516985511, guid: bd217f9f85ce78e46a925776562625e8, type: 3} + m_PrefabInstance: {fileID: 863637338} + m_PrefabAsset: {fileID: 0} +--- !u!54 &863637340 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 863637339} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 --- !u!1 &1035340512 stripped GameObject: m_CorrespondingSourceObject: {fileID: -208595431880416365, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3} diff --git a/Assets/Scripts/Weapons/WeaponManager.cs b/Assets/Scripts/Weapons/WeaponManager.cs index 7719514..12ec4f0 100644 --- a/Assets/Scripts/Weapons/WeaponManager.cs +++ b/Assets/Scripts/Weapons/WeaponManager.cs @@ -78,22 +78,22 @@ public class WeaponManager : NetworkBehaviour } private int SearchForNext(List l, int lastActive = 0, int direction = 1) { - int size = l.Count-1; + int size = l.Count; bool condition = true; if (lastActive <= -1) { lastActive = size; } if(lastActive >= l.Count) { lastActive = 0; } for (int i = lastActive+direction; condition; i+= direction) { - if (i >= l.Count-1) { i = 0; size = lastActive+1; } - else if(i < 0) { i = size; size = -1; } + if (i >= l.Count) { i = 0; size = lastActive; } + else if(i < 0) { i = size-1; size = -1; } if (l[i] != null) { if(l[lastActive] != null) { l[lastActive].SetActive(false); } return i; } if (direction == 1) { - if (i < size + 1) { condition = true; } + if (i <= size-1) { condition = true; } else { condition = false; } }else if(direction == -1) { - if (i > size + 1) { condition = true; } + if (i >= size-1) { condition = true; } else { condition = false; } } }