Initial commit

This commit is contained in:
Mausham Neupane
2026-01-05 00:11:51 +05:45
commit 05ee499ce3
2015 changed files with 835249 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 93a4de42455f8314a8c151cad36eeae7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
{
"name": "AppAssembly",
"rootNamespace": "Darkmatter.App",
"references": [
"GUID:cf1df9e1968a94c4686f2fbe5ef907fc",
"GUID:23f9a018fbd2e1242a0525718cc761d6",
"GUID:00bcf444fe1ffd8468345b96caa37633",
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc",
"GUID:4307f53044263cf4b835bd812fc161a4"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 634a2668b4427c140ab4cd0b6ff07cf0
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b97998e69a0f10b49982804ea1cbc704
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
using VContainer;
using VContainer.Unity;
using UnityEngine;
using Darkmatter.Core;
using Darkmatter.Presentation;
using Darkmatter.Domain;
using System.Collections.Generic;
namespace Darkmatter.App
{
public class GameLifetimeScope : LifetimeScope
{
[SerializeField] private InputReaderSO inputReader;
[SerializeField] private PlayerMotor playerMotor;
[SerializeField] private PlayerAnimController playerAnim;
[SerializeField] private PlayerConfigSO playerConfig;
[SerializeField] private CameraConfigSO cameraConfig;
[SerializeField] private CameraService camService;
[SerializeField] private GunWeapon gunWeapon;
[SerializeField] private PlayerAimTargetProvider TargetProvider;
[SerializeField] private AudioService audioService;
[Header("UI Settings")]
[SerializeField] private GameScreenView gameScreenView;
[Header("Factory parameters")]
[SerializeField] private Transform playerTransform;
[SerializeField] private GameObject fatZombie;
[SerializeField] private GameObject SlimZombie;
[SerializeField] private List<Transform> patrolPoints;
[SerializeField] private EnemiesSpawnner spawnner;
protected override void Configure(IContainerBuilder builder)
{
builder.RegisterEntryPoint<PlayerController>(Lifetime.Scoped);
builder.RegisterComponent<IPlayerAnim>(playerAnim);
builder.RegisterComponent<IInputReader>(inputReader);
builder.RegisterComponent<IPlayerPawn>(playerMotor);
builder.RegisterComponent<ITargetProvider>(TargetProvider);
builder.RegisterComponent(playerConfig);
builder.RegisterComponent(cameraConfig);
builder.RegisterComponent<ICameraService>(camService);
builder.RegisterComponent<IReloadableWeapon>(gunWeapon);
builder.RegisterComponent(spawnner);
builder.RegisterComponent<IAudioService>(audioService);
builder.Register<PlayerStateMachine>(Lifetime.Scoped);
builder.Register<IEnemyFactory>(c =>
new EnemyFactory(
playerTransform,
patrolPoints,
fatZombie,
SlimZombie,
c.Resolve<IObjectResolver>()), // <-- inject resolver properly
Lifetime.Scoped);
builder.Register<GameScreenController>(Lifetime.Scoped).WithParameter(gameScreenView).As<IGameScreenController>();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 90318e5b70a6fc243bdcac1edeafdc26

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ac8a646cb9db814691d916d36df5d42
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ca988c75cd51455438944bcbd9e51e4a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,551 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.16.0
// from Assets/Darkmatter/Code/Core/Attributes/GameInputAction.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
/// <summary>
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Darkmatter/Code/Core/Attributes/GameInputAction.inputactions".
/// </summary>
/// <remarks>
/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
/// </remarks>
/// <example>
/// <code>
/// using namespace UnityEngine;
/// using UnityEngine.InputSystem;
///
/// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
/// public class Example : MonoBehaviour, MyActions.IPlayerActions
/// {
/// private MyActions_Actions m_Actions; // Source code representation of asset.
/// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
///
/// void Awake()
/// {
/// m_Actions = new MyActions_Actions(); // Create asset object.
/// m_Player = m_Actions.Player; // Extract action map object.
/// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
/// }
///
/// void OnDestroy()
/// {
/// m_Actions.Dispose(); // Destroy asset object.
/// }
///
/// void OnEnable()
/// {
/// m_Player.Enable(); // Enable all actions within map.
/// }
///
/// void OnDisable()
/// {
/// m_Player.Disable(); // Disable all actions within map.
/// }
///
/// #region Interface implementation of MyActions.IPlayerActions
///
/// // Invoked when "Move" action is either started, performed or canceled.
/// public void OnMove(InputAction.CallbackContext context)
/// {
/// Debug.Log($"OnMove: {context.ReadValue&lt;Vector2&gt;()}");
/// }
///
/// // Invoked when "Attack" action is either started, performed or canceled.
/// public void OnAttack(InputAction.CallbackContext context)
/// {
/// Debug.Log($"OnAttack: {context.ReadValue&lt;float&gt;()}");
/// }
///
/// #endregion
/// }
/// </code>
/// </example>
public partial class @GameInputAction: IInputActionCollection2, IDisposable
{
/// <summary>
/// Provides access to the underlying asset instance.
/// </summary>
public InputActionAsset asset { get; }
/// <summary>
/// Constructs a new instance.
/// </summary>
public @GameInputAction()
{
asset = InputActionAsset.FromJson(@"{
""version"": 1,
""name"": ""GameInputAction"",
""maps"": [
{
""name"": ""Player"",
""id"": ""27b49db9-cdaa-4c5d-b2ad-d831b5dc2c1e"",
""actions"": [
{
""name"": ""Move"",
""type"": ""Value"",
""id"": ""8bfb6cfb-d9e7-4ba7-a313-08b747a63a32"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Look"",
""type"": ""Value"",
""id"": ""ed597e1d-41bd-4f1e-8f95-fb3c1d4b429d"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Jump"",
""type"": ""Button"",
""id"": ""53dba523-5d33-4853-aa2d-e8ab36d30935"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Shoot"",
""type"": ""Button"",
""id"": ""be355a51-5e28-496b-b053-9b146c674a73"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""ADS Camera"",
""type"": ""Button"",
""id"": ""bc014086-71fa-432a-8e3c-3e2003c5244b"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Reload"",
""type"": ""Button"",
""id"": ""7bd7b761-fbb1-426d-8c5c-a9e053597a89"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": ""2D Vector"",
""id"": ""1374b7a8-751a-479d-bac6-a369bdf8c06c"",
""path"": ""2DVector"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""06bce7b9-5889-4c8f-8113-e0f2d7a2032e"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""36b8831d-57f9-48f6-afe4-ac3358177cfa"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""31559f64-86a8-4335-bf3f-fa7075672b1c"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""18cbab68-cfe2-4665-8cf1-87508fa7bc7f"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""7cea6552-cc07-4fb9-8719-e5232ff6386f"",
""path"": ""<Mouse>/delta"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Look"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2d15cf45-d15c-4d32-b8d4-65e5f0305405"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ffac9107-c879-4a8d-88bf-58909dcf769b"",
""path"": ""<Mouse>/leftButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f5bad540-cf37-4957-ad4a-1e5a5e723890"",
""path"": ""<Mouse>/rightButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""ADS Camera"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f7aa340a-d21d-48a8-81a9-d673d57059d8"",
""path"": ""<Keyboard>/r"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Reload"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// Player
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true);
m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true);
m_Player_Shoot = m_Player.FindAction("Shoot", throwIfNotFound: true);
m_Player_ADSCamera = m_Player.FindAction("ADS Camera", throwIfNotFound: true);
m_Player_Reload = m_Player.FindAction("Reload", throwIfNotFound: true);
}
~@GameInputAction()
{
UnityEngine.Debug.Assert(!m_Player.enabled, "This will cause a leak and performance issues, GameInputAction.Player.Disable() has not been called.");
}
/// <summary>
/// Destroys this asset and all associated <see cref="InputAction"/> instances.
/// </summary>
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
/// <inheritdoc cref="IEnumerable.GetEnumerator()" />
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
public void Enable()
{
asset.Enable();
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
public void Disable()
{
asset.Disable();
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
public IEnumerable<InputBinding> bindings => asset.bindings;
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// Player
private readonly InputActionMap m_Player;
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
private readonly InputAction m_Player_Move;
private readonly InputAction m_Player_Look;
private readonly InputAction m_Player_Jump;
private readonly InputAction m_Player_Shoot;
private readonly InputAction m_Player_ADSCamera;
private readonly InputAction m_Player_Reload;
/// <summary>
/// Provides access to input actions defined in input action map "Player".
/// </summary>
public struct PlayerActions
{
private @GameInputAction m_Wrapper;
/// <summary>
/// Construct a new instance of the input action map wrapper class.
/// </summary>
public PlayerActions(@GameInputAction wrapper) { m_Wrapper = wrapper; }
/// <summary>
/// Provides access to the underlying input action "Player/Move".
/// </summary>
public InputAction @Move => m_Wrapper.m_Player_Move;
/// <summary>
/// Provides access to the underlying input action "Player/Look".
/// </summary>
public InputAction @Look => m_Wrapper.m_Player_Look;
/// <summary>
/// Provides access to the underlying input action "Player/Jump".
/// </summary>
public InputAction @Jump => m_Wrapper.m_Player_Jump;
/// <summary>
/// Provides access to the underlying input action "Player/Shoot".
/// </summary>
public InputAction @Shoot => m_Wrapper.m_Player_Shoot;
/// <summary>
/// Provides access to the underlying input action "Player/ADSCamera".
/// </summary>
public InputAction @ADSCamera => m_Wrapper.m_Player_ADSCamera;
/// <summary>
/// Provides access to the underlying input action "Player/Reload".
/// </summary>
public InputAction @Reload => m_Wrapper.m_Player_Reload;
/// <summary>
/// Provides access to the underlying input action map instance.
/// </summary>
public InputActionMap Get() { return m_Wrapper.m_Player; }
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
public void Enable() { Get().Enable(); }
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
public void Disable() { Get().Disable(); }
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
public bool enabled => Get().enabled;
/// <summary>
/// Implicitly converts an <see ref="PlayerActions" /> to an <see ref="InputActionMap" /> instance.
/// </summary>
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
/// <summary>
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
/// </summary>
/// <param name="instance">Callback instance.</param>
/// <remarks>
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
/// </remarks>
/// <seealso cref="PlayerActions" />
public void AddCallbacks(IPlayerActions instance)
{
if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance);
@Move.started += instance.OnMove;
@Move.performed += instance.OnMove;
@Move.canceled += instance.OnMove;
@Look.started += instance.OnLook;
@Look.performed += instance.OnLook;
@Look.canceled += instance.OnLook;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
@Shoot.started += instance.OnShoot;
@Shoot.performed += instance.OnShoot;
@Shoot.canceled += instance.OnShoot;
@ADSCamera.started += instance.OnADSCamera;
@ADSCamera.performed += instance.OnADSCamera;
@ADSCamera.canceled += instance.OnADSCamera;
@Reload.started += instance.OnReload;
@Reload.performed += instance.OnReload;
@Reload.canceled += instance.OnReload;
}
/// <summary>
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
/// </summary>
/// <remarks>
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
/// </remarks>
/// <seealso cref="PlayerActions" />
private void UnregisterCallbacks(IPlayerActions instance)
{
@Move.started -= instance.OnMove;
@Move.performed -= instance.OnMove;
@Move.canceled -= instance.OnMove;
@Look.started -= instance.OnLook;
@Look.performed -= instance.OnLook;
@Look.canceled -= instance.OnLook;
@Jump.started -= instance.OnJump;
@Jump.performed -= instance.OnJump;
@Jump.canceled -= instance.OnJump;
@Shoot.started -= instance.OnShoot;
@Shoot.performed -= instance.OnShoot;
@Shoot.canceled -= instance.OnShoot;
@ADSCamera.started -= instance.OnADSCamera;
@ADSCamera.performed -= instance.OnADSCamera;
@ADSCamera.canceled -= instance.OnADSCamera;
@Reload.started -= instance.OnReload;
@Reload.performed -= instance.OnReload;
@Reload.canceled -= instance.OnReload;
}
/// <summary>
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="PlayerActions.UnregisterCallbacks(IPlayerActions)" />.
/// </summary>
/// <seealso cref="PlayerActions.UnregisterCallbacks(IPlayerActions)" />
public void RemoveCallbacks(IPlayerActions instance)
{
if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
/// <summary>
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
/// </summary>
/// <remarks>
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
/// </remarks>
/// <seealso cref="PlayerActions.AddCallbacks(IPlayerActions)" />
/// <seealso cref="PlayerActions.RemoveCallbacks(IPlayerActions)" />
/// <seealso cref="PlayerActions.UnregisterCallbacks(IPlayerActions)" />
public void SetCallbacks(IPlayerActions instance)
{
foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
/// <summary>
/// Provides a new <see cref="PlayerActions" /> instance referencing this action map.
/// </summary>
public PlayerActions @Player => new PlayerActions(this);
/// <summary>
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Player" which allows adding and removing callbacks.
/// </summary>
/// <seealso cref="PlayerActions.AddCallbacks(IPlayerActions)" />
/// <seealso cref="PlayerActions.RemoveCallbacks(IPlayerActions)" />
public interface IPlayerActions
{
/// <summary>
/// Method invoked when associated input action "Move" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnMove(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Look" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnLook(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Jump" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnJump(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Shoot" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnShoot(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "ADS Camera" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnADSCamera(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Reload" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnReload(InputAction.CallbackContext context);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5e695ec5d7a02e6429a5df4a6ef6c5c8

View File

@@ -0,0 +1,179 @@
{
"version": 1,
"name": "GameInputAction",
"maps": [
{
"name": "Player",
"id": "27b49db9-cdaa-4c5d-b2ad-d831b5dc2c1e",
"actions": [
{
"name": "Move",
"type": "Value",
"id": "8bfb6cfb-d9e7-4ba7-a313-08b747a63a32",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Look",
"type": "Value",
"id": "ed597e1d-41bd-4f1e-8f95-fb3c1d4b429d",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Jump",
"type": "Button",
"id": "53dba523-5d33-4853-aa2d-e8ab36d30935",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Shoot",
"type": "Button",
"id": "be355a51-5e28-496b-b053-9b146c674a73",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "ADS Camera",
"type": "Button",
"id": "bc014086-71fa-432a-8e3c-3e2003c5244b",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Reload",
"type": "Button",
"id": "7bd7b761-fbb1-426d-8c5c-a9e053597a89",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
{
"name": "2D Vector",
"id": "1374b7a8-751a-479d-bac6-a369bdf8c06c",
"path": "2DVector",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "06bce7b9-5889-4c8f-8113-e0f2d7a2032e",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "36b8831d-57f9-48f6-afe4-ac3358177cfa",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "31559f64-86a8-4335-bf3f-fa7075672b1c",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "18cbab68-cfe2-4665-8cf1-87508fa7bc7f",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "7cea6552-cc07-4fb9-8719-e5232ff6386f",
"path": "<Mouse>/delta",
"interactions": "",
"processors": "",
"groups": "",
"action": "Look",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2d15cf45-d15c-4d32-b8d4-65e5f0305405",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ffac9107-c879-4a8d-88bf-58909dcf769b",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f5bad540-cf37-4957-ad4a-1e5a5e723890",
"path": "<Mouse>/rightButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "ADS Camera",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f7aa340a-d21d-48a8-81a9-d673d57059d8",
"path": "<Keyboard>/r",
"interactions": "",
"processors": "",
"groups": "",
"action": "Reload",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: fc05be0d61af0a743bf4ebf3f66a6351
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2dacda5e48fada546bc6f576be3e1510
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1095c90869cd18542ac49ca3066a5183
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IEnemyAnimController
{
public void PlayWalkAnim(bool value);
public void PlayAttackAnim(bool value);
public void PlayeChaseAnim(bool value);
public void PlayDeadAnim();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 068407f730880e34e9512e0a7b6aa189

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
namespace Darkmatter.Core
{
public interface IEnemyPawn : IDamageable
{
GameObject GameObject { get; }
void InitializeFromFactory(Transform player,List<Transform> patrolPoints);
bool isDead { get; set; }
NavMeshAgent EnemyAI { get; }
List<Transform> PatrolPoints { get; }
void SetDestination(Vector3 destination);
Vector3 ReturnMyPos();
Transform PlayerTarget { get; }
void Reset();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8c4304330c3f4494b80013796f6dcf30

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 29db8f30e6e4e7e46836335e6946c6bd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using UnityEngine;
using System;
namespace Darkmatter.Core
{
public interface IDamageable
{
event Action<float> OnHealthDecreased;
float Health { get; set; }
void TakeDamage(float damage);
void Die();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3cd1959707bc9f64c9fedf29ea9fb1b7

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IReloadableWeapon
{
bool canAttack { get; }
bool isReloading { get; set; }
int AmmoCount { get; }
int initialAmmoCount { get; }
void Reload();
void Attack();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8e1f1c00d28297145ae2503fa9cda9c4

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1df03228b6e72bc4397493f4ed9f8ba7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IHumonoidAnim
{
void PlayJumpAnim();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5a12b671db097ec4ca9a6d81b9843c9e

View File

@@ -0,0 +1,13 @@
using System.Threading.Tasks;
using UnityEngine;
namespace Darkmatter.Core
{
public interface IPlayerAnim : IHumonoidAnim
{
public void PlayMovementAnim(Vector2 velocity);
public void PlayReloadAnim(IReloadableWeapon reloadableWeapon);
void PlayShootAnim();
void PlayDeadAnim();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7b737e58ea9c4574abb8e4c7c5b8eaa0

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IPlayerPawn : IDamageable
{
bool isGrounded { get; }
void Jump(float jumpForce);
void Move(Vector3 motion);
void SetCameraRotation(float pitch, float yaw);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d2804a4028b617e43a4dc4049b19c5b5

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface ITargetProvider
{
public RaycastHit hitPoint { get; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ebad764a0da2b7b4d8273baf63dd5500

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f3cc373d4ed1bd94ba433029245b72f5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IAudioService
{
void PlayMusic(AudioId id);
void StopMusic();
void PlaySFX(AudioId id,float volume);
void PlaySFXAt(AudioId id, UnityEngine.Vector3 position);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ad5ce615be52e274db215ee4a11cf0e4

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface ICameraService
{
Camera mainCamera { get; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9ec6d1036e8f7a34b88dc6c49fae0666

View File

@@ -0,0 +1,18 @@
using System;
using UnityEngine;
namespace Darkmatter.Core
{
public interface IInputReader
{
public event Action OnJumpPerformed;
public event Action OnAdsCameraSwitch;
public event Action OnReloadPerformed;
public Vector2 moveInput { get; }
public Vector2 lookInput { get; }
public bool isShooting { get; }
public void DisableInput();
public void EnableInput();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 45f4fffcfa5f98247af8885708c3e11d

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b3d1c4314960db14dbc459d446baba49
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IState
{
void Enter();
void Update();
void LateUpdate();
void Exit();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3508c66c9649d76439537bb7e9532896

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb18939ec56040244812046623bfe046
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IGameScreenController
{
void UpdateFireableBulletCount(int bulletCount);
void UpdateRemainingZombiesCount(int zombiesCount);
void UpdateTotalZombiesCount(int totalZombiesCount);
void ShowGameOverText();
void ShowPlayerHealth(int health);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e6871718dd9c3244eac4e4eed90a289f

View File

@@ -0,0 +1,16 @@
{
"name": "CoreAssembly",
"rootNamespace": "Darkmatter.Core",
"references": [
"GUID:75469ad4d38634e559750d17036d5f7c"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cf1df9e1968a94c4686f2fbe5ef907fc
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e7270f123c7fea841a3c10737e9f13ba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 92f3f5d5f5ea93d44b2a724fb4b4e41f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
%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: 0874d02cb2d9daa4883a09464ed19de2, type: 3}
m_Name: CameraConfigSO
m_EditorClassIdentifier: CoreAssembly::Darkmatter.Core.CameraConfigSO
lookSensitivity: 10
topClampAngle: 80
bottomClampAngle: -50

View File

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

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace Darkmatter.Core
{
[CreateAssetMenu(fileName = "CameraConfigSO", menuName = "Scriptable Objects/CameraConfigSO")]
public class CameraConfigSO : ScriptableObject
{
public float lookSensitivity = 10f;
public float topClampAngle = 50f;
public float bottomClampAngle = -30f;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0874d02cb2d9daa4883a09464ed19de2

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 53dde7197a1c44e4281d4edeac45e2d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
%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: 8b8a5c204ef7f8e4f9079e6e8e28d1a8, type: 3}
m_Name: EnemyConfigSO
m_EditorClassIdentifier: CoreAssembly::Darkmatter.Core.EnemyConfigSO
walkSpeed: 1
chaseSpeed: 4
visionRange: 50
attackRange: 3

View File

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

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace Darkmatter.Core
{
[CreateAssetMenu(fileName = "EnemyConfigSO", menuName = "Scriptable Objects/EnemyConfigSO")]
public class EnemyConfigSO : ScriptableObject
{
[Header("Enemy Data")]
public float walkSpeed = 3f;
public float chaseSpeed = 5f;
public float visionRange = 15f;
public float attackRange = 2f;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8b8a5c204ef7f8e4f9079e6e8e28d1a8

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 301dfab9095361c4396c288e6108c540
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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: 94786f68f321b5249b0997193bb0036b, type: 3}
m_Name: InputReaderSO
m_EditorClassIdentifier: CoreAssembly::Darkmatter.Core.InputReaderSO

View File

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

View File

@@ -0,0 +1,85 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Darkmatter.Core
{
[CreateAssetMenu(fileName = "InputReaderSO", menuName = "Scriptable Objects/InputReaderSO")]
public class InputReaderSO : ScriptableObject, IInputReader, GameInputAction.IPlayerActions
{
public GameInputAction action;
public event Action OnJumpPerformed;
public event Action OnAdsCameraSwitch;
public event Action OnReloadPerformed;
public bool isShooting { get; private set; }
public Vector2 moveInput { get; private set; }
public Vector2 lookInput { get; private set; }
private void OnEnable()
{
if (action == null)
{
action = new GameInputAction();
}
action.Enable();
action.Player.SetCallbacks(this);
}
private void OnDisable()
{
action.Player.Disable();
}
public void OnMove(InputAction.CallbackContext context)
{
moveInput = context.ReadValue<Vector2>();
}
public void OnLook(InputAction.CallbackContext context)
{
lookInput = context.ReadValue<Vector2>();
}
public void OnJump(InputAction.CallbackContext context)
{
if(context.performed)
{
OnJumpPerformed?.Invoke();
}
}
public void OnShoot(InputAction.CallbackContext context)
{
isShooting = context.ReadValueAsButton();
}
public void OnADSCamera(InputAction.CallbackContext context)
{
if(context.performed)
{
OnAdsCameraSwitch?.Invoke();
}
}
public void OnReload(InputAction.CallbackContext context)
{
if(context.performed)
{
OnReloadPerformed?.Invoke();
}
}
public void DisableInput()
{
action.Player.Disable();
}
public void EnableInput()
{
action.Player.Enable();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 94786f68f321b5249b0997193bb0036b

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bdb59f39fa76d4d4580e1c5f97feb817
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
%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: d868e8202f5ceae4ea496e56b0db9db9, type: 3}
m_Name: PlayerConfigSO
m_EditorClassIdentifier: CoreAssembly::Darkmatter.Core.PlayerConfigSO
moveSpeed: 2
jumpForce: 5
gravity: -15

View File

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

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace Darkmatter.Core
{
[CreateAssetMenu(fileName = "PlayerConfigSO", menuName = "Scriptable Objects/PlayerConfigSO")]
public class PlayerConfigSO : ScriptableObject
{
public float moveSpeed = 3.0f;
public float jumpForce = 5f;
public float gravity = -15f;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d868e8202f5ceae4ea496e56b0db9db9

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eb71c28b0ae2ddd4f97052a36e8aa420
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace Darkmatter.Core
{
public interface IEnemyFactory
{
IEnemyPawn GetEnemy(ZombieType type);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3089e498135722943b5e535be3721398

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 04e91ccf19676b842a97a52f9ac4fd3a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace Darkmatter.Core
{
public static class DMUtil
{
public static void Show()
{
Debug.Log("Showin from utility");
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ab244149b74d77646b0246b556a1e7c9

View File

@@ -0,0 +1,24 @@
using UnityEngine;
namespace Darkmatter.Core
{
public enum ZombieType
{
Fat,
slim
}
public enum AudioId
{
Music_Gameplay,
Music_Menu,
Gun_Fire,
Gun_Reload,
Zombie_Growl,
Zombie_Death,
UI_Click
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 03bd7b15fdefdfb4abf373fa10450700

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a05f68cccf2d0b740ab6b40a5debb196
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
{
"name": "DomainAssembly",
"rootNamespace": "Darkmatter.Domain",
"references": [
"GUID:cf1df9e1968a94c4686f2fbe5ef907fc",
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 23f9a018fbd2e1242a0525718cc761d6
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d918fdc659ee8fe4e8c97089cf4bc09b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,58 @@
using Darkmatter.Core;
using System;
using UnityEngine;
namespace Darkmatter.Domain
{
public class AttackState : State<EnemyStateMachine>
{
public AttackState(EnemyStateMachine runner) : base(runner) { }
private IEnemyAnimController enemyAnimController => runner.enemyAnimController;
private IEnemyPawn enemyPawn => runner.enemyPawn;
public override void Enter()
{
base.Enter();
enemyAnimController.PlayAttackAnim(true);
enemyPawn.OnHealthDecreased += HandleHealth;
}
private void HandleHealth(float health)
{
if (health <= 0)
{
runner.Die();
}
}
public override void Update()
{
if (enemyPawn.isDead) return;
base.Update();
HandleAttack();
CheckForStateBreak();
}
private void CheckForStateBreak()
{
if(!runner.PlayerInAttackRange())
{
runner.ChangeState(new ChaseState(runner));
}
}
private void HandleAttack()
{
Vector3 dir = (enemyPawn.PlayerTarget.position - enemyPawn.ReturnMyPos()).normalized;
enemyPawn.GameObject.transform.rotation = Quaternion.LookRotation(dir);
//rotate towards player and handle Attack here
}
public override void Exit()
{
base.Exit();
enemyAnimController.PlayAttackAnim(false);
enemyPawn.OnHealthDecreased -= HandleHealth;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ee568c0b6df08d34d9c9fb008040066e

View File

@@ -0,0 +1,64 @@
using Darkmatter.Core;
using System;
using UnityEngine;
namespace Darkmatter.Domain
{
public class ChaseState : State<EnemyStateMachine>
{
public ChaseState(EnemyStateMachine runner) : base(runner) { }
private EnemyConfigSO enemyConfig => runner.enemyConfig;
private IEnemyAnimController enemyAnimController => runner.enemyAnimController;
private IEnemyPawn enemyPawn => runner.enemyPawn;
public override void Enter()
{
base.Enter();
runner.SetSpeed(enemyConfig.chaseSpeed);
enemyAnimController.PlayeChaseAnim(true);
enemyPawn.OnHealthDecreased += HandleHealth;
runner.audioService.PlaySFXAt(AudioId.Zombie_Growl, enemyPawn.ReturnMyPos());
}
private void HandleHealth(float health)
{
if (health <= 0)
{
runner.Die();
}
}
public override void Update()
{
if (enemyPawn.isDead) return;
base.Update();
HandleChase();
CheckForStateBreak();
}
private void CheckForStateBreak()
{
if (!runner.PlayerInChasingRange())
{
runner.ChangeState(new PatrolState(runner));
}
else if(runner.PlayerInAttackRange())
{
runner.ChangeState(new AttackState(runner));
}
}
private void HandleChase()
{
enemyPawn.SetDestination(enemyPawn.PlayerTarget.position);
}
public override void Exit()
{
base.Exit();
enemyAnimController.PlayeChaseAnim(false);
enemyPawn.OnHealthDecreased -= HandleHealth;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3a599db206b4b2a4b91b0af8749183e7

View File

@@ -0,0 +1,32 @@
using Darkmatter.Core;
using UnityEngine;
using VContainer;
using VContainer.Unity;
namespace Darkmatter.Domain
{
public class EnemyController : MonoBehaviour
{
EnemyStateMachine esm;
IEnemyAnimController animController;
IEnemyPawn enemy;
[SerializeField] public EnemyConfigSO enemyConfig;
[Inject] IAudioService audioService;
private void Awake()
{
animController = this.GetComponent<IEnemyAnimController>();
enemy = this.GetComponent<IEnemyPawn>();
}
public void Start()
{
esm = new EnemyStateMachine(enemy,animController,audioService, enemyConfig);
esm.ChangeState(new PatrolState(esm));
}
public void Update()
{
esm.Update();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2fbe43d3f58deb3489ba1565abc2b050

View File

@@ -0,0 +1,55 @@
using Darkmatter.Core;
using System.Threading.Tasks;
using UnityEngine;
using VContainer;
namespace Darkmatter.Domain
{
public class EnemyStateMachine:StateMachine
{
public readonly IEnemyPawn enemyPawn;
public readonly IEnemyAnimController enemyAnimController;
public readonly EnemyConfigSO enemyConfig;
public readonly IAudioService audioService;
public EnemyStateMachine(IEnemyPawn pawn, IEnemyAnimController animController, IAudioService audioService, EnemyConfigSO enemyConfig)
{
enemyPawn = pawn;
enemyAnimController = animController;
this.audioService = audioService;
this.enemyConfig = enemyConfig;
}
public void SetSpeed(float speed)
{
enemyPawn.EnemyAI.speed = speed;
}
public bool PlayerInChasingRange()
{
if(Vector3.Distance(enemyPawn.PlayerTarget.position,enemyPawn.ReturnMyPos()) < enemyConfig.visionRange)
{
return true;
}
return false;
}
public bool PlayerInAttackRange()
{
if(Vector3.Distance(enemyPawn.PlayerTarget.position,enemyPawn.ReturnMyPos())<enemyConfig.attackRange)
{
return true;
}
return false;
}
public void Die()
{
if (enemyPawn.isDead) return;
enemyAnimController.PlayDeadAnim();
audioService.PlaySFXAt(AudioId.Zombie_Death,enemyPawn.ReturnMyPos());
enemyPawn.Die();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c90488ca687a5724bbff14600be305d6

View File

@@ -0,0 +1,72 @@
using Codice.Client.Common;
using Darkmatter.Core;
using System;
using UnityEngine;
namespace Darkmatter.Domain
{
public class PatrolState : State<EnemyStateMachine>
{
public PatrolState(EnemyStateMachine runner) : base(runner) { }
private EnemyConfigSO enemyConfig => runner.enemyConfig;
private IEnemyAnimController enemyAnimController => runner.enemyAnimController;
private IEnemyPawn enemyPawn => runner.enemyPawn;
private int currentPatrolPointIndex = 0;
public override void Enter()
{
base.Enter();
Debug.Log("Entered Patrol State");
enemyPawn.OnHealthDecreased += HandleHealth;
runner.SetSpeed(enemyConfig.walkSpeed);
enemyAnimController.PlayWalkAnim(true);
}
private void HandleHealth(float health)
{
if(health<=0)
{
runner.Die();
}
}
public override void Update()
{
if (enemyPawn.isDead) return;
base.Update();
HandlePatrol();
CheckForStateBreak();
}
private void CheckForStateBreak()
{
if(runner.PlayerInChasingRange())
{
runner.ChangeState(new ChaseState(runner));
}
}
private void HandlePatrol()
{
if (enemyPawn.PatrolPoints.Count == 0) return;
Transform target = enemyPawn.PatrolPoints[currentPatrolPointIndex];
enemyPawn.SetDestination(target.position);
if(Vector3.Distance(target.position,enemyPawn.ReturnMyPos()) < 0.5f) //close enought to targetPatrolPoint
{
currentPatrolPointIndex = (currentPatrolPointIndex+1)%enemyPawn.PatrolPoints.Count;
}
}
public override void Exit()
{
base.Exit();
enemyAnimController.PlayWalkAnim(false);
enemyPawn.OnHealthDecreased -= HandleHealth;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7c5d8a8739037414ea98cca25c34a1c9

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 24cf231bd8f41e043ab82eb2407bc8d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
using Darkmatter.Core;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using VContainer;
using VContainer.Unity;
namespace Darkmatter.Domain
{
public class EnemyFactory : IEnemyFactory
{
private readonly List<Transform> patrolPoints;
private readonly Transform playerTransform;
private readonly GameObject fatZombiePrefab;
private readonly GameObject slimZombiePrefab;
private readonly IObjectResolver objectResolver;
public EnemyFactory(Transform playerTransform, List<Transform> patrolPoints, GameObject fatZombiePrefab, GameObject slimZombiePrefab,IObjectResolver resolver)
{
this.playerTransform = playerTransform;
this.patrolPoints = patrolPoints;
this.fatZombiePrefab = fatZombiePrefab;
this.slimZombiePrefab = slimZombiePrefab;
this.objectResolver = resolver;
}
public IEnemyPawn GetEnemy(ZombieType type)
{
GameObject enemyObj = null;
switch (type)
{
case ZombieType.Fat:
enemyObj = GameObject.Instantiate(fatZombiePrefab, GetSpawnPos(), Quaternion.identity);
break;
case ZombieType.slim:
enemyObj = GameObject.Instantiate(slimZombiePrefab, GetSpawnPos(), Quaternion.identity);
break;
default:
break;
}
objectResolver.InjectGameObject(enemyObj);
IEnemyPawn enemyPawn = enemyObj.GetComponent<IEnemyPawn>();
enemyPawn.InitializeFromFactory(playerTransform, GetRandomPatrolPoints(Random.Range(4, patrolPoints.Count)));
return enemyPawn;
}
private Vector3 GetSpawnPos()
{
return patrolPoints[Random.Range(0, patrolPoints.Count)].position;
}
private List<Transform> GetRandomPatrolPoints(int count)
{
return patrolPoints.OrderBy(x=>Random.value).Take(count).ToList();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7cc7bf9641449434c9b547177a310227

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 20d2b82ece3161e438ff1f7d82fb92af
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,67 @@
using Darkmatter.Core;
using System;
using UnityEngine;
namespace Darkmatter.Domain
{
public class AirboneState : State<PlayerStateMachine>
{
public AirboneState(PlayerStateMachine runner) : base(runner) { }
private IInputReader inputReader => runner.inputReader;
private PlayerConfigSO playerConfig => runner.playerConfig;
public override void Enter()
{
Debug.Log("Entering Player AirboneState ");
inputReader.OnReloadPerformed += HandleManualReload;
}
public override void Update()
{
HandlePlayerMovement();
HandleShoooting();
CheckForStateBreak();
}
public override void LateUpdate()
{
HandlePlayerRotation();
}
public override void Exit()
{
Debug.Log("Exiting Player AriboneState");
inputReader.OnReloadPerformed -= HandleManualReload;
}
//Airbone Functions
private void HandlePlayerMovement()
{
runner.Move(inputReader.moveInput, playerConfig.moveSpeed);
}
private void HandlePlayerRotation()
{
runner.RotateCamera(inputReader.lookInput);
}
private void CheckForStateBreak()
{
if (runner.playerPawn.isGrounded)
{
runner.ChangeState(new LocomotionState(runner));
}
}
private void HandleShoooting()
{
runner.Shoot(inputReader.isShooting);
}
private void HandleManualReload()
{
runner.Reload();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6149b00abd3711242a957f9998722255

View File

@@ -0,0 +1,83 @@
using Darkmatter.Core;
using System;
using UnityEngine;
namespace Darkmatter.Domain
{
public class LocomotionState : State<PlayerStateMachine>
{
public LocomotionState(PlayerStateMachine runner) : base(runner) { }
private IInputReader inputReader => runner.inputReader;
private PlayerConfigSO playerConfig => runner.playerConfig;
private IPlayerAnim playerAnim => runner.playerAnim;
public override void Enter()
{
Debug.Log("Starting player Locomotion");
inputReader.OnJumpPerformed += HandlePlayerJump;
inputReader.OnReloadPerformed += HandleManualReload;
}
public override void Update()
{
HandlePlayerMovement();
HandleShooting();
CheckForStateBreak();
}
public override void LateUpdate()
{
HandlePlayerRotation();
}
public override void Exit()
{
Debug.Log("Exiting Player Locomotion State");
inputReader.OnJumpPerformed -= HandlePlayerJump;
inputReader.OnReloadPerformed -= HandleManualReload;
}
//Locomotion Functions
private void CheckForStateBreak()
{
if (!runner.playerPawn.isGrounded)
{
runner.ChangeState(new AirboneState(runner));
}
}
private void HandlePlayerRotation()
{
runner.RotateCamera(inputReader.lookInput);
}
private void HandlePlayerMovement()
{
runner.Move(inputReader.moveInput, playerConfig.moveSpeed);
}
private void HandlePlayerJump()
{
runner.playerPawn.Jump(playerConfig.jumpForce);
playerAnim.PlayJumpAnim();
}
private void HandleShooting()
{
runner.Shoot(inputReader.isShooting);
}
private void HandleManualReload()
{
runner.Reload();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 961ad68a3149563478180fcf9d2465b6

View File

@@ -0,0 +1,25 @@
using VContainer;
using VContainer.Unity;
namespace Darkmatter.Domain
{
public class PlayerController : IStartable, ITickable, ILateTickable
{
[Inject] private PlayerStateMachine psm;
public void LateTick()
{
psm.LateUpdate();
}
public void Start()
{
psm.ChangeState(new LocomotionState(psm));
}
public void Tick()
{
psm.Update();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4b238eafe4c049642ae43f347d61a607

Some files were not shown because too many files have changed in this diff Show More