input refactored

This commit is contained in:
Mausham
2025-12-15 21:51:34 +05:45
parent a166fe2861
commit 05287c4b73
10 changed files with 41 additions and 25 deletions

View File

@@ -116,8 +116,8 @@ Material:
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.98039216, g: 0.40243432, b: 0.050980378, a: 1}
- _Color: {r: 0.98039216, g: 0.4024343, b: 0.05098036, a: 1}
- _BaseColor: {r: 0.55360657, g: 0.6886792, b: 0.12019401, a: 1}
- _Color: {r: 0.55360657, g: 0.6886792, b: 0.12019398, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -116,8 +116,8 @@ Material:
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _BaseColor: {r: 0.8584906, g: 0.09138395, b: 0.08503916, a: 1}
- _Color: {r: 0.8584906, g: 0.09138393, b: 0.08503913, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -116,8 +116,8 @@ Material:
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -12404,14 +12404,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.7924528, g: 0.7924528, b: 0.7924528, a: 1}
m_Color: {r: 0.5660378, g: 0.5660378, b: 0.5660378, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 0e80aeef40cacfd48992718e49d75fac, type: 3}
m_Sprite: {fileID: 21300000, guid: 1f9987f7b014f424e9fcea3949340146, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -13369,7 +13369,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1613812280
RectTransform:
m_ObjectHideFlags: 0

View File

@@ -1,4 +1,5 @@
using System;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.InputSystem;
@@ -15,8 +16,6 @@ public class InputReaderSO : ScriptableObject, GameInputAction.IPlayerActions ,
}
public bool isMouseButtonPressed { get;private set; }
private bool blockedInput = false;
private Vector2 _dragInput;
private GameInputAction action;

View File

@@ -8,7 +8,9 @@ public class PlatformManager : MonoBehaviour,IPlatformManager
private float yPos = 0f;
public float rotSpeed = 5f;
private float rotAmount;
private float targetRotAmount;
private float smoothRotAmount;
private void Start()
{
@@ -26,7 +28,18 @@ public class PlatformManager : MonoBehaviour,IPlatformManager
}
private void LateUpdate()
{
transform.Rotate(Vector3.up * rotAmount);
#if UNITY_EDITOR || UNITY_STANDALONE
if (!inputReader.isMouseButtonPressed) return;
#endif
smoothRotAmount = Mathf.MoveTowards(
smoothRotAmount,
targetRotAmount,
Time.deltaTime * 80f
);
transform.Rotate(Vector3.up * smoothRotAmount, Space.World);
}
void ShowPlatforms()
{
@@ -47,18 +60,11 @@ public class PlatformManager : MonoBehaviour,IPlatformManager
private void HandleDrag(Vector2 drag)
{
rotAmount = -drag.normalized.x * rotSpeed;
float raw = drag.x / Screen.width;
//#if UNITY_EDITOR || UNITY_STANDALONE
// if (!inputReader.isMouseButtonPressed) return;
// transform.Rotate(Vector3.up * rotAmount);
//#elif UNITY_IOS || UNITY_ANDROID
// transform.Rotate(Vector3.up * rotAmount * DPI);
//#endif
//transform.Rotate(Vector3.up * rotAmount);
targetRotAmount = -raw * rotSpeed * 180f;
targetRotAmount = Mathf.Clamp(targetRotAmount, -10f,10f);
}
}

View File

@@ -12,6 +12,7 @@ public class DeathScreenController:IDeathScreenController
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
[Inject] private IGameScreenController IgameScreenController;
public DeathScreenController(DeathScreenView _deathScreenView)
{
deathScreenView = _deathScreenView;
@@ -21,6 +22,7 @@ public class DeathScreenController:IDeathScreenController
public void ShowDeathScreen()
{
IgameScreenController.HideGameScreen();
deathScreenView.Show(IscoreService.score,IscoreService.highScore);
}
@@ -38,6 +40,7 @@ public class DeathScreenController:IDeathScreenController
Debug.Log("Restart Button Clicked");
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
IgameSession.showStartScreen = false;
SceneManager.LoadScene(0);
}
}

View File

@@ -33,6 +33,11 @@ public class GameScreenController: IGameScreenController
gameScreenView.Show();
}
public void HideGameScreen()
{
gameScreenView.Hide();
}
public void OnPauseButtonClicked()
{
IaudioController.PlayBtnPressedSound();
@@ -45,4 +50,5 @@ public class GameScreenController: IGameScreenController
public interface IGameScreenController {
void ShowGameScreen();
void HideGameScreen();
}

View File

@@ -8,6 +8,7 @@ public class PauseScreenController:IPauseScreenController
private PauseScreenView pauseScreenView;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
public PauseScreenController(PauseScreenView _pauseScreenView)
{
@@ -26,6 +27,7 @@ public class PauseScreenController:IPauseScreenController
Time.timeScale = 1.0f;
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
IgameSession.showStartScreen = false;
SceneManager.LoadScene(0); //Restart This Scene
}

View File

@@ -548,8 +548,8 @@ PlayerSettings:
m_APIs: 10000000
m_Automatic: 1
- m_BuildTarget: AndroidPlayer
m_APIs: 0b00000015000000
m_Automatic: 1
m_APIs: 0b000000
m_Automatic: 0
m_BuildTargetVRSettings: []
m_DefaultShaderChunkSizeInMB: 16
m_DefaultShaderChunkCount: 0