Multiple entities
This commit is contained in:
1 parent
ccc4c04234
commit
1de0e93ae0
5677 files changed
+364912
-919855
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Code.Game.Cleaning.Player;
|
||||
using Code.Game.Gameplay.Player;
|
||||
using Code.Game.Gameplay.Player.Factory;
|
||||
@@ -8,6 +9,7 @@ using Code.Infrastructure.Input;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using Code.Infrastructure.UI;
|
||||
using Code.Infrastructure.Utils;
|
||||
using Code.OfficeGame.BattleMode.Actions;
|
||||
using Code.OfficeGame.BattleMode.Actions.Player;
|
||||
using Code.OfficeGame.BattleMode.UI;
|
||||
using Code.OfficeGame.Player;
|
||||
@@ -16,6 +18,7 @@ using KinematicCharacterController;
|
||||
using ObservableCollections;
|
||||
using R3;
|
||||
using Reflex.Core;
|
||||
using Reflex.Injectors;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -35,21 +38,22 @@ namespace Code.Game.TestingLevel
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR
|
||||
Context.InputService.EnableMap(ActionMappings.Debug);
|
||||
|
||||
Context.InputService.BindActionPerformed((int)ActionMappings.Debug, (int)DebugActions.ToggleBattleMode, ToggleBattleMode);
|
||||
#endif
|
||||
|
||||
|
||||
Context.InputService.BindActionPerformed((int)ActionMappings.Debug, (int)DebugActions.ToggleBattleMode,
|
||||
ToggleBattleMode);
|
||||
#endif
|
||||
|
||||
Context.InputService.EnableMap(ActionMappings.OpenMovement);
|
||||
Context.InputService.EnableMap(ActionMappings.UI); //
|
||||
|
||||
|
||||
await Context.Camera.SwitchState(CameraMode.OpenMovement);
|
||||
|
||||
if (Context.StateMachine.CurrentState == AppStates.BattleState) return;
|
||||
|
||||
|
||||
Context.AudioService.SetAudioListener(Context.Camera.Camera.GetComponent<AudioListener>());
|
||||
|
||||
|
||||
var waitForContainer =
|
||||
Context.SceneContainerManager.ScenesContainers
|
||||
.ObserveDictionaryAdd()
|
||||
@@ -65,44 +69,44 @@ namespace Code.Game.TestingLevel
|
||||
var factory = new PlayerFactory(factoryConfig);
|
||||
var player = await factory.CreatePlayer();
|
||||
var playerKinematicCharacterMotor = player.GetComponent<KinematicCharacterMotor>();
|
||||
var playerMovementController = player.GetComponent<PlayerMovementController>();
|
||||
var playerMovementController = player.GetComponent<MovementController>();
|
||||
var playerControlsProvider = player.GetComponent<PlayerControlsProvider>();
|
||||
var playerAnimatorProvider = player.GetComponent<PlayerAnimator>();
|
||||
var playerTimelineActor = player.GetComponent<PlayerTimelineActor>();
|
||||
var playerTimelineActor = player.GetComponent<PlayerControlledTimelineActor>();
|
||||
|
||||
playerMovementController.Freeze = true;
|
||||
|
||||
BattleActionDecisionPanel battleActionDecisionPanel =
|
||||
(BattleActionDecisionPanel) await Context.UIFactory
|
||||
.LoadPanel(UIPanelType.BattleActionDecision,false);
|
||||
|
||||
|
||||
BattleActionDecisionPanel battleActionDecisionPanel =
|
||||
(BattleActionDecisionPanel)await Context.UIFactory
|
||||
.LoadPanel(UIPanelType.BattleActionDecision, false);
|
||||
|
||||
// ((OpenMovementCameraState)Context.Camera.CurrentBaseState).SetTarget(player.transform);
|
||||
|
||||
|
||||
void InstallExtra(Scene scene, ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterValue(factoryConfig);
|
||||
builder.RegisterValue(factory, new []{typeof(IPlayerFactory)});
|
||||
builder.RegisterValue(factory, new[] { typeof(IPlayerFactory) });
|
||||
builder.RegisterValue(playerKinematicCharacterMotor);
|
||||
builder.RegisterValue(playerMovementController);
|
||||
builder.RegisterValue(playerControlsProvider);
|
||||
builder.RegisterValue(playerAnimatorProvider);
|
||||
builder.RegisterValue(playerTimelineActor);
|
||||
|
||||
|
||||
builder.RegisterValue(battleActionDecisionPanel);
|
||||
}
|
||||
|
||||
|
||||
await UniTask.WhenAll(
|
||||
Context.SceneLoader
|
||||
.LoadSceneAsync(
|
||||
SceneId.Testing,
|
||||
LoadSceneMode.Single,
|
||||
true,
|
||||
InstallExtra),
|
||||
InstallExtra),
|
||||
Context.SceneLoader
|
||||
.LoadSceneAsync(
|
||||
SceneId.FirstTestingSegment,
|
||||
LoadSceneMode.Additive,
|
||||
false),
|
||||
false),
|
||||
Context.SceneLoader
|
||||
.LoadSceneAsync(
|
||||
SceneId.SecondTestingSegment,
|
||||
@@ -110,14 +114,21 @@ namespace Code.Game.TestingLevel
|
||||
false),
|
||||
waitForContainer
|
||||
);
|
||||
|
||||
|
||||
var container = Context.SceneContainerManager.ScenesContainers[SceneId.Testing];
|
||||
|
||||
container.Resolve<KinematicCharacterMotor>()
|
||||
.SetPositionAndRotation(
|
||||
container.Resolve<TestingLevelData>().playerSpawnPoint.position,
|
||||
container.Resolve<TestingLevelData>().playerSpawnPoint.rotation);
|
||||
|
||||
|
||||
var entities =
|
||||
Object.FindObjectsByType<EntityTimelineActor>()
|
||||
.Select(x => x.gameObject)
|
||||
.ToList();
|
||||
|
||||
GameObjectInjector.InjectRecursiveMany(entities, container);
|
||||
|
||||
playerMovementController.Freeze = false;
|
||||
}
|
||||
|
||||
@@ -130,12 +141,13 @@ namespace Code.Game.TestingLevel
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Context.InputService.DisableMap(ActionMappings.Debug);
|
||||
Context.InputService.UnbindActionPerformed((int)ActionMappings.Debug, (int)DebugActions.ToggleBattleMode, ToggleBattleMode);
|
||||
Context.InputService.UnbindActionPerformed((int)ActionMappings.Debug, (int)DebugActions.ToggleBattleMode,
|
||||
ToggleBattleMode);
|
||||
#endif
|
||||
Context.InputService.DisableMap(ActionMappings.OpenMovement);
|
||||
|
||||
if (Context.StateMachine.NextState == AppStates.BattleState) return;
|
||||
|
||||
|
||||
await Context.SceneLoader.UnloadSceneAsync(SceneId.Testing);
|
||||
await Context.SceneLoader.UnloadSceneAsync(SceneId.FirstTestingSegment);
|
||||
await Context.SceneLoader.UnloadSceneAsync(SceneId.SecondTestingSegment);
|
||||
|
||||
Reference in new issue
Block a user