diff --git a/Assets/Scenes/DevRoom.unity b/Assets/Scenes/DevRoom.unity index 4db804aae8d2f4b887ebefb8acca68ae154daf9b..366c2beca371d2c5ef5cf30e1338e670a70e67b8 100644 --- a/Assets/Scenes/DevRoom.unity +++ b/Assets/Scenes/DevRoom.unity @@ -391,7 +391,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 48414 + surfaceParameter: 48106 meshQueryIndex: 6 subMeshQueryIndex: 0 geometryHashValue: 3240074839323548863 @@ -934,7 +934,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 48310 + surfaceParameter: 47716 meshQueryIndex: 7 subMeshQueryIndex: 0 geometryHashValue: 3008546525906852216 @@ -1892,102 +1892,6 @@ MonoBehaviour: - EdgeIndices: 14000000150000001600000017000000 TexGenIndex: 5 Generation: 33 ---- !u!1 &215302726 -GameObject: - m_ObjectHideFlags: 17 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 215302729} - - component: {fileID: 215302728} - - component: {fileID: 215302727} - m_Layer: 0 - m_Name: '[default-CSGModel]' - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 124 - m_IsActive: 1 ---- !u!54 &215302727 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 215302726} - serializedVersion: 4 - m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 - m_CenterOfMass: {x: 0, y: 0, z: 0} - m_InertiaTensor: {x: 1, y: 1, z: 1} - m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ImplicitCom: 1 - m_ImplicitTensor: 1 - m_UseGravity: 0 - m_IsKinematic: 1 - m_Interpolate: 0 - m_Constraints: 126 - m_CollisionDetection: 0 ---- !u!114 &215302728 -MonoBehaviour: - m_ObjectHideFlags: 17 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 215302726} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8672dcc90e16b0a489a41edf56e016f8, type: 3} - m_Name: - m_EditorClassIdentifier: - PrefabBehaviour: 0 - PrefabSourceAlignment: 4 - PrefabDestinationAlignment: 0 - Version: 1.1 - infiniteBrush: {fileID: 0} - Settings: 1025 - VertexChannels: 14 - ReceiveGI: 2 - MeshColliderCookingOptions: 14 - ShowGeneratedMeshes: 0 - DefaultPhysicsMaterial: {fileID: 13400000, guid: 0c5fdfb44d6f19646a41a0720fbf751a, type: 2} - exportType: 0 - originType: 0 - exportColliders: 0 - exportPath: - angleError: 1 - areaError: 1 - hardAngle: 60 - packMargin: 20 - scaleInLightmap: 1 - autoUVMaxDistance: 0.5 - autoUVMaxAngle: 89 - minimumChartSize: 4 ---- !u!4 &215302729 -Transform: - m_ObjectHideFlags: 17 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 215302726} - serializedVersion: 2 - 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: 944518716} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &224671921 GameObject: m_ObjectHideFlags: 0 @@ -4259,7 +4163,7 @@ MonoBehaviour: meshQuery: layers: 33554440 maskAndChannels: 8 - surfaceParameter: 48282 + surfaceParameter: 49424 meshQueryIndex: 2 subMeshQueryIndex: 0 geometryHashValue: -1365392548276624071 @@ -5293,7 +5197,7 @@ MonoBehaviour: meshQuery: layers: 33554440 maskAndChannels: 8 - surfaceParameter: 48282 + surfaceParameter: 49424 meshQueryIndex: 2 subMeshQueryIndex: 0 geometryHashValue: -1365392548276624071 @@ -5974,53 +5878,6 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c21e0108f08f0d74b92e3576ec7a7ecc, type: 3} ---- !u!1 &944518715 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 944518716} - - component: {fileID: 944518717} - m_Layer: 0 - m_Name: '[generated-meshes]' - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &944518716 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 944518715} - serializedVersion: 2 - 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: [] - m_Father: {fileID: 215302729} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &944518717 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 944518715} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5c3643d4978096d4880d7edbf4f65a50, type: 3} - m_Name: - m_EditorClassIdentifier: - Version: 1 - owner: {fileID: 215302728} - helperSurfaces: [] --- !u!1 &954295819 GameObject: m_ObjectHideFlags: 0 @@ -7517,7 +7374,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 48332 + surfaceParameter: 47778 meshQueryIndex: 0 subMeshQueryIndex: 0 geometryHashValue: -2436489981782101099 @@ -7908,7 +7765,7 @@ Transform: m_GameObject: {fileID: 1193742993} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0.2, y: 0.8, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -9845,7 +9702,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 48048 + surfaceParameter: 47626 meshQueryIndex: 8 subMeshQueryIndex: 0 geometryHashValue: 6467234982613496563 @@ -10666,7 +10523,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 47802 + surfaceParameter: 47916 meshQueryIndex: 1 subMeshQueryIndex: 0 geometryHashValue: 8624144165243009415 @@ -12422,7 +12279,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 47926 + surfaceParameter: 47674 meshQueryIndex: 9 subMeshQueryIndex: 0 geometryHashValue: -2774585206094123893 @@ -13698,4 +13555,3 @@ SceneRoots: - {fileID: 354420149} - {fileID: 1899092101} - {fileID: 1298502551} - - {fileID: 215302729} diff --git a/Assets/_Scripts/Core/Objects/Weapons/TestWeapon/TestWeapon.cs b/Assets/_Scripts/Core/Objects/Weapons/TestWeapon/TestWeapon.cs index 0562fcee2d841f4c1f9b2dc9193cba5a4a61490f..16dff155892c86d36cac11b2f138b5657cbe6295 100644 --- a/Assets/_Scripts/Core/Objects/Weapons/TestWeapon/TestWeapon.cs +++ b/Assets/_Scripts/Core/Objects/Weapons/TestWeapon/TestWeapon.cs @@ -12,6 +12,8 @@ public class TestWeapon : WeaponObject public float projectileSpeed = 100; public TestWeaponAnimationController animationController; + // public MonoBehaviour CompanionController => this; + // Constructor protected new void Start() { diff --git a/Assets/_Scripts/Core/Player/Player.cs b/Assets/_Scripts/Core/Player/Player.cs index a0437436c38ff91ebfcfd74c667d3db2e2565f59..19d64b0ec0337f54ba35bf643c97f12ceb3bc2ab 100644 --- a/Assets/_Scripts/Core/Player/Player.cs +++ b/Assets/_Scripts/Core/Player/Player.cs @@ -7,6 +7,7 @@ public class Player : PlayerEntity { // Static Attributes public const string ObjectIdPrefix = "Player"; + private int currentIndex = 0; // Attributes private PlayerAnimationController animationController; @@ -32,7 +33,8 @@ public class Player : PlayerEntity // TODO: These are for dev, consider deleting - WeaponList.AddRange(GetComponentsInChildren<WeaponObject>()); + // WeaponList.AddRange(GetComponentsInChildren<WeaponObject>()); + EquipWeapon(0); int initialIndex = CompanionList.Count; @@ -90,21 +92,22 @@ public class Player : PlayerEntity stateController.currentInteractables.Remove(interactable); } - // Switches to the next weapon in the list public void SwitchWeapon() { - if (WeaponList.Count == 0) - { - Debug.LogWarning("No weapons available."); - return; - } - - int currentIndex = WeaponList.IndexOf(Weapon); - int nextIndex = (currentIndex + 1) % WeaponList.Count; // Calculate the index of the next weapon - - EquipCurrWeapon(nextIndex); - Debug.Log("Weapon switch SwitchWeapon Player.cs"); + if (WeaponList.Count == 0) + { + Debug.LogWarning("No weapons available."); + return; } + Debug.Log($"WEAPON {WeaponList.Count}"); + + currentIndex = (currentIndex + 1) % WeaponList.Count; // Increment currentIndex and wrap it around if it's equal to WeaponList.Count + + Debug.Log(currentIndex); + + EquipWeapon(currentIndex); + Debug.Log("Weapon switch SwitchWeapon Player.cs"); +} // Equip a weapon by index