mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-11 15:40:46 +00:00
sync movement style
This commit is contained in:
parent
df43552ed2
commit
782900d4a4
@ -50,7 +50,7 @@ internal class QSBChaseAction : QSBGhostAction
|
||||
protected override void OnEnterAction()
|
||||
{
|
||||
_controller.SetLanternConcealed(false, true);
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Chase);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Chase);
|
||||
if (Time.time > _lastScreamTime + 10f && !PlayerData.GetReducedFrights())
|
||||
{
|
||||
_effects.AttachedObject.PlayVoiceAudioNear(global::AudioType.Ghost_Chase, 1f);
|
||||
|
@ -68,7 +68,7 @@ public class QSBElevatorWalkAction : QSBGhostAction
|
||||
this._controller.SetLanternConcealed(true, true);
|
||||
this._controller.FaceVelocity();
|
||||
this._effects.AttachedObject.PlayDefaultAnimation();
|
||||
this._effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
this._effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
if (this._elevatorNode != null)
|
||||
{
|
||||
this._controller.PathfindToNode(this._elevatorNode, MoveType.PATROL);
|
||||
|
@ -41,7 +41,7 @@ internal class QSBGrabAction : QSBGhostAction
|
||||
|
||||
protected override void OnEnterAction()
|
||||
{
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Chase);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Chase);
|
||||
_effects.AttachedObject.PlayGrabAnimation();
|
||||
_effects.AttachedObject.OnGrabComplete += OnGrabComplete;
|
||||
_controller.SetLanternConcealed(false, true);
|
||||
|
@ -51,7 +51,7 @@ public class QSBGuardAction : QSBGhostAction
|
||||
{
|
||||
_controller.SetLanternConcealed(true, true);
|
||||
_sensors.AttachedObject.SetContactEdgeCatcherWidth(5f);
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
ContinueSearch();
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class QSBHuntAction : QSBGhostAction
|
||||
{
|
||||
_controller.SetLanternConcealed(true, true);
|
||||
_controller.FaceVelocity();
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
if (!_huntStarted || _data.interestedPlayer.timeLastSawPlayer > _huntStartTime)
|
||||
{
|
||||
var knownPlayerVelocity = _data.interestedPlayer.lastKnownSensor.knowsPlayerVelocity ? _data.interestedPlayer.lastKnownPlayerLocation.localVelocity : Vector3.zero;
|
||||
|
@ -49,7 +49,7 @@ public class QSBPartyHouseAction : QSBGhostAction
|
||||
this._allowChasePlayer = true;
|
||||
this._controller.SetLanternConcealed(true, true);
|
||||
this._controller.AttachedObject.FacePlayer(TurnSpeed.MEDIUM);
|
||||
this._effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
this._effects.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
}
|
||||
|
||||
public void LookAtPlayer(float delay, TurnSpeed lookSpeed = TurnSpeed.SLOWEST)
|
||||
@ -71,7 +71,7 @@ public class QSBPartyHouseAction : QSBGhostAction
|
||||
this._controller.MoveToLocalPosition(this._initialLocalPosition, MoveType.PATROL);
|
||||
this._controller.FaceLocalPosition(this._initialLocalPosition + this._initialLocalDirection, TurnSpeed.MEDIUM);
|
||||
this._controller.SetLanternConcealed(true, true);
|
||||
this._effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
this._effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
this._waitingToLookAtPlayer = false;
|
||||
this._lookingAtPlayer = false;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class QSBPartyPathAction : QSBGhostAction
|
||||
{
|
||||
this._controller.FaceVelocity();
|
||||
this._effects.AttachedObject.PlayDefaultAnimation();
|
||||
this._effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
this._effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
if (this._allowFollowPath)
|
||||
{
|
||||
if (this._isMovingToFinalPosition)
|
||||
|
@ -34,7 +34,7 @@ public class QSBSearchAction : QSBGhostAction
|
||||
protected override void OnEnterAction()
|
||||
{
|
||||
_controller.SetLanternConcealed(true, true);
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
ContinueSearch();
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class QSBSentryAction : QSBGhostAction
|
||||
DebugLog.DebugWrite($"ON ENTER ACTION");
|
||||
_spotlighting = false;
|
||||
_controller.SetLanternConcealed(true, true);
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
var searchNodesOnLayer = _controller.AttachedObject.GetNodeMap().GetSearchNodesOnLayer(_controller.AttachedObject.GetNodeLayer());
|
||||
_targetSentryNode = searchNodesOnLayer[0];
|
||||
_controller.PathfindToNode(_targetSentryNode, MoveType.PATROL);
|
||||
|
@ -14,7 +14,7 @@ public class QSBSleepwalkAction : QSBGhostAction
|
||||
{
|
||||
MoveToRandomPatrolNode();
|
||||
_controller.SetLanternConcealed(false, true);
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Normal);
|
||||
}
|
||||
|
||||
public override bool Update_Action()
|
||||
|
@ -43,7 +43,7 @@ public class QSBStalkAction : QSBGhostAction
|
||||
_controller.ChangeLanternFocus(_isFocusingLight ? 1f : 0f, 2f);
|
||||
_controller.SetLanternConcealed(!_isFocusingLight, true);
|
||||
_controller.FaceVelocity();
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
_effects.AttachedObject.PlayVoiceAudioNear(_data.fastStalkUnlocked ? AudioType.Ghost_Stalk_Fast : AudioType.Ghost_Stalk, 1f);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class QSBWaitAction : QSBGhostAction
|
||||
return;
|
||||
}
|
||||
|
||||
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
_effects.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
||||
_controller.AttachedObject.FacePlayer(TurnSpeed.MEDIUM);
|
||||
if (_data.interestedPlayer.playerLocation.distanceXZ < 3f)
|
||||
{
|
||||
|
@ -0,0 +1,12 @@
|
||||
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.Ghosts.Messages;
|
||||
|
||||
internal class SetMovementStyleMessage : QSBWorldObjectMessage<QSBGhostEffects, GhostEffects.MovementStyle>
|
||||
{
|
||||
public SetMovementStyleMessage(GhostEffects.MovementStyle style) : base(style) { }
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
=> WorldObject.SetMovementStyle(Data, true);
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using QSB.Utility;
|
||||
using QSB.EchoesOfTheEye.Ghosts.Messages;
|
||||
using QSB.Messaging;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -121,4 +123,19 @@ public class QSBGhostEffects : WorldObject<GhostEffects>, IGhostObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMovementStyle(GhostEffects.MovementStyle style, bool remote = false)
|
||||
{
|
||||
if (!remote)
|
||||
{
|
||||
if (!QSBCore.IsHost)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.SendMessage(new SetMovementStyleMessage(style));
|
||||
}
|
||||
|
||||
AttachedObject.SetMovementStyle(style);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user