Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,20 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class StartFromBootstrap
|
||||
{
|
||||
static StartFromBootstrap()
|
||||
{
|
||||
var scenePath = "Assets/Infrastructure/Bootstrap.unity";
|
||||
var sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(scenePath);
|
||||
|
||||
if (sceneAsset != null)
|
||||
EditorSceneManager.playModeStartScene = sceneAsset;
|
||||
else
|
||||
Debug.LogError("Could not find scene at " + scenePath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c1b8ca63d9a4ba19fb70cb4ec7b7609
|
||||
timeCreated: 1785874078
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c030bebb626a43c7acf7f3a48acc09eb
|
||||
timeCreated: 1785847329
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Code.Game.Gameplay.Player.Factory;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using R3;
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Game.TestingLevel
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public struct TestingLevelData
|
||||
{
|
||||
public Transform playerSpawnPoint;
|
||||
}
|
||||
public class TestingLevelSceneInstaller: MonoBehaviour, IInstaller, IDisposable
|
||||
{
|
||||
private IDisposable _onContainerBuildDisposable;
|
||||
[SerializeField] private TestingLevelData testingLevelData;
|
||||
|
||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||
{
|
||||
containerBuilder.RegisterValue(testingLevelData);
|
||||
|
||||
_onContainerBuildDisposable = Observable
|
||||
.FromEvent<Container>(
|
||||
h => containerBuilder.OnContainerBuilt += h,
|
||||
h => containerBuilder.OnContainerBuilt -= h)
|
||||
.Subscribe(x => OnContainerBuilt(x).Forget());
|
||||
}
|
||||
|
||||
private ISceneContainerManager _sceneContainerManager;
|
||||
private async UniTaskVoid OnContainerBuilt(Container container)
|
||||
{
|
||||
await UniTask.Yield();
|
||||
|
||||
container.Resolve<IPlayerFactory>().InjectPlayer(container);
|
||||
|
||||
_onContainerBuildDisposable.Dispose();
|
||||
|
||||
_sceneContainerManager = container.Resolve<ISceneContainerManager>();
|
||||
_sceneContainerManager.ScenesContainers.Add(SceneId.Testing, container);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_sceneContainerManager.ScenesContainers.Remove(SceneId.Testing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db514476e4864e78b2ab1734a44b450c
|
||||
timeCreated: 1785847631
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Code.D.Cleaning.CleanTools;
|
||||
using Code.D.Cleaning.UI;
|
||||
using Code.D.Player;
|
||||
using Code.Game.Gameplay.Player;
|
||||
using Code.Game.Gameplay.Player.Factory;
|
||||
using Code.Infrastructure.App;
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.Infrastructure.Generators;
|
||||
using Code.Infrastructure.Input;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using Code.Infrastructure.UI;
|
||||
using Code.Infrastructure.Utils;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using KinematicCharacterController;
|
||||
using ObservableCollections;
|
||||
using R3;
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Code.Game.TestingLevel
|
||||
{
|
||||
[State(typeof(AppStates), typeof(AppStateMachineContext))]
|
||||
public partial class TestingState
|
||||
{
|
||||
public TestingState(AppStateMachineContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public override AppStates MyState => AppStates.Testing;
|
||||
|
||||
public override async UniTask EnterState()
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
|
||||
Context.InputService.EnableMap(ActionMappings.Cleaning);
|
||||
|
||||
Context.AudioService.SetAudioListener(Context.Camera.Camera.GetComponent<AudioListener>());
|
||||
|
||||
await Context.Camera.SwitchState(CameraMode.Cleaner);
|
||||
|
||||
var waitForContainer =
|
||||
Context.SceneContainerManager.ScenesContainers
|
||||
.ObserveDictionaryAdd()
|
||||
.Where(x => x.Key == SceneId.Testing)
|
||||
.Take(1)
|
||||
.WaitAsync()
|
||||
.AsUniTask();
|
||||
|
||||
var cleaningPanel = (CleaningPanel) await Context.UIFactory.LoadPanel(UIPanelType.Cleaning,true);
|
||||
|
||||
var factoryConfig = new SingleConfig<PlayerFactorySettings>();
|
||||
var cleanToolsConfigs = new MultipleConfig<CleanToolConfig>();
|
||||
|
||||
await UniTask.WhenAll(
|
||||
factoryConfig.LoadConfig(),
|
||||
cleanToolsConfigs.LoadConfigs()
|
||||
);
|
||||
|
||||
var factory = new PlayerFactory(factoryConfig);
|
||||
var player = await factory.CreatePlayer();
|
||||
var playerKinematicCharacterMotor = player.GetComponent<KinematicCharacterMotor>();
|
||||
var playerMovementController = player.GetComponent<PlayerMovementController>();
|
||||
var playerEquipment = player.GetComponent<PlayerEquipment>();
|
||||
|
||||
CleanToolConfig[] toolsConfigs = cleanToolsConfigs.Configs.ToArray();
|
||||
List<CleanTool> cleanTools = new();
|
||||
|
||||
// TODO Сделать сервис снабжения игрока
|
||||
foreach (var toolConfig in toolsConfigs)
|
||||
{
|
||||
switch (toolConfig.ToolType)
|
||||
{
|
||||
case CleanToolType.Tryapka:
|
||||
cleanTools.Add(new Tryapka(toolConfig.DurabilityUsageStep, toolConfig.CleanRadius, toolConfig.BrushTexture));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void InstallExtra(Scene scene, ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterValue(factoryConfig);
|
||||
builder.RegisterValue(factory, new []{typeof(IPlayerFactory)});
|
||||
builder.RegisterValue(playerKinematicCharacterMotor);
|
||||
builder.RegisterValue(playerMovementController);
|
||||
builder.RegisterValue(playerEquipment);
|
||||
builder.RegisterValue(cleanTools);
|
||||
builder.RegisterValue(cleaningPanel);
|
||||
}
|
||||
|
||||
await UniTask.WhenAll(
|
||||
Context.SceneLoader
|
||||
.LoadSceneAsync(
|
||||
SceneId.Testing,
|
||||
LoadSceneMode.Single,
|
||||
true,
|
||||
InstallExtra),
|
||||
waitForContainer
|
||||
);
|
||||
|
||||
var container = Context.SceneContainerManager.ScenesContainers[SceneId.Testing];
|
||||
|
||||
container.Resolve<KinematicCharacterMotor>()
|
||||
.SetPositionAndRotation(
|
||||
container.Resolve<TestingLevelData>().playerSpawnPoint.position,
|
||||
container.Resolve<TestingLevelData>().playerSpawnPoint.rotation);
|
||||
|
||||
((CleanerCameraState)Context.Camera.CurrentBaseState)
|
||||
.SetPlayer(container.Resolve<PlayerMovementController>());
|
||||
}
|
||||
|
||||
public override async UniTask ExitState()
|
||||
{
|
||||
Context.InputService.DisableMap(ActionMappings.Cleaning);
|
||||
|
||||
await Context.SceneLoader.UnloadSceneAsync(SceneId.Testing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c6095424c534587b8b6ed7c758375e5
|
||||
timeCreated: 1785847339
|
||||
@@ -0,0 +1,74 @@
|
||||
Shader "Custom/UVRegionHighlighter"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_HighlightMin ("Highlight Min (U, V)", Vector) = (0.2, 0.2, 0, 0)
|
||||
_HighlightMax ("Highlight Max (U, V)", Vector) = (0.5, 0.5, 0, 0)
|
||||
_GridCount ("Grid Count", Float) = 10.0
|
||||
_HighlightColor ("Highlight Color", Color) = (1, 0, 0, 1)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD1;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
float4 _HighlightMin;
|
||||
float4 _HighlightMax;
|
||||
float _GridCount;
|
||||
fixed4 _HighlightColor;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float2 uv = i.uv;
|
||||
|
||||
// Сетка (линии разметки)
|
||||
float2 grid = frac(uv * _GridCount);
|
||||
float lineMask = step(0.92, grid.x) + step(0.92, grid.y);
|
||||
lineMask = saturate(lineMask);
|
||||
|
||||
// Проверка: находится ли пиксель в выбранных UV-координатах
|
||||
bool inRegion = (uv.x >= _HighlightMin.x && uv.x <= _HighlightMax.x &&
|
||||
uv.y >= _HighlightMin.y && uv.y <= _HighlightMax.y);
|
||||
|
||||
// Базовый цвет UV + черная сетка
|
||||
fixed4 baseColor = lerp(fixed4(uv.x, uv.y, 0.0, 1.0), fixed4(0, 0, 0, 1), lineMask);
|
||||
|
||||
// Если пиксель внутри выделенного участка UV — подсвечиваем его
|
||||
if (inRegion)
|
||||
{
|
||||
return lerp(_HighlightColor, fixed4(1, 1, 1, 1), lineMask * 0.5);
|
||||
}
|
||||
|
||||
return baseColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa803291ec594773ad1056019437aa30
|
||||
timeCreated: 1786007069
|
||||
Reference in new issue
Block a user