mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-02 14:29:23 +00:00
fix: correct teleport radius
This commit is contained in:
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dotrush.roslyn.projectOrSolutionFiles": [
|
||||||
|
"e:\\_Programming\\Unity\\UnityGames\\project-entity\\project-entity.sln"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -9,37 +9,42 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems
|
|||||||
{
|
{
|
||||||
public class FindRandomPointForTeleportSystem : IInitializableSystem, IDisposableSystem
|
public class FindRandomPointForTeleportSystem : IInitializableSystem, IDisposableSystem
|
||||||
{
|
{
|
||||||
|
private Transform _target;
|
||||||
private Transform _toPoint;
|
private Transform _toPoint;
|
||||||
|
|
||||||
private ReactiveEvent _findPointRequest;
|
private ReactiveEvent _findPointRequest;
|
||||||
private ReactiveEvent _findPointEvent;
|
private ReactiveEvent _findPointEvent;
|
||||||
|
|
||||||
private ReactiveVariable<float> _radius;
|
private ReactiveVariable<float> _radius;
|
||||||
|
|
||||||
private IDisposable _findPointRequestDisposable;
|
private IDisposable _findPointRequestDisposable;
|
||||||
|
|
||||||
public void OnInit(Entity entity)
|
public void OnInit(Entity entity)
|
||||||
{
|
{
|
||||||
|
_target = entity.TeleportTarget;
|
||||||
_toPoint = entity.TeleportToPoint;
|
_toPoint = entity.TeleportToPoint;
|
||||||
_radius = entity.TeleportSearchRadius;
|
_radius = entity.TeleportSearchRadius;
|
||||||
_findPointRequest = entity.FindTeleportPointRequest;
|
_findPointRequest = entity.FindTeleportPointRequest;
|
||||||
_findPointEvent = entity.FindTeleportPointEvent;
|
_findPointEvent = entity.FindTeleportPointEvent;
|
||||||
|
|
||||||
_findPointRequestDisposable = _findPointRequest.Subscribe(OnFindPointRequest);
|
_findPointRequestDisposable = _findPointRequest.Subscribe(OnFindPointRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDispose()
|
public void OnDispose()
|
||||||
{
|
{
|
||||||
_findPointRequestDisposable.Dispose();
|
_findPointRequestDisposable.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFindPointRequest()
|
private void OnFindPointRequest()
|
||||||
{
|
{
|
||||||
_toPoint.position = GetRandomPointByRadius(_radius.Value);
|
_toPoint.position = GetRandomPointInRadius(_target.position, _radius.Value);
|
||||||
_findPointEvent.Invoke();
|
_findPointEvent.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetRandomPointByRadius(float radius)
|
private Vector3 GetRandomPointInRadius(Vector3 center, float radius)
|
||||||
=> new(Random.Range(0, radius), 0, Random.Range(0, radius));
|
{
|
||||||
|
Vector2 randomPoint = Random.insideUnitCircle * radius;
|
||||||
|
return center + new Vector3(randomPoint.x, 0f, randomPoint.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
|
|
||||||
"com.unity.2d.sprite": "1.0.0",
|
"com.unity.2d.sprite": "1.0.0",
|
||||||
"com.unity.collab-proxy": "2.8.2",
|
"com.unity.collab-proxy": "2.8.2",
|
||||||
"com.unity.ide.rider": "3.0.27",
|
"com.unity.ide.rider": "3.0.27",
|
||||||
"com.unity.ide.visualstudio": "2.0.22",
|
"com.unity.ide.visualstudio": "2.0.27",
|
||||||
"com.unity.ide.vscode": "1.2.5",
|
"com.unity.ide.vscode": "1.2.5",
|
||||||
"com.unity.inputsystem": "1.7.0",
|
"com.unity.inputsystem": "1.7.0",
|
||||||
"com.unity.render-pipelines.universal": "14.0.9",
|
"com.unity.render-pipelines.universal": "14.0.9",
|
||||||
@@ -45,4 +44,4 @@
|
|||||||
"com.unity.modules.wind": "1.0.0",
|
"com.unity.modules.wind": "1.0.0",
|
||||||
"com.unity.modules.xr": "1.0.0"
|
"com.unity.modules.xr": "1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.github-glitchenzo.nugetforunity": {
|
|
||||||
"version": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "git",
|
|
||||||
"dependencies": {},
|
|
||||||
"hash": "c2af83c9d4f8cdaada9d4a0e94de2f195d8e1d01"
|
|
||||||
},
|
|
||||||
"com.unity.2d.sprite": {
|
"com.unity.2d.sprite": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
@@ -46,11 +39,11 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ide.visualstudio": {
|
"com.unity.ide.visualstudio": {
|
||||||
"version": "2.0.22",
|
"version": "2.0.27",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.test-framework": "1.1.9"
|
"com.unity.test-framework": "1.1.33"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
|||||||
17
ProjectSettings/BurstAotSettings_Android.json
Normal file
17
ProjectSettings/BurstAotSettings_Android.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"MonoBehaviour": {
|
||||||
|
"Version": 4,
|
||||||
|
"EnableBurstCompilation": true,
|
||||||
|
"EnableOptimisations": true,
|
||||||
|
"EnableSafetyChecks": false,
|
||||||
|
"EnableDebugInAllBuilds": false,
|
||||||
|
"DebugDataKind": 1,
|
||||||
|
"EnableArmv9SecurityFeatures": false,
|
||||||
|
"CpuMinTargetX32": 0,
|
||||||
|
"CpuMaxTargetX32": 0,
|
||||||
|
"CpuMinTargetX64": 0,
|
||||||
|
"CpuMaxTargetX64": 0,
|
||||||
|
"CpuTargetsArm64": 512,
|
||||||
|
"OptimizeFor": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
{
|
{
|
||||||
"MonoBehaviour": {
|
"MonoBehaviour": {
|
||||||
"Version": 3,
|
"Version": 4,
|
||||||
"EnableBurstCompilation": true,
|
"EnableBurstCompilation": true,
|
||||||
"EnableOptimisations": true,
|
"EnableOptimisations": true,
|
||||||
"EnableSafetyChecks": false,
|
"EnableSafetyChecks": false,
|
||||||
"EnableDebugInAllBuilds": false,
|
"EnableDebugInAllBuilds": false,
|
||||||
"UsePlatformSDKLinker": false,
|
"DebugDataKind": 0,
|
||||||
|
"EnableArmv9SecurityFeatures": false,
|
||||||
"CpuMinTargetX32": 0,
|
"CpuMinTargetX32": 0,
|
||||||
"CpuMaxTargetX32": 0,
|
"CpuMaxTargetX32": 0,
|
||||||
"CpuMinTargetX64": 0,
|
"CpuMinTargetX64": 0,
|
||||||
"CpuMaxTargetX64": 0,
|
"CpuMaxTargetX64": 0,
|
||||||
"CpuTargetsX32": 6,
|
"CpuTargetsX32": 6,
|
||||||
"CpuTargetsX64": 72
|
"CpuTargetsX64": 72,
|
||||||
|
"OptimizeFor": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
ProjectSettings/BurstAotSettings_WebGL.json
Normal file
16
ProjectSettings/BurstAotSettings_WebGL.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"MonoBehaviour": {
|
||||||
|
"Version": 4,
|
||||||
|
"EnableBurstCompilation": true,
|
||||||
|
"EnableOptimisations": true,
|
||||||
|
"EnableSafetyChecks": false,
|
||||||
|
"EnableDebugInAllBuilds": false,
|
||||||
|
"DebugDataKind": 1,
|
||||||
|
"EnableArmv9SecurityFeatures": false,
|
||||||
|
"CpuMinTargetX32": 0,
|
||||||
|
"CpuMaxTargetX32": 0,
|
||||||
|
"CpuMinTargetX64": 0,
|
||||||
|
"CpuMaxTargetX64": 0,
|
||||||
|
"OptimizeFor": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"MonoBehaviour": {
|
"MonoBehaviour": {
|
||||||
"Version": 3,
|
"Version": 4,
|
||||||
"DisabledWarnings": ""
|
"DisabledWarnings": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
ProjectSettings/TimelineSettings.asset
Normal file
16
ProjectSettings/TimelineSettings.asset
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &1
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 53
|
||||||
|
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: a287be6c49135cd4f9b2b8666c39d999, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
assetDefaultFramerate: 60
|
||||||
|
m_DefaultFrameRate: 60
|
||||||
Reference in New Issue
Block a user