-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bd4859
commit 35e9059
Showing
31 changed files
with
2,423 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &4763396351559766122 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 4763396351559766127} | ||
- component: {fileID: 4763396351559766126} | ||
- component: {fileID: 4763396351559766125} | ||
- component: {fileID: 4763396351559766124} | ||
- component: {fileID: 4763396351559766123} | ||
m_Layer: 0 | ||
m_Name: Asteroid | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &4763396351559766127 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4763396351559766122} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!33 &4763396351559766126 | ||
MeshFilter: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4763396351559766122} | ||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} | ||
--- !u!23 &4763396351559766125 | ||
MeshRenderer: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4763396351559766122} | ||
m_Enabled: 1 | ||
m_CastShadows: 1 | ||
m_ReceiveShadows: 1 | ||
m_DynamicOccludee: 1 | ||
m_StaticShadowCaster: 0 | ||
m_MotionVectors: 1 | ||
m_LightProbeUsage: 1 | ||
m_ReflectionProbeUsage: 1 | ||
m_RayTracingMode: 2 | ||
m_RayTraceProcedural: 0 | ||
m_RenderingLayerMask: 1 | ||
m_RendererPriority: 0 | ||
m_Materials: | ||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} | ||
m_StaticBatchInfo: | ||
firstSubMesh: 0 | ||
subMeshCount: 0 | ||
m_StaticBatchRoot: {fileID: 0} | ||
m_ProbeAnchor: {fileID: 0} | ||
m_LightProbeVolumeOverride: {fileID: 0} | ||
m_ScaleInLightmap: 1 | ||
m_ReceiveGI: 1 | ||
m_PreserveUVs: 0 | ||
m_IgnoreNormalsForChartDetection: 0 | ||
m_ImportantGI: 0 | ||
m_StitchLightmapSeams: 1 | ||
m_SelectedEditorRenderState: 3 | ||
m_MinimumChartSize: 4 | ||
m_AutoUVMaxDistance: 0.5 | ||
m_AutoUVMaxAngle: 89 | ||
m_LightmapParameters: {fileID: 0} | ||
m_SortingLayerID: 0 | ||
m_SortingLayer: 0 | ||
m_SortingOrder: 0 | ||
m_AdditionalVertexStreams: {fileID: 0} | ||
--- !u!135 &4763396351559766124 | ||
SphereCollider: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4763396351559766122} | ||
m_Material: {fileID: 0} | ||
m_IsTrigger: 0 | ||
m_Enabled: 1 | ||
serializedVersion: 2 | ||
m_Radius: 0.5 | ||
m_Center: {x: 0, y: 0, z: 0} | ||
--- !u!114 &4763396351559766123 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4763396351559766122} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: e1f185a3cf0cb234c8b5242579f4aaca, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
_transform: {fileID: 4763396351559766127} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
Assets/Sources/Client/AsteroidLogic/AsteroidsBootstrapper.cs
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
Assets/Sources/Client/AsteroidLogic/Bootstrapper/AsteroidsBootstrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using Client.BootstrapperLogic; | ||
using Server.AsteroidLogic; | ||
using Server.BrickLogic; | ||
using UnityEngine; | ||
using Zenject; | ||
|
||
namespace Client.AsteroidLogic | ||
{ | ||
internal sealed class AsteroidsBootstrapper : Bootstrapper | ||
{ | ||
[SerializeField] private float _spawnIfCounterValueIs; | ||
|
||
[Space] | ||
|
||
private AsteroidWrapper _asteroidWrapper; | ||
private IAsteroidViewFactory _factory; | ||
private IReadOnlyBricksDatabase _database; | ||
|
||
private int _counter; | ||
|
||
[Inject] | ||
private void Constructor(AsteroidWrapper asteroidWrapper, IAsteroidViewFactory factory, IReadOnlyBricksDatabase database) | ||
{ | ||
_asteroidWrapper = asteroidWrapper; | ||
_factory = factory; | ||
_database = database; | ||
} | ||
|
||
public override void Boot() | ||
{ | ||
_database.OnAddBrick += UpdateCounter; | ||
} | ||
|
||
private void UpdateCounter() | ||
{ | ||
_counter++; | ||
|
||
if(_counter >= _spawnIfCounterValueIs) | ||
{ | ||
SpawnAsteroid(); | ||
|
||
_counter = 0; | ||
} | ||
} | ||
|
||
private void Update() | ||
{ | ||
_asteroidWrapper.FlyTick(); | ||
} | ||
|
||
private void SpawnAsteroid() | ||
{ | ||
IReadOnlyAsteroid instance; | ||
|
||
try | ||
{ | ||
instance = _asteroidWrapper.TryThrowRandomAsteroid(); | ||
} | ||
catch | ||
{ | ||
return; | ||
} | ||
|
||
AsteroidView viewInstance = _factory.Create(instance.Target); | ||
|
||
viewInstance.SetCallbacks(instance, _database.Surface); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...teroidLogic/AsteroidsBootstrapper.cs.meta → ...ootstrapper/AsteroidsBootstrapper.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
Assets/Sources/Client/AsteroidLogic/Factories/AsteroidViewFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using UnityEngine; | ||
|
||
namespace Client.AsteroidLogic | ||
{ | ||
internal sealed class AsteroidViewFactory : IAsteroidViewFactory | ||
{ | ||
private readonly AsteroidView _prefab; | ||
private readonly Transform _spawnPoint; | ||
|
||
public AsteroidViewFactory(AsteroidView prefab, Transform spawnPoint) | ||
{ | ||
_prefab = prefab; | ||
_spawnPoint = spawnPoint; | ||
} | ||
|
||
public AsteroidView Create(Vector3Int target) | ||
{ | ||
AsteroidView instance = Object.Instantiate(_prefab, _spawnPoint.position, Quaternion.identity); | ||
|
||
instance.Initialize(target); | ||
|
||
return instance; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Sources/Client/AsteroidLogic/Factories/AsteroidViewFactory.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.