Minor tweaks and bug fixes

This commit is contained in:
Jackie Liu committed 2022-11-20 14:36:24 -08:00
1 parent 86f48207b3
commit 5ae0dbbf3d
5 files changed
+21 -8

No files matched your search

+1 -1
View File
@@ -56,7 +56,7 @@ namespace Pal3.Actor
switch (actor.Info.Id)
{
case (byte)PlayerActorId.TaoZi:
actorGameObject.AddComponent<FlyingActorController>().Init(actor, actionController);
actorGameObject.AddComponent<FlyingActorController>().Init(actor, actorController, actionController);
break;
}
#endif
@@ -10,6 +10,7 @@ namespace Pal3.Actor
using Command.InternalCommands;
using Command.SceCommands;
using Core.GameBox;
using Player;
using Script.Waiter;
using UnityEngine;
@@ -23,11 +24,13 @@ namespace Pal3.Actor
private const float MAX_TARGET_DISTANCE = 20f;
private Actor _actor;
private ActorController _actorController;
private ActorActionController _actionController;
public void Init(Actor actor, ActorActionController actionController)
public void Init(Actor actor, ActorController actorController, ActorActionController actionController)
{
_actor = actor;
_actorController = actorController;
_actionController = actionController;
}
@@ -47,7 +50,15 @@ namespace Pal3.Actor
command.GameBoxXPosition,
command.GameBoxYPosition,
command.GameBoxZPosition));
// If actor is inactive or at it's init position, just teleport to target position
if (!_actorController.IsActive ||
Vector3.Distance(transform.position, PlayerActorNpcInfoFactory.ActorInitPosition) < float.Epsilon)
{
transform.position = targetPosition;
return;
}
// In case the target position is too far away
if (Vector3.Distance(transform.position, targetPosition) > MAX_TARGET_DISTANCE)
{
@@ -42,11 +42,11 @@ namespace Pal3.Actor
private bool _followTarget = true;
private int _currentMode = 1; // defaults to follow target actor
public void Init(Actor actor,
public new void Init(Actor actor,
ActorController actorController,
ActorActionController actionController)
{
base.Init(actor, actionController);
base.Init(actor, actorController, actionController);
_actor = actor;
_actorController = actorController;
_actorActionController = actionController;
+3 -1
View File
@@ -41,6 +41,7 @@ namespace Pal3.Feature
{
_sceneManager.LoadScene(sceneFileName, sceneName);
CommandDispatcher<ICommand>.Instance.Dispatch(new GameStateChangeRequest(GameState.Cutscene));
CommandDispatcher<ICommand>.Instance.Dispatch(new CameraFadeInCommand());
_scriptManager.AddScript(afterRestTalkScript);
}
@@ -64,7 +65,8 @@ namespace Pal3.Feature
if (vars[ScriptConstants.MainStoryVariableName] == 120301)
{
vars[ScriptConstants.MainStoryVariableName] = 120302;
_scriptManager.AddScript((uint)command.AfterRestScriptId);
Rest("Q13", "n06", (uint)command.AfterRestScriptId);
CommandDispatcher<ICommand>.Instance.Dispatch(new CameraSetDefaultTransformCommand(2));
}
}
#elif PAL3A
@@ -16,11 +16,11 @@ namespace Pal3.Player
public static class PlayerActorNpcInfoFactory
{
// This is a position that is far away from the camera to prevent glitches.
private static readonly Vector3 InitPosition = new (777f, 777f, 777f); // Unity position
public static readonly Vector3 ActorInitPosition = new (777f, 777f, 777f); // Unity position
public static ScnNpcInfo Create(PlayerActorId actorId)
{
Vector3 gameBoxInitPosition = GameBoxInterpreter.ToGameBoxPosition(InitPosition);
Vector3 gameBoxInitPosition = GameBoxInterpreter.ToGameBoxPosition(ActorInitPosition);
return new ScnNpcInfo
{