files arranged using assembly defn

This commit is contained in:
Mausham
2025-12-16 18:12:45 -08:00
parent 4f1a6365fe
commit 04b1e3127c
144 changed files with 1207 additions and 1425 deletions

View File

@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 19b4667bfc2bc924a80a7fb0cd8c24f9, type: 3}
m_Name: GameSession
m_EditorClassIdentifier: Assembly-CSharp::GameSession

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 166236fc288d5a343ba6dd8ab704e653
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using Darkmatter.Core;
using UnityEngine;
namespace Darkmatter.Core
{
[CreateAssetMenu(fileName = "GameSessionSO", menuName = "Scriptable Objects/GameSessionSO")]
public class GameSessionSO : ScriptableObject, IGameSession
{
public bool showStartScreen { get; set; } = false;
public bool hasGameStarted { get; set; } = false;
private void OnEnable()
{
showStartScreen = true;
hasGameStarted = false;
}
private void OnDisable()
{
showStartScreen = false;
hasGameStarted = false;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 19b4667bfc2bc924a80a7fb0cd8c24f9

View File

@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8320650719108c947a83626711fe4964, type: 3}
m_Name: InputReaderSO
m_EditorClassIdentifier: Assembly-CSharp::InputReaderSO

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dfe12148dc4d7ea46b49e490c1b1aad5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
using Darkmatter.Core;
using System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Darkmatter.Core
{
[CreateAssetMenu(fileName = "InputReaderSO", menuName = "Scriptable Objects/InputReaderSO")]
public class InputReaderSO : ScriptableObject, GameInputAction.IPlayerActions, IInputReader
{
public event Action<Vector2> OnDragValueChanged;
public Vector2 dragInput
{
get => _dragInput;
private set
{
_dragInput = value;
OnDragValueChanged?.Invoke(_dragInput);
}
}
public bool isMouseButtonPressed { get; private set; }
private Vector2 _dragInput;
private GameInputAction action;
private void OnEnable()
{
if (action == null) action = new GameInputAction();
action.Enable();
action.Player.SetCallbacks(this);
isMouseButtonPressed = false;
}
private void OnDisable()
{
action.Player.Disable();
}
public void OnDrag(InputAction.CallbackContext context)
{
dragInput = context.ReadValue<Vector2>();
}
public void OnMouseClicked(InputAction.CallbackContext context)
{
isMouseButtonPressed = context.ReadValue<float>() == 1 ? true : false;
}
public void LockInput()
{
action.Player.Disable();
}
public void UnlockInput()
{
action.Player.Enable();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8320650719108c947a83626711fe4964

View File

@@ -0,0 +1,33 @@
using Darkmatter.Core;
using System;
using UnityEngine;
namespace Darkmatter.Core
{
public class ScoreService : IScoreService
{
public event Action<int> OnScoreChange;
public int score { get; private set; }
public int highScore { get; private set; } = PlayerPrefs.GetInt("HighScore");
public void AddScore()
{
score += 5;
if (score > highScore)
{
SetNewHighScore();
}
OnScoreChange?.Invoke(score);
}
private void SetNewHighScore()
{
highScore = score;
PlayerPrefs.SetInt("HighScore", highScore);
PlayerPrefs.Save();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 63293fe85cd298c4a81aec8cd5c0f43f