mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 09:28:07 +08:00
Move combat related code to Combat folder
This commit is contained in:
1 parent
927d62ff19
commit
264db76be5
33 files changed
+146
-118
No files matched your search
@@ -13,7 +13,6 @@ namespace Pal3.Game.Actor
|
||||
using Dev.Presenters;
|
||||
using Engine.Core.Abstraction;
|
||||
using Engine.Core.Implementation;
|
||||
using GameSystems.Combat;
|
||||
using Scene;
|
||||
|
||||
using Color = Core.Primitives.Color;
|
||||
@@ -22,7 +21,7 @@ namespace Pal3.Game.Actor
|
||||
public static class ActorFactory
|
||||
{
|
||||
public static IGameEntity CreateActorGameEntity(GameResourceProvider resourceProvider,
|
||||
Actor actor,
|
||||
GameActor actor,
|
||||
Tilemap tilemap,
|
||||
bool isDropShadowEnabled,
|
||||
Color tintColor,
|
||||
@@ -110,56 +109,5 @@ namespace Pal3.Game.Actor
|
||||
|
||||
return actorGameEntity;
|
||||
}
|
||||
|
||||
public static IGameEntity CreateCombatActorGameEntity(GameResourceProvider resourceProvider,
|
||||
CombatActor actor,
|
||||
ElementPosition elementPosition,
|
||||
bool isDropShadowEnabled)
|
||||
{
|
||||
IGameEntity actorGameEntity = GameEntityFactory.Create($"CombatActor_{actor.Id}_{actor.Name}");
|
||||
|
||||
// Attach CombatActorInfo to the GameEntity for better debuggability
|
||||
#if UNITY_EDITOR
|
||||
CombatActorInfoPresenter combatActorInfoPresent = actorGameEntity.AddComponent<CombatActorInfoPresenter>();
|
||||
combatActorInfoPresent.combatActorInfo = actor.Info;
|
||||
#endif
|
||||
|
||||
ActorActionController actionController;
|
||||
switch (actor.AnimationType)
|
||||
{
|
||||
case ActorAnimationType.Vertex:
|
||||
{
|
||||
VertexAnimationActorActionController vertexActionController =
|
||||
actorGameEntity.AddComponent<VertexAnimationActorActionController>();
|
||||
vertexActionController.Init(resourceProvider,
|
||||
actor,
|
||||
hasColliderAndRigidBody: false, // combat actor has no collider and rigidbody
|
||||
isDropShadowEnabled,
|
||||
autoStand: true, // combat actor always auto stand
|
||||
canPerformHoldAnimation: false); // combat actor can't perform hold animation
|
||||
actionController = vertexActionController;
|
||||
break;
|
||||
}
|
||||
case ActorAnimationType.Skeletal:
|
||||
{
|
||||
SkeletalAnimationActorActionController skeletalActionController =
|
||||
actorGameEntity.AddComponent<SkeletalAnimationActorActionController>();
|
||||
skeletalActionController.Init(resourceProvider,
|
||||
actor,
|
||||
hasColliderAndRigidBody: false, // combat actor has no collider and rigidbody
|
||||
isDropShadowEnabled);
|
||||
actionController = skeletalActionController;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new NotSupportedException($"Unsupported actor animation type: {actor.AnimationType}");
|
||||
}
|
||||
|
||||
CombatActorController actorController = actorGameEntity.AddComponent<CombatActorController>();
|
||||
actorController.Init(actor, actionController, elementPosition);
|
||||
actorController.IsActive = true; // combat actor is always active
|
||||
|
||||
return actorGameEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace Pal3.Game.Actor.Controllers
|
||||
ICommandExecutor<ActorSetYPositionCommand>,
|
||||
ICommandExecutor<ActorChangeScaleCommand>
|
||||
{
|
||||
private Actor _actor;
|
||||
private GameActor _actor;
|
||||
private ActorActionController _actionController;
|
||||
private ActorMovementController _movementController;
|
||||
private PlayerInputActions _inputActions;
|
||||
@@ -64,7 +64,7 @@ namespace Pal3.Game.Actor.Controllers
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public void Init(Actor actor,
|
||||
public void Init(GameActor actor,
|
||||
ActorActionController actionController,
|
||||
ActorMovementController movementController)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ namespace Pal3.Game.Actor.Controllers
|
||||
return _actor.GetScriptId() != ScriptConstants.InvalidScriptId;
|
||||
}
|
||||
|
||||
public Actor GetActor()
|
||||
public GameActor GetActor()
|
||||
{
|
||||
return _actor;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Pal3.Game.Actor.Controllers
|
||||
ICommandExecutor<ActorActivateCommand>,
|
||||
ICommandExecutor<ActorSetNavLayerCommand>
|
||||
{
|
||||
private Actor _actor;
|
||||
private GameActor _actor;
|
||||
private Tilemap _tilemap;
|
||||
private ActorActionController _actionController;
|
||||
private int _currentLayerIndex = 0;
|
||||
@@ -97,7 +97,7 @@ namespace Pal3.Game.Actor.Controllers
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public void Init(Actor actor,
|
||||
public void Init(GameActor actor,
|
||||
Tilemap tilemap,
|
||||
ActorActionController actionController,
|
||||
float movementMaxYDifferential,
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ namespace Pal3.Game.Actor
|
||||
using Data;
|
||||
using Engine.Extensions;
|
||||
|
||||
public sealed class Actor : ActorBase
|
||||
public sealed class GameActor : ActorBase
|
||||
{
|
||||
private const float DEFAULT_ROTATION_SPEED = 20f;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Pal3.Game.Actor
|
||||
private uint? _overwrittenScriptId;
|
||||
private uint? _overwrittenMoveSpeed;
|
||||
|
||||
public Actor(GameResourceProvider resourceProvider, ScnNpcInfo npcInfo) :
|
||||
public GameActor(GameResourceProvider resourceProvider, ScnNpcInfo npcInfo) :
|
||||
base(resourceProvider, npcInfo.Id, npcInfo.Name)
|
||||
{
|
||||
Info = npcInfo;
|
||||
File renamed without changes.
@@ -120,7 +120,7 @@ namespace Pal3.Game.Effect
|
||||
#if PAL3A
|
||||
private void HandleNanGongHuangTransformEffect(EffectAttachToActorCommand effectAttachToActorCommand,
|
||||
EffectPlayCommand effectPlayCommand,
|
||||
Scene currentScene)
|
||||
GameScene currentScene)
|
||||
{
|
||||
int actorId = effectAttachToActorCommand.ActorId;
|
||||
switch (effectPlayCommand.EffectGroupId)
|
||||
@@ -128,7 +128,7 @@ namespace Pal3.Game.Effect
|
||||
// 南宫煌切换为狼妖形态特效
|
||||
case 164:
|
||||
{
|
||||
Actor actor = currentScene.GetActor(actorId);
|
||||
GameActor actor = currentScene.GetActor(actorId);
|
||||
actor.ChangeName(ActorConstants.NanGongHuangWolfModeActorName);
|
||||
if (actor.IsActive)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace Pal3.Game.Effect
|
||||
// 南宫煌切换为人形态特效
|
||||
case 315:
|
||||
{
|
||||
Actor actor = currentScene.GetActor(actorId);
|
||||
GameActor actor = currentScene.GetActor(actorId);
|
||||
actor.ChangeName(ActorConstants.NanGongHuangHumanModeActorName);
|
||||
if (actor.IsActive)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Pal3.Game.GamePlay
|
||||
{
|
||||
public void Execute(ActorPerformClimbActionCommand command)
|
||||
{
|
||||
Scene scene = _sceneManager.GetCurrentScene();
|
||||
GameScene scene = _sceneManager.GetCurrentScene();
|
||||
SceneObject climbableSceneObject = scene.GetSceneObject(command.ObjectId);
|
||||
IGameEntity climbableEntity = climbableSceneObject.GetGameEntity();
|
||||
if (climbableEntity == null)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Pal3.Game.GamePlay
|
||||
{
|
||||
public void Execute(PlayerInteractWithObjectCommand command)
|
||||
{
|
||||
Scene currentScene = _sceneManager.GetCurrentScene();
|
||||
GameScene currentScene = _sceneManager.GetCurrentScene();
|
||||
if (currentScene.GetAllActivatedSceneObjects().Contains(command.SceneObjectId))
|
||||
{
|
||||
Pal3.Instance.StartCoroutine(InteractWithSceneObjectAsync(
|
||||
@@ -175,7 +175,7 @@ namespace Pal3.Game.GamePlay
|
||||
Pal3.Instance.Execute(new GameStateChangeRequest(GameState.Cutscene));
|
||||
Pal3.Instance.Execute(new ActorStopActionAndStandCommand(ActorConstants.PlayerActorVirtualID));
|
||||
|
||||
Actor targetActor = _sceneManager.GetCurrentScene().GetActor(actorId);
|
||||
GameActor targetActor = _sceneManager.GetCurrentScene().GetActor(actorId);
|
||||
Quaternion rotationBeforeInteraction = actorGameEntity.Transform.Rotation;
|
||||
|
||||
ActorController actorController = actorGameEntity.GetComponent<ActorController>();
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Pal3.Game.GamePlay
|
||||
|
||||
Vector3 currentPosition = _playerActorMovementController.GetWorldPosition();
|
||||
|
||||
Scene currentScene = _sceneManager.GetCurrentScene();
|
||||
GameScene currentScene = _sceneManager.GetCurrentScene();
|
||||
Tilemap tilemap = currentScene.GetTilemap();
|
||||
|
||||
bool IsPositionCanJumpTo(Vector3 position, int layerIndex, out float yPosition, out int distanceToObstacle)
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Pal3.Game.GamePlay
|
||||
{
|
||||
if (!_lastInputTapPosition.HasValue) return;
|
||||
|
||||
Scene currentScene = _sceneManager.GetCurrentScene();
|
||||
GameScene currentScene = _sceneManager.GetCurrentScene();
|
||||
|
||||
int hitCount = _physicsManager.CameraRaycastFromScreenPoint(
|
||||
_lastInputTapPosition.Value,
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Pal3.Game.GamePlay
|
||||
private int _longKuiLastKnownMode = 0;
|
||||
#endif
|
||||
|
||||
private Actor _playerActor;
|
||||
private GameActor _playerActor;
|
||||
private IGameEntity _playerActorGameEntity;
|
||||
private ActorController _playerActorController;
|
||||
private ActorActionController _playerActorActionController;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bb2ce918fa3466faf2a2cb83e43bdef
|
||||
timeCreated: 1726912744
|
||||
+2
-1
@@ -3,12 +3,13 @@
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Game.Actor
|
||||
namespace Pal3.Game.GameSystems.Combat.Actor
|
||||
{
|
||||
using Core.Contract.Constants;
|
||||
using Core.Contract.Enums;
|
||||
using Core.DataReader.Gdb;
|
||||
using Data;
|
||||
using Game.Actor;
|
||||
|
||||
public sealed class CombatActor : ActorBase
|
||||
{
|
||||
File renamed without changes.
@@ -0,0 +1,64 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2024, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Game.GameSystems.Combat.Actor
|
||||
{
|
||||
using System;
|
||||
using Combat;
|
||||
using Controllers;
|
||||
using Data;
|
||||
using Dev.Presenters;
|
||||
using Engine.Core.Abstraction;
|
||||
using Engine.Core.Implementation;
|
||||
using Game.Actor;
|
||||
using Game.Actor.Controllers;
|
||||
|
||||
using Color = Core.Primitives.Color;
|
||||
using Vector2Int = UnityEngine.Vector2Int;
|
||||
|
||||
public static class CombatActorFactory
|
||||
{
|
||||
public static IGameEntity CreateCombatActorGameEntity(GameResourceProvider resourceProvider,
|
||||
CombatActor actor,
|
||||
ElementPosition elementPosition,
|
||||
bool isDropShadowEnabled)
|
||||
{
|
||||
IGameEntity actorGameEntity = GameEntityFactory.Create($"CombatActor_{actor.Id}_{actor.Name}");
|
||||
|
||||
// Attach CombatActorInfo to the GameEntity for better debuggability
|
||||
#if UNITY_EDITOR
|
||||
CombatActorInfoPresenter combatActorInfoPresent = actorGameEntity.AddComponent<CombatActorInfoPresenter>();
|
||||
combatActorInfoPresent.combatActorInfo = actor.Info;
|
||||
#endif
|
||||
|
||||
ActorActionController actionController;
|
||||
switch (actor.AnimationType)
|
||||
{
|
||||
case ActorAnimationType.Vertex:
|
||||
{
|
||||
VertexAnimationActorActionController vertexActionController =
|
||||
actorGameEntity.AddComponent<VertexAnimationActorActionController>();
|
||||
vertexActionController.Init(resourceProvider,
|
||||
actor,
|
||||
hasColliderAndRigidBody: false, // combat actor has no collider and rigidbody
|
||||
isDropShadowEnabled,
|
||||
autoStand: true, // combat actor always auto stand
|
||||
canPerformHoldAnimation: false); // combat actor can't perform hold animation
|
||||
actionController = vertexActionController;
|
||||
break;
|
||||
}
|
||||
case ActorAnimationType.Skeletal:
|
||||
default:
|
||||
throw new NotSupportedException($"Unsupported actor animation type: {actor.AnimationType}");
|
||||
}
|
||||
|
||||
CombatActorController actorController = actorGameEntity.AddComponent<CombatActorController>();
|
||||
actorController.Init(actor, actionController, elementPosition);
|
||||
actorController.IsActive = true; // combat actor is always active
|
||||
|
||||
return actorGameEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 839f09ca72114971b5274895a2a88fa8
|
||||
timeCreated: 1726912818
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 974221895412441db28592f1c874c01c
|
||||
timeCreated: 1726912777
|
||||
+4
-4
@@ -3,16 +3,15 @@
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Game.Actor.Controllers
|
||||
namespace Pal3.Game.GameSystems.Combat.Actor.Controllers
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Combat;
|
||||
using Engine.Animation;
|
||||
using Engine.Core.Implementation;
|
||||
using Engine.Coroutine;
|
||||
using GameSystems.Combat;
|
||||
using Game.Actor.Controllers;
|
||||
using Scene;
|
||||
using Script.Waiter;
|
||||
|
||||
using Quaternion = UnityEngine.Quaternion;
|
||||
using Vector3 = UnityEngine.Vector3;
|
||||
@@ -73,6 +72,7 @@ namespace Pal3.Game.Actor.Controllers
|
||||
{
|
||||
if (_actionController is VertexAnimationActorActionController vertexActionController)
|
||||
{
|
||||
vertexActionController.AnimationEventTriggered -= AnimationEventTriggered;
|
||||
vertexActionController.AnimationEventTriggered += AnimationEventTriggered;
|
||||
}
|
||||
|
||||
File renamed without changes.
@@ -9,7 +9,6 @@ namespace Pal3.Game.GameSystems.Combat
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Actor.Controllers;
|
||||
using Audio;
|
||||
using Command;
|
||||
using Command.Extensions;
|
||||
@@ -24,8 +23,10 @@ namespace Pal3.Game.GameSystems.Combat
|
||||
using Data;
|
||||
using Engine.Core.Abstraction;
|
||||
using Engine.Logging;
|
||||
using Game.Actor;
|
||||
using Game.Actor.Controllers;
|
||||
using Game.Scene;
|
||||
using GamePlay;
|
||||
using Scene;
|
||||
using Script.Waiter;
|
||||
using Settings;
|
||||
using State;
|
||||
@@ -94,7 +95,7 @@ namespace Pal3.Game.GameSystems.Combat
|
||||
{
|
||||
if (!_gameSettings.IsTurnBasedCombatEnabled) return;
|
||||
|
||||
Scene currentScene = _sceneManager.GetCurrentScene();
|
||||
GameScene currentScene = _sceneManager.GetCurrentScene();
|
||||
|
||||
// Figure out which combat scene to use
|
||||
string combatSceneName = GetCombatSceneName(currentScene);
|
||||
@@ -156,7 +157,7 @@ namespace Pal3.Game.GameSystems.Combat
|
||||
}
|
||||
}
|
||||
|
||||
private string GetCombatSceneName(Scene currentScene)
|
||||
private string GetCombatSceneName(GameScene currentScene)
|
||||
{
|
||||
ScnSceneInfo sceneInfo = currentScene.GetSceneInfo();
|
||||
|
||||
@@ -318,18 +319,18 @@ namespace Pal3.Game.GameSystems.Combat
|
||||
{
|
||||
Pal3.Instance.Execute(new ActorStopActionAndStandCommand(ActorConstants.PlayerActorVirtualID));
|
||||
|
||||
Scene currentScene = _sceneManager.GetCurrentScene();
|
||||
Actor.Actor combatActor = currentScene.GetActor(command.CombatActorId);
|
||||
GameScene currentScene = _sceneManager.GetCurrentScene();
|
||||
GameActor gameActor = currentScene.GetActor(command.CombatActorId);
|
||||
ITransform playerTransform = currentScene.GetActorGameEntity(command.PlayerActorId).Transform;
|
||||
ITransform enemyTransform = currentScene.GetActorGameEntity(command.CombatActorId).Transform;
|
||||
|
||||
_combatContextBuilder.WithMeetType(CalculateMeetType(playerTransform, enemyTransform));
|
||||
|
||||
Execute(new CombatEnterNormalFightCommand(
|
||||
combatActor.Info.NumberOfMonsters,
|
||||
combatActor.Info.MonsterIds[0],
|
||||
combatActor.Info.MonsterIds[1],
|
||||
combatActor.Info.MonsterIds[2]));
|
||||
gameActor.Info.NumberOfMonsters,
|
||||
gameActor.Info.MonsterIds[0],
|
||||
gameActor.Info.MonsterIds[1],
|
||||
gameActor.Info.MonsterIds[2]));
|
||||
}
|
||||
else // TODO: Remove once combat system is fully implemented
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Pal3.Game.GameSystems.Combat
|
||||
using Data;
|
||||
using Engine.Core.Abstraction;
|
||||
using Engine.Extensions;
|
||||
using Game.Scene;
|
||||
using Scene;
|
||||
using State;
|
||||
using Team;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27caea06d42f449698c44ff0b011317d
|
||||
timeCreated: 1726913181
|
||||
+4
-6
@@ -3,7 +3,7 @@
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Game.Scene
|
||||
namespace Pal3.Game.GameSystems.Combat.Scene
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Actor;
|
||||
@@ -18,7 +18,6 @@ namespace Pal3.Game.Scene
|
||||
using Engine.Core.Abstraction;
|
||||
using Engine.Core.Implementation;
|
||||
using Engine.Extensions;
|
||||
using GameSystems.Combat;
|
||||
using Rendering.Material;
|
||||
using Rendering.Renderer;
|
||||
|
||||
@@ -106,8 +105,7 @@ namespace Pal3.Game.Scene
|
||||
|
||||
public CombatActorController GetCombatActorController(ElementPosition elementPosition)
|
||||
{
|
||||
return _combatActorControllers.TryGetValue(elementPosition,
|
||||
out CombatActorController combatActorController) ? combatActorController : null;
|
||||
return _combatActorControllers.GetValueOrDefault(elementPosition);
|
||||
}
|
||||
|
||||
public void LoadActors(Dictionary<ElementPosition, CombatActorInfo> combatActors,
|
||||
@@ -126,8 +124,8 @@ namespace Pal3.Game.Scene
|
||||
combatActorInfo.ModelId = combatActorInfo.Id.ToString();
|
||||
}
|
||||
|
||||
CombatActor combatActor = new CombatActor(_resourceProvider, combatActorInfo);
|
||||
IGameEntity combatActorGameEntity = ActorFactory.CreateCombatActorGameEntity(
|
||||
CombatActor combatActor = new(_resourceProvider, combatActorInfo);
|
||||
IGameEntity combatActorGameEntity = CombatActorFactory.CreateCombatActorGameEntity(
|
||||
_resourceProvider,
|
||||
combatActor,
|
||||
elementPosition,
|
||||
File renamed without changes.
+5
-5
@@ -37,7 +37,7 @@ namespace Pal3.Game.Scene
|
||||
using UnityEngine;
|
||||
using Color = Core.Primitives.Color;
|
||||
|
||||
public sealed class Scene : SceneBase,
|
||||
public sealed class GameScene : SceneBase,
|
||||
ICommandExecutor<SceneActivateObjectCommand>,
|
||||
ICommandExecutor<SceneMoveObjectCommand>,
|
||||
ICommandExecutor<SceneOpenDoorCommand>,
|
||||
@@ -196,12 +196,12 @@ namespace Pal3.Game.Scene
|
||||
return SceneObjects;
|
||||
}
|
||||
|
||||
public Actor GetActor(int id)
|
||||
public GameActor GetActor(int id)
|
||||
{
|
||||
return Actors.GetValueOrDefault(id);
|
||||
}
|
||||
|
||||
public Dictionary<int, Actor> GetAllActors()
|
||||
public Dictionary<int, GameActor> GetAllActors()
|
||||
{
|
||||
return Actors;
|
||||
}
|
||||
@@ -420,7 +420,7 @@ namespace Pal3.Game.Scene
|
||||
|
||||
private void InitActorObjects(Color tintColor, Tilemap tilemap)
|
||||
{
|
||||
foreach (Actor actorObject in Actors.Values)
|
||||
foreach (GameActor actorObject in Actors.Values)
|
||||
{
|
||||
CreateActorObject(actorObject, tintColor, tilemap);
|
||||
}
|
||||
@@ -469,7 +469,7 @@ namespace Pal3.Game.Scene
|
||||
SceneObjects[id].Deactivate();
|
||||
}
|
||||
|
||||
private void CreateActorObject(Actor actor, Color tintColor, Tilemap tileMap)
|
||||
private void CreateActorObject(GameActor actor, Color tintColor, Tilemap tileMap)
|
||||
{
|
||||
if (_actorEntities.ContainsKey(actor.Id)) return;
|
||||
|
||||
File renamed without changes.
@@ -45,7 +45,7 @@ namespace Pal3.Game.Scene
|
||||
protected (CvdFile CvdFile, ITextureResourceProvider TextureProvider)? SceneCvdMesh;
|
||||
|
||||
protected readonly Dictionary<int, SceneObject> SceneObjects = new ();
|
||||
protected readonly Dictionary<int, Actor> Actors = new ();
|
||||
protected readonly Dictionary<int, GameActor> Actors = new ();
|
||||
|
||||
private HashSet<int> _sceneObjectIdsToNotLoadFromSaveState;
|
||||
|
||||
@@ -178,14 +178,14 @@ namespace Pal3.Game.Scene
|
||||
{
|
||||
foreach (ScnNpcInfo npcInfo in ScnFile.NpcInfos)
|
||||
{
|
||||
Actors[npcInfo.Id] = new Actor(_resourceProvider, npcInfo);
|
||||
Actors[npcInfo.Id] = new GameActor(_resourceProvider, npcInfo);
|
||||
}
|
||||
|
||||
foreach (ScnNpcInfo playerInfo in NpcInfoFactory.CreateAllPlayerActorNpcInfos())
|
||||
{
|
||||
if (!Actors.ContainsKey(playerInfo.Id))
|
||||
{
|
||||
Actors[playerInfo.Id] = new Actor(_resourceProvider, playerInfo);
|
||||
Actors[playerInfo.Id] = new GameActor(_resourceProvider, playerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Pal3.Game.Scene
|
||||
{
|
||||
if (!Actors.ContainsKey(fengYaSongInfo.Id))
|
||||
{
|
||||
Actors[fengYaSongInfo.Id] = new Actor(_resourceProvider, fengYaSongInfo);
|
||||
Actors[fengYaSongInfo.Id] = new GameActor(_resourceProvider, fengYaSongInfo);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Pal3.Game.Scene
|
||||
using Engine.Core.Implementation;
|
||||
using Engine.Extensions;
|
||||
using Engine.Logging;
|
||||
using GameSystems.Combat.Scene;
|
||||
using Newtonsoft.Json;
|
||||
using Script;
|
||||
using Settings;
|
||||
@@ -43,7 +44,7 @@ namespace Pal3.Game.Scene
|
||||
private IGameEntity _currentSceneRoot;
|
||||
private IGameEntity _currentCombatSceneRoot;
|
||||
|
||||
private Scene _currentScene;
|
||||
private GameScene _currentGameScene;
|
||||
private CombatScene _currentCombatScene;
|
||||
|
||||
private readonly HashSet<int> _sceneObjectIdsToNotLoadFromSaveState = new ();
|
||||
@@ -70,9 +71,9 @@ namespace Pal3.Game.Scene
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public Scene GetCurrentScene()
|
||||
public GameScene GetCurrentScene()
|
||||
{
|
||||
return _currentScene;
|
||||
return _currentGameScene;
|
||||
}
|
||||
|
||||
public CombatScene GetCurrentCombatScene()
|
||||
@@ -94,7 +95,7 @@ namespace Pal3.Game.Scene
|
||||
return null;
|
||||
}
|
||||
|
||||
public Scene LoadScene(string sceneCityName, string sceneName)
|
||||
public GameScene LoadScene(string sceneCityName, string sceneName)
|
||||
{
|
||||
Stopwatch timer = Stopwatch.StartNew();
|
||||
|
||||
@@ -109,14 +110,14 @@ namespace Pal3.Game.Scene
|
||||
|
||||
_currentSceneRoot = GameEntityFactory.Create($"Scene_{sceneCityName}_{sceneName}",
|
||||
null, worldPositionStays: false);
|
||||
_currentScene = _currentSceneRoot.AddComponent<Scene>();
|
||||
_currentScene.Init(_resourceProvider,
|
||||
_currentGameScene = _currentSceneRoot.AddComponent<GameScene>();
|
||||
_currentGameScene.Init(_resourceProvider,
|
||||
_sceneObjectFactory,
|
||||
_sceneStateManager,
|
||||
_gameSettings.IsRealtimeLightingAndShadowsEnabled,
|
||||
_cameraEntity,
|
||||
_sceneObjectIdsToNotLoadFromSaveState);
|
||||
_currentScene.Load(scnFile, _currentSceneRoot);
|
||||
_currentGameScene.Load(scnFile, _currentSceneRoot);
|
||||
|
||||
// Must to clear the exclude list after loading the scene.
|
||||
_sceneObjectIdsToNotLoadFromSaveState.Clear();
|
||||
@@ -135,7 +136,7 @@ namespace Pal3.Game.Scene
|
||||
// Also a good time to collect garbage
|
||||
System.GC.Collect();
|
||||
|
||||
return _currentScene;
|
||||
return _currentGameScene;
|
||||
}
|
||||
|
||||
public CombatScene LoadCombatScene(string combatSceneName)
|
||||
@@ -244,11 +245,11 @@ namespace Pal3.Game.Scene
|
||||
_temporarilyDisabledRenderers.Clear();
|
||||
_temporarilyDisabledGameObjects.Clear();
|
||||
|
||||
if (_currentScene != null)
|
||||
if (_currentGameScene != null)
|
||||
{
|
||||
Pal3.Instance.Execute(new SceneLeavingCurrentSceneNotification());
|
||||
_currentScene.Destroy();
|
||||
_currentScene = null;
|
||||
_currentGameScene.Destroy();
|
||||
_currentGameScene = null;
|
||||
}
|
||||
|
||||
if (_currentCombatScene != null)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Pal3.Game.Scene.SceneObjects
|
||||
{
|
||||
public Guid CorrelationId;
|
||||
public int InitObjectId;
|
||||
public Scene CurrentScene;
|
||||
public GameScene CurrentScene;
|
||||
public IGameEntity PlayerActorGameEntity;
|
||||
public bool StartedByPlayer;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Pal3.Game.Script
|
||||
|
||||
public void Execute(ScriptVarSetObjectUsageStatusCommand command)
|
||||
{
|
||||
Scene scene = ServiceLocator.Instance.Get<SceneManager>().GetCurrentScene();
|
||||
GameScene scene = ServiceLocator.Instance.Get<SceneManager>().GetCurrentScene();
|
||||
ScnSceneInfo sceneInfo = scene.GetSceneInfo();
|
||||
SceneStateManager sceneStateManager = ServiceLocator.Instance.Get<SceneStateManager>();
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Pal3.Game.State
|
||||
(int)playerActorMovementController.GameEntity.Transform.EulerAngles.y)
|
||||
});
|
||||
|
||||
Dictionary<int, Actor> allActors = currentScene.GetAllActors();
|
||||
Dictionary<int, GameActor> allActors = currentScene.GetAllActors();
|
||||
Dictionary<int, IGameEntity> allActorGameEntities = currentScene.GetAllActorGameEntities();
|
||||
|
||||
// Save npc actor state
|
||||
@@ -324,7 +324,7 @@ namespace Pal3.Game.State
|
||||
private static void SaveNpcActorState(List<ICommand> commands,
|
||||
int actorId,
|
||||
IGameEntity actorGameEntity,
|
||||
Dictionary<int, Actor> allActors)
|
||||
Dictionary<int, GameActor> allActors)
|
||||
{
|
||||
ActorController actorController = actorGameEntity.GetComponent<ActorController>();
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace Pal3.Game.State
|
||||
|
||||
if (!actorController.IsActive) return; // Skip inactive actor
|
||||
|
||||
Actor actor = actorController.GetActor();
|
||||
GameActor actor = actorController.GetActor();
|
||||
|
||||
if (actor.Info.InitActive == 0)
|
||||
{
|
||||
@@ -384,7 +384,7 @@ namespace Pal3.Game.State
|
||||
if (actor.IsScriptIdChanged())
|
||||
{
|
||||
commands.Add(new ActorSetScriptCommand(actorId,
|
||||
(int) actor.GetScriptId()));
|
||||
(int)actor.GetScriptId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ PlayerSettings:
|
||||
m_StereoRenderingPath: 0
|
||||
m_ActiveColorSpace: 0
|
||||
unsupportedMSAAFallback: 0
|
||||
m_SpriteBatchMaxVertexCount: 65535
|
||||
m_SpriteBatchVertexThreshold: 300
|
||||
m_MTRendering: 0
|
||||
mipStripping: 0
|
||||
@@ -710,6 +711,7 @@ PlayerSettings:
|
||||
playModeTestRunnerEnabled: 0
|
||||
runPlayModeTestAsEditModeTest: 0
|
||||
actionOnDotNetUnhandledException: 1
|
||||
editorGfxJobOverride: 1
|
||||
enableInternalProfiler: 0
|
||||
logObjCUncaughtExceptions: 1
|
||||
enableCrashReportAPI: 0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 6000.0.19f1
|
||||
m_EditorVersionWithRevision: 6000.0.19f1 (302b264628f9)
|
||||
m_EditorVersion: 6000.0.20f1
|
||||
m_EditorVersionWithRevision: 6000.0.20f1 (05208a74e9aa)
|
||||
Reference in new issue
Block a user