diff --git a/Assets/Prefabs/Input/ItemSelectPlayer.prefab b/Assets/Prefabs/Input/ItemSelectPlayer.prefab index 76c99cba8..112ab4810 100644 --- a/Assets/Prefabs/Input/ItemSelectPlayer.prefab +++ b/Assets/Prefabs/Input/ItemSelectPlayer.prefab @@ -59,7 +59,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -422,6 +422,37 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &1774344270387469849 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3467480324082098118} + m_Layer: 0 + m_Name: CameraPosition + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3467480324082098118 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1774344270387469849} + 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: 6154156806219520954} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2107993084595849544 GameObject: m_ObjectHideFlags: 0 @@ -481,7 +512,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -763,7 +794,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 3674956699687347171} - - component: {fileID: 7807628609430061806} m_Layer: 5 m_Name: BodySelector m_TagString: Untagged @@ -794,50 +824,6 @@ RectTransform: m_AnchoredPosition: {x: -365, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &7807628609430061806 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4100832615712485931} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 4 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 491408592496957222} - m_SelectOnRight: {fileID: 706152255002025682} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 1, g: 0.32156864, b: 0.32156864, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 8075959133707509648} - m_OnClick: - m_PersistentCalls: - m_Calls: [] --- !u!1 &4975805346272595057 GameObject: m_ObjectHideFlags: 0 @@ -1129,7 +1115,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 5064738011926576917} + - {fileID: 3467480324082098118} - {fileID: 1938151450599313512} - {fileID: 8894830759317476662} m_Father: {fileID: 0} @@ -1153,9 +1139,16 @@ MonoBehaviour: - {fileID: 1835420195716879589} - {fileID: 7760025129845217879} - {fileID: 3554179976705927318} + canvas: {fileID: 8642731799569895425} timer: {fileID: 8546860006739031995} - defaultSelector: {fileID: 7807628609430061806} + defaultSelector: {fileID: 0} timerText: {fileID: 7705336065034340431} + cameraPosition: {fileID: 3467480324082098118} + bodySelect: {fileID: 8075959133707509648} + barrelSelect: {fileID: 7665611240240976438} + extensionSelect: {fileID: 4222000554002073790} + selectedColor: {r: 1, g: 0.32156864, b: 0.32156864, a: 1} + defaultColor: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} --- !u!114 &8546860006739031995 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1171,142 +1164,6 @@ MonoBehaviour: baseWaitTime: 0 additionalWaitTime: 0 repeat: 0 ---- !u!1 &7353474018953128622 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5064738011926576917} - - component: {fileID: 4723430610078133016} - - component: {fileID: 4046958902308538921} - - component: {fileID: 4355902451662366583} - m_Layer: 0 - m_Name: Camera - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &5064738011926576917 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7353474018953128622} - 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: 6154156806219520954} - m_RootOrder: -1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!20 &4723430610078133016 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7353474018953128622} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!81 &4046958902308538921 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7353474018953128622} - m_Enabled: 1 ---- !u!114 &4355902451662366583 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7353474018953128622} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_RenderShadows: 1 - m_RequiresDepthTextureOption: 2 - m_RequiresOpaqueTextureOption: 2 - m_CameraType: 0 - m_Cameras: [] - m_RendererIndex: -1 - m_VolumeLayerMask: - serializedVersion: 2 - m_Bits: 1 - m_VolumeTrigger: {fileID: 0} - m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 0 - m_Antialiasing: 0 - m_AntialiasingQuality: 2 - m_StopNaN: 0 - m_Dithering: 0 - m_ClearDepth: 1 - m_AllowXRRendering: 1 - m_UseScreenCoordOverride: 0 - m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} - m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} - m_RequiresDepthTexture: 0 - m_RequiresColorTexture: 0 - m_Version: 2 - m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 --- !u!1 &7506024999133928506 GameObject: m_ObjectHideFlags: 0 @@ -1366,7 +1223,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -1392,7 +1249,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4022023894807504867} - - component: {fileID: 706152255002025682} m_Layer: 5 m_Name: BarrelSelector m_TagString: Untagged @@ -1423,50 +1279,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &706152255002025682 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7914990485453685338} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 4 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 7807628609430061806} - m_SelectOnRight: {fileID: 491408592496957222} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 1, g: 0.36862746, b: 0.32156864, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 7665611240240976438} - m_OnClick: - m_PersistentCalls: - m_Calls: [] --- !u!1 &7934280944440872868 GameObject: m_ObjectHideFlags: 0 @@ -1476,7 +1288,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5027557325281688046} - - component: {fileID: 491408592496957222} m_Layer: 5 m_Name: ExtensionSelector m_TagString: Untagged @@ -1507,50 +1318,6 @@ RectTransform: m_AnchoredPosition: {x: 365, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &491408592496957222 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7934280944440872868} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 4 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 706152255002025682} - m_SelectOnRight: {fileID: 7807628609430061806} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 0.22745098, g: 0.21176471, b: 0.18431373, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 1, g: 0.32156864, b: 0.32156864, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 4222000554002073790} - m_OnClick: - m_PersistentCalls: - m_Calls: [] --- !u!1 &8432985527125420546 GameObject: m_ObjectHideFlags: 0 @@ -1602,9 +1369,9 @@ Canvas: m_Enabled: 1 serializedVersion: 3 m_RenderMode: 1 - m_Camera: {fileID: 4723430610078133016} + m_Camera: {fileID: 0} m_PlaneDistance: 100 - m_PixelPerfect: 0 + m_PixelPerfect: 1 m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 @@ -1627,7 +1394,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: m_EditorClassIdentifier: - m_UiScaleMode: 0 + m_UiScaleMode: 1 m_ReferencePixelsPerUnit: 100 m_ScaleFactor: 1 m_ReferenceResolution: {x: 800, y: 600} diff --git a/Assets/Scripts/Auction/AuctionDriver.cs b/Assets/Scripts/Auction/AuctionDriver.cs index 7b1636758..e7c881320 100644 --- a/Assets/Scripts/Auction/AuctionDriver.cs +++ b/Assets/Scripts/Auction/AuctionDriver.cs @@ -38,6 +38,7 @@ public class AuctionDriver : MonoBehaviour [SerializeField] private Animator cameraAnimator; + public GameObject Camera => cameraAnimator.gameObject; public static AuctionDriver Singleton; diff --git a/Assets/Scripts/Control&Input/ItemSelectManager.cs b/Assets/Scripts/Control&Input/ItemSelectManager.cs index 606cb002f..eab721216 100644 --- a/Assets/Scripts/Control&Input/ItemSelectManager.cs +++ b/Assets/Scripts/Control&Input/ItemSelectManager.cs @@ -14,6 +14,9 @@ public class ItemSelectManager : MonoBehaviour private Item defaultBarrelItem; [SerializeField] private Transform[] itemSpawnPoints; + + [SerializeField] + private Canvas canvas; private List bodies = new List(); private List barrels = new List(); @@ -26,7 +29,6 @@ public class ItemSelectManager : MonoBehaviour private InputManager inputManager; [SerializeField] private Selectable defaultSelector; - private GameObject currentSelectorObject; private Vector2 moveInput; private int bodyIndex; private int barrelIndex; @@ -34,14 +36,31 @@ public class ItemSelectManager : MonoBehaviour [SerializeField] private TMP_Text timerText; private const float errorMarginInput = 0.1f; + private bool gamepadMoveReady = true; + public Transform cameraPosition; + + [SerializeField] + private Image bodySelect; + [SerializeField] + private Image barrelSelect; + [SerializeField] + private Image extensionSelect; + [SerializeField] + private Color selectedColor; + [SerializeField] + private Color defaultColor; + private int selectedIndex = 0; void Start() { - - SelectControl(defaultSelector); + bodySelect.color = selectedColor; } - public void SpawnItems(InputManager inputManager){ + public IEnumerator SpawnItems(InputManager inputManager){ + + //Without this line it is arbitrary whether an item from aucion is transferred + yield return null; this.inputManager = inputManager; + canvas.worldCamera = inputManager.GetComponent(); bodyItems = inputManager.gameObject.GetComponent().Bodies; barrelItems = inputManager.gameObject.GetComponent().Barrels; @@ -69,14 +88,19 @@ public void SpawnItems(InputManager inputManager){ extensions.Count != 0 ? extensions[extensionIndex] : null, itemSpawnPoints[2]); + yield return null; + yield return null; + inputManager.onMovePerformed += MoveInputPerformed; + inputManager.onMoveCanceled += MoveInputCanceled; - timer.StartTimer(10f); + timer.StartTimer(20f); timer.OnTimerUpdate += UpdateTimer; timer.OnTimerRunCompleted += ChangeScene; timer.OnTimerRunCompleted += SetLoadout; timer.OnTimerRunCompleted -= UpdateTimer; + } private void ChangeItemDisplayed(GameObject previousItem,GameObject nextItem,Transform itemSpawnPoint){ @@ -99,6 +123,7 @@ private void ChangeItemDisplayed(GameObject previousItem,GameObject nextItem,Tra } } + private void InstantiateItems(List items, Item defaultItem, Transform itemSpawnPoint, List itemObjects){ if(defaultItem != null && !items.Contains(defaultItem)) items.Insert(0,defaultItem); @@ -112,22 +137,60 @@ private void InstantiateItems(List items, Item defaultItem, Transform item } private void MoveInputPerformed(InputAction.CallbackContext ctx) { + Debug.Log("moved"); moveInput = ctx.ReadValue(); Debug.Log(moveInput); - currentSelectorObject = EventSystem.current.currentSelectedGameObject; - Debug.Log(currentSelectorObject.name); - if(moveInput.y > 1 - errorMarginInput){ + if(moveInput.y > 1 - errorMarginInput && gamepadMoveReady){ Debug.Log("up"); MoveUpPerformed(); - }else if (moveInput.y < -1 + errorMarginInput){ + gamepadMoveReady = false; + StartCoroutine(gamepadMoveDelay()); + }else if (moveInput.y < -1 + errorMarginInput && gamepadMoveReady){ MoveDownPerformed(); + gamepadMoveReady = false; + StartCoroutine(gamepadMoveDelay()); + + }else if (moveInput.x < -1 + errorMarginInput && gamepadMoveReady){ + selectedIndex--; + selectedIndex = selectedIndex < 0 ? 2 : selectedIndex; + gamepadMoveReady = false; + StartCoroutine(gamepadMoveDelay()); + + }else if (moveInput.x > 1 - errorMarginInput && gamepadMoveReady){ + selectedIndex++; + selectedIndex = selectedIndex > 2 ? 0 : selectedIndex; + gamepadMoveReady = false; + StartCoroutine(gamepadMoveDelay()); } + bodySelect.color = defaultColor; + barrelSelect.color = defaultColor; + extensionSelect.color = defaultColor; + Debug.Log("SelectedIndex was " + selectedIndex); + switch (selectedIndex){ + case 0: + bodySelect.color = selectedColor; + break; + case 1: + barrelSelect.color = selectedColor; + break; + case 2: + extensionSelect.color = selectedColor; + break; + } + } + private IEnumerator gamepadMoveDelay(){ + yield return new WaitForSeconds(0.2f); + gamepadMoveReady = true; + } + private void MoveInputCanceled(InputAction.CallbackContext ctx) + { + moveInput = Vector2.zero; } private void MoveUpPerformed(){ - switch(currentSelectorObject.name) + switch(selectedIndex) { - case "BodySelector": + case 0: Debug.Log("bodyIndexBefore" + bodyIndex); if(bodyIndex == bodies.Count - 1){ @@ -139,7 +202,7 @@ private void MoveUpPerformed(){ } Debug.Log("bodyIndexAfter" + bodyIndex); break; - case "BarrelSelector": + case 1: Debug.Log("barrelIndexBefore" + barrelIndex); if(barrelIndex == barrels.Count - 1){ barrelIndex = 0; @@ -152,7 +215,7 @@ private void MoveUpPerformed(){ Debug.Log("barrelIndexAfter" + barrelIndex); break; - case "ExtensionSelector": + case 2: Debug.Log("extensionIndexBefore" + extensionIndex); if(extensionIndex == extensions.Count - 1){ @@ -169,9 +232,9 @@ private void MoveUpPerformed(){ } private void MoveDownPerformed(){ - switch(currentSelectorObject.name) + switch(selectedIndex) { - case "BodySelector": + case 0: Debug.Log("bodyIndexBefore" + bodyIndex); if(bodyIndex == 0){ @@ -184,7 +247,7 @@ private void MoveDownPerformed(){ Debug.Log("bodyIndexAfter" + bodyIndex); break; - case "BarrelSelector": + case 1: Debug.Log("barrelIndexBefore" + barrelIndex); if(barrelIndex == 0){ @@ -198,7 +261,7 @@ private void MoveDownPerformed(){ Debug.Log("barrelIndexAfter" + barrelIndex); break; - case "ExtensionSelector": + case 2: Debug.Log("extensionIndexBefore" + extensionIndex); if(extensions.Count != 0){ @@ -222,7 +285,10 @@ public void SetLoadout(){ barrelItems[barrelIndex], extensionItems.Count != 0 ? extensionItems[extensionIndex] : null); } - + private void OnDestroy() { + //inputManager.onMovePerformed -= MoveInputPerformed; + //inputManager.onMoveCanceled -= MoveInputCanceled; + } private void ChangeScene(){ AuctionDriver.Singleton.ChangeScene(); } @@ -233,7 +299,6 @@ public void SelectControl(Selectable target) private IEnumerator WaitSelect(Selectable target) { yield return null; - target.Select(); } private void UpdateTimer() { diff --git a/Assets/Scripts/Gamestate/PlayerFactory.cs b/Assets/Scripts/Gamestate/PlayerFactory.cs index 85a7a8c59..47565d056 100644 --- a/Assets/Scripts/Gamestate/PlayerFactory.cs +++ b/Assets/Scripts/Gamestate/PlayerFactory.cs @@ -12,6 +12,7 @@ public class PlayerFactory : MonoBehaviour private Transform[] spawnPoints; [SerializeField] private GameObject playerSelectItemPrefab; + private float spawnInterval = 0f; private PlayerInputManagerController playerInputManagerController; [SerializeField] @@ -111,10 +112,21 @@ private void InstantiateBiddingPlayer(InputManager inputManager, Transform spawn } private void InstantiateItemSelectPlayer(InputManager inputManager, Transform spawnPoint) { - GameObject player = Instantiate(playerSelectItemPrefab, spawnPoint.position + new Vector3(1000f,1000f,0), spawnPoint.rotation); - player.GetComponent().SpawnItems(inputManager); - - - + + gameObject.GetComponent().Camera.GetComponent().enabled = false; + inputManager.GetComponent().enabled = true; + inputManager.gameObject.SetActive(false); + PlayerInputManagerController.Singleton.playerInputManager.splitScreen = true; + + inputManager.gameObject.SetActive(true); + spawnInterval += 10000f; + GameObject player = Instantiate(playerSelectItemPrefab, spawnPoint.position + new Vector3(spawnInterval,spawnInterval,0), spawnPoint.rotation); + //player.LeanRotateY(rotationCamera, 0.1f); + + Camera playerCamera = inputManager.GetComponent(); + playerCamera.transform.position = player.GetComponent().cameraPosition.transform.position; + //playerCamera.gameObject.LeanRotateY(rotationCamera, 0.1f); + //rotationCamera += 90f; + StartCoroutine(player.GetComponent().SpawnItems(inputManager)); } }