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,18 @@
{
"name": "DomainAssembly",
"rootNamespace": "Darkmatter.Domain",
"references": [
"GUID:8bce7b1d1a7647841855dfbbfa883cd6",
"GUID:4307f53044263cf4b835bd812fc161a4",
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

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

View File

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

View File

@@ -0,0 +1,20 @@
using Darkmatter.Core;
using UnityEngine;
namespace Darkmatter.Domain
{
public class FirstPlatform : IPlatformRule
{
public void Execute(IPlatform platform)
{
foreach (var piece in platform.platformPiece)
{
piece.SetActive(true);
piece.GetComponent<Renderer>().material = platform.safeMaterial;
piece.gameObject.SetActive(true);
piece.tag = "Safe";
}
platform.platformPiece[Random.Range(1, platform.platformPiece.Count)].gameObject.SetActive(false);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 27cd8a8665a6d104f85ecb3c791c9757

View File

@@ -0,0 +1,28 @@
using Darkmatter.Core;
using UnityEngine;
namespace Darkmatter.Domain
{
public class OtherPlatform : IPlatformRule
{
int danger = 2;
public void Execute(IPlatform platform)
{
foreach (var piece in platform.platformPiece)
{
piece.SetActive(true);
piece.GetComponent<Renderer>().material = platform.safeMaterial;
piece.gameObject.SetActive(true);
piece.tag = "Safe";
}
for (int i = 0; i < danger; i++)
{
GameObject deadPlatform = platform.platformPiece[Random.Range(0, platform.platformPiece.Count)];
deadPlatform.GetComponent<Renderer>().material = platform.deathMaterial;
deadPlatform.tag = "Death";
}
platform.platformPiece[Random.Range(0, platform.platformPiece.Count)].gameObject.SetActive(false);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4136bc6323ff5ea40874d2b69bc2ca56

View File

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

View File

@@ -0,0 +1,79 @@
using Darkmatter.Core;
using System.Collections;
using Unity.Cinemachine;
using UnityEngine;
using VContainer;
namespace Darkmatter.Domain
{
public class Player : MonoBehaviour, IPlayer
{
[SerializeField] private float jumpForce = 3f;
[SerializeField] private Rigidbody rb;
[SerializeField] private GameObject splashObject;
[SerializeField] private Transform splashParent;
[SerializeField] private ParticleSystem deadParticle;
[SerializeField] private ParticleSystem jumpParticle;
[SerializeField] private CinemachineImpulseSource cinemachineImpulseSource;
[SerializeField] private Material playerMaterial;
[SerializeField] Color[] playerMaterialColors;
public bool isDead { get; private set; }
[Inject] private IDeathScreenController IdeathScreenController;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
private void Start()
{
isDead = false;
playerMaterial.color = playerMaterialColors[Random.Range(0, playerMaterialColors.Length)];
}
private void OnCollisionEnter(Collision collision)
{
ShowAndHideSplash(collision);
if (isDead) return;
if (collision.gameObject.CompareTag("Safe") && rb.linearVelocity.y <= 0.5f)
{
rb.linearVelocity = Vector3.up * jumpForce;
jumpParticle.Play();
IaudioController.PlayJumpSound();
}
else if (collision.gameObject.CompareTag("Death"))
{
Die();
}
}
private void ShowAndHideSplash(Collision collision)
{
float splashYPos = collision.transform.position.y + 0.155f;
ContactPoint contact = collision.contacts[0];
Vector3 surfacePoint = new Vector3(contact.point.x, splashYPos, contact.point.z);
GameObject instancedSplash = Instantiate(splashObject, surfacePoint, splashObject.transform.rotation, collision.gameObject.transform);
instancedSplash.transform.localScale = new Vector3(Random.Range(0.05f, 0.09f), Random.Range(0.05f, 0.09f), 1);
Destroy(instancedSplash, 2f);
}
private void Die()
{
isDead = true;
IinputReader.LockInput();
deadParticle.Play();
this.GetComponent<Renderer>().enabled = false;
IaudioController.PlayDeathSound();
Handheld.Vibrate(); //Vibration
cinemachineImpulseSource.GenerateImpulseWithForce(1);
StartCoroutine(DieRoutine());
}
IEnumerator DieRoutine()
{
yield return new WaitForSeconds(1f);
IdeathScreenController.ShowDeathScreen();
}
}
}

View File

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