2 Commits
6 changed files with 27 additions and 50 deletions

No files matched your search

+7 -28
View File
@@ -5,32 +5,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="ed1a3c4f-83ac-4211-ae32-004a26afd5d8" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlatformerEntitySettings.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlatformerEntitySettings.cs.meta" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Level.meta" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Level/PlatformerLevelData.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Level/PlatformerLevelData.cs.meta" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.Infratest/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Infratest/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/AddressableAssetsData/AddressableAssetSettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/AddressableAssetsData/AddressableAssetSettings.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Entity.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Entity.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/EntityHealth.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/EntityHealth.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlatformerEnemyFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlatformerEnemyFactory.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/PlatformerSceneInstaller.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/PlatformerSceneInstaller.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlayerEntity.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlayerEntity.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/PlatformerState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/PlatformerState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Configs/ConfigLocator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Configs/ConfigLocator.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Configs/SystemConfigsReferences.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Configs/SystemConfigsReferences.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources/SystemConfigsReferences.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources/SystemConfigsReferences.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources/UI/Fonts/Bebas Neue Cyrillic SDF.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources/UI/Fonts/Bebas Neue Cyrillic SDF.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Platformer.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Platformer.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Snail.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Snail.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Example.Race.UI.PlayerScoreCounterEvents.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Example.Race.UI.PlayerScoreCounterEvents.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Example.Race.UI.PlayerScoresEvents.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Example.Race.UI.PlayerScoresEvents.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.UI.Panels.LoadingPanelEvents.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.UI.Panels.LoadingPanelEvents.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.UI.Panels.LogoPanelEvents.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.UI.Panels.LogoPanelEvents.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.UI.Panels.MenuChoosePanelEvents.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.UI.Panels.MenuChoosePanelEvents.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/PlatformerEnemySettingsConfig.Generated.cs" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/PlatformerEnemySettingsConfig.Generated.cs.meta" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -200,15 +180,13 @@
</option>
<method v="2" />
</configuration>
<configuration name="Attach to Unity Editor" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="Unity Debug" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost" useMixedMode="false" ignored-value-for-modified-check="3713">
<configuration name="Attach to Unity Editor" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="Unity Debug" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost" useMixedMode="false">
<option name="allowRunningInParallel" value="false" />
<option name="listenPortForConnections" value="false" />
<option name="pid" value="3713" />
<option name="pid" />
<option name="projectPathOnTarget" />
<option name="runtimes">
<list>
<MonoRuntime />
</list>
<list />
</option>
<option name="selectedOptions">
<list />
@@ -313,6 +291,7 @@
<workItem from="1771429673395" duration="3644000" />
<workItem from="1771433586006" duration="1485000" />
<workItem from="1773065611992" duration="4340000" />
<workItem from="1773758943752" duration="396000" />
</task>
<servers />
</component>
@@ -15,13 +15,11 @@ namespace Code.Example.Platformer.Entity
[SerializeField] protected SpriteRenderer spriteRenderer;
[SerializeField] private Vector2 groundPoint;
private EntityHealth _health;
private PlatformerEntityData _data;
public void SetData(PlatformerEntityData data)
{
_data = data;
_health = new(data.maxHealth);
}
protected bool onGround;
@@ -51,7 +49,5 @@ namespace Code.Example.Platformer.Entity
}
protected abstract void Move();
public virtual void GetDamage(int damage) => _health.GiveDamage(damage);
}
}
@@ -1,15 +1,14 @@
using UnityEngine;
namespace Code.Example.Platformer.Entity
{
public class EntityHealth
public class EntityHealth : MonoBehaviour
{
private int _health, _maxHealth;
private int _health;
private int _maxHealth;
public void SetMaxHealth(int maxHealth) => _maxHealth = maxHealth;
public bool IsDead { get; private set; }
public EntityHealth(int initialHealth)
{
_health = initialHealth;
}
public void GiveDamage(int damage)
{
_health -= damage;
@@ -12,7 +12,7 @@ namespace Code.Example.Platformer.Entity
{
public interface IPlatformerEnemyFactory
{
UniTaskVoid LoadEnemy(PlatformerEntityType enemyType);
UniTaskVoid WarmEnemy(PlatformerEntityType enemyType);
void ReleaseEnemy(PlatformerEntityType racerType);
UniTaskVoid SpawnEnemy(
@@ -45,12 +45,11 @@ namespace Code.Example.Platformer.Entity
await _enemyConfigsHandle.ToUniTask();
_enemyConfigs = _enemyConfigsHandle.Result.ToDictionary(x => x.EntityData.type);
_enemyConfigs.Remove(PlatformerEntityType.Player);
_eventBus.RaiseEvent<IPlatformerEnemyFactoryInitializedHandle>(x => x.PlatformerEnemyFactoryInitialized());
}
public async UniTaskVoid LoadEnemy(PlatformerEntityType enemyType)
public async UniTaskVoid WarmEnemy(PlatformerEntityType enemyType)
{
if (enemyType == PlatformerEntityType.Player) return;
@@ -66,10 +65,14 @@ namespace Code.Example.Platformer.Entity
Addressables.LoadAssetAsync<GameObject>(_enemyConfigs[enemyType].prefabReference));
await _enemyPrefabsHandle[enemyType].ToUniTask();
var racer = _enemyPrefabsHandle[enemyType].Result.GetComponent<Entity>();
racer.SetData(_enemyConfigs[enemyType].EntityData);
_eventBus.RaiseEvent<IPlatformerEnemyLoadedHandle>(x => x.PlatformerEnemyLoaded(enemyType, racer));
var entity = _enemyPrefabsHandle[enemyType].Result.GetComponent<Entity>();
entity.SetData(_enemyConfigs[enemyType].EntityData);
var health = _enemyPrefabsHandle[enemyType].Result.GetComponent<EntityHealth>();
health.SetMaxHealth(_enemyConfigs[enemyType].EntityData.maxHealth);
_eventBus.RaiseEvent<IPlatformerEnemyLoadedHandle>(x => x.PlatformerEnemyLoaded(enemyType, entity));
}
public void ReleaseEnemy(PlatformerEntityType racerType)
@@ -88,7 +88,7 @@ namespace Code.Example.Platformer.Entity
foreach (var damaged in damagedOnes)
{
damaged.gameObject.GetComponent<Entity>().GetDamage(1);
damaged.gameObject.GetComponent<EntityHealth>().GiveDamage(1);
_audioService.PlayOneShot(AudioNames.UISounds, 2);
}
}
@@ -89,9 +89,9 @@ namespace Code.Example.Platformer
_firstLevelData = container.Resolve<PlatformerFirstLevelData>();
_enemyFactory = container.Resolve<IPlatformerEnemyFactory>();
_enemyFactory.LoadEnemy(PlatformerEntityType.Bee);
_enemyFactory.LoadEnemy(PlatformerEntityType.Boar);
_enemyFactory.LoadEnemy(PlatformerEntityType.Snail);
_enemyFactory.WarmEnemy(PlatformerEntityType.Bee);
_enemyFactory.WarmEnemy(PlatformerEntityType.Boar);
_enemyFactory.WarmEnemy(PlatformerEntityType.Snail);
_playerFactory = container.Resolve<IPlatformerPlayerFactory>();