Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 230 additions & 42 deletions GGJ26/Assets/00. Scenes/GameScene.unity

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions GGJ26/Assets/00. Scenes/WaitingRoom.unity
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Path: {fileID: 574659247}
m_PathPosition: 3.5229394
m_PathPosition: 3.5456285
m_PositionUnits: 0
m_PathOffset: {x: 0, y: 0, z: 0}
m_XDamping: 0
Expand Down Expand Up @@ -538,8 +538,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 371226636}
serializedVersion: 2
m_LocalRotation: {x: 0.23461814, y: 0.39889708, z: -0.10634184, w: 0.8800721}
m_LocalPosition: {x: -4.5089183, y: 4.0455256, z: -3.9520862}
m_LocalRotation: {x: 0.22454718, y: 0.40017107, z: -0.101803534, w: 0.88265383}
m_LocalPosition: {x: -4.247977, y: 4.0455256, z: -4.2428217}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
Expand Down Expand Up @@ -846,15 +846,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.x
value: -2.4249878
value: -2.1958594
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.y
value: 2.0200195
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.z
value: -2.8400269
value: -3.1259441
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalRotation.w
Expand Down Expand Up @@ -1005,8 +1005,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 496710720}
serializedVersion: 2
m_LocalRotation: {x: 0.23461817, y: 0.39889717, z: -0.10634189, w: 0.88007206}
m_LocalPosition: {x: -4.5089183, y: 4.0455256, z: -3.9520862}
m_LocalRotation: {x: 0.22454718, y: 0.4001711, z: -0.10180356, w: 0.8826538}
m_LocalPosition: {x: -4.247977, y: 4.0455256, z: -4.2428217}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
Expand Down Expand Up @@ -2320,15 +2320,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.x
value: -3.046997
value: -2.8178687
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.y
value: 2.0200195
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.z
value: -2.0570548
value: -2.3429723
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalRotation.w
Expand Down Expand Up @@ -2437,6 +2437,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
gameScenePath: Assets/00. Scenes/GameScene.unity
deathmatchScenePath: Assets/00. Scenes/DeathMatchGameScene.unity
waitingRoomScenePath: Assets/00. Scenes/WaitingRoom.unity
ensureFusionVoiceClient: 1
voiceAutoConnectAndJoin: 0
Expand Down Expand Up @@ -2585,15 +2586,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.x
value: -3.6691284
value: -3.44
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.y
value: 2.0200195
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.z
value: -1.2740825
value: -1.56
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalRotation.w
Expand Down Expand Up @@ -3498,15 +3499,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.x
value: -1.8029175
value: -1.5737891
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.y
value: 2.0200195
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalPosition.z
value: -3.6229994
value: -3.908917
objectReference: {fileID: 0}
- target: {fileID: 3893294197879345259, guid: 076210ecccf349c99ea75e8cb774b089, type: 3}
propertyPath: m_LocalRotation.w
Expand Down
85 changes: 85 additions & 0 deletions GGJ26/Assets/01. Scripts/MaskNPC/NPCController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ private bool CanUseAgent
[Networked] private float NetVerticalVelocity { get; set; }
[Networked] public NetworkBool IsDead { get; private set; }
[Networked] private NetworkBool IsDancing { get; set; }
[Networked] private TickTimer SabotageStunTimer { get; set; }
private bool snappedToGroundOnDeath;
private bool hasSpawned;
private float deathGroundSnapUntilTime;
private float nextDeathGroundSnapTime;
private Vector3 sabotageKnockbackVelocity;

private void Start()
{
Expand Down Expand Up @@ -197,6 +199,37 @@ public override void FixedUpdateNetwork()
return;
}

if (IsSabotageStunned())
{
if (CanUseAgent)
{
agent.isStopped = true;
}

moveDirection = Vector3.zero;
GroundedCheck();
JumpAndGravity(deltaTime);

Vector3 horizontal = sabotageKnockbackVelocity;
horizontal.y = 0f;
controller.Move((horizontal + new Vector3(0f, verticalVelocity, 0f)) * deltaTime);
sabotageKnockbackVelocity = Vector3.Lerp(sabotageKnockbackVelocity, Vector3.zero, deltaTime * 10f);

animationBlend = horizontal.magnitude;
animator.SetFloat(animIDSpeed, animationBlend);
animator.SetFloat(animIDMotionSpeed, horizontal.sqrMagnitude > 0.0001f ? 1f : 0f);

if (Object != null && Object.HasStateAuthority)
{
NetAnimSpeed = animationBlend;
NetAnimMotionSpeed = horizontal.sqrMagnitude > 0.0001f ? 1f : 0f;
NetAnimGrounded = Grounded;
NetVerticalVelocity = verticalVelocity;
}

return;
}

JumpAndGravity(deltaTime);
GroundedCheck();
Move(deltaTime);
Expand Down Expand Up @@ -399,6 +432,58 @@ public bool TriggerJump()
return false;
}

public void RequestSabotageStun(float durationSeconds, Vector3 knockbackDirection, float knockbackSpeed)
{
if (Object == null)
{
return;
}

if (Object.HasStateAuthority)
{
ApplySabotageStunInternal(durationSeconds, knockbackDirection, knockbackSpeed);
return;
}

RpcRequestSabotageStun(durationSeconds, knockbackDirection, knockbackSpeed);
}

[Rpc(RpcSources.All, RpcTargets.StateAuthority)]
private void RpcRequestSabotageStun(float durationSeconds, Vector3 knockbackDirection, float knockbackSpeed)
{
ApplySabotageStunInternal(durationSeconds, knockbackDirection, knockbackSpeed);
}

private void ApplySabotageStunInternal(float durationSeconds, Vector3 knockbackDirection, float knockbackSpeed)
{
if (Object == null || Object.HasStateAuthority == false || Runner == null || IsDead)
{
return;
}

float clampedDuration = Mathf.Clamp(durationSeconds, 0.05f, 2f);
SabotageStunTimer = TickTimer.CreateFromSeconds(Runner, clampedDuration);

Vector3 dir = knockbackDirection;
dir.y = 0f;
if (dir.sqrMagnitude < 0.0001f)
{
dir = transform.forward;
}

sabotageKnockbackVelocity = dir.normalized * Mathf.Max(0f, knockbackSpeed);
}

private bool IsSabotageStunned()
{
if (Runner == null)
{
return false;
}

return SabotageStunTimer.ExpiredOrNotRunning(Runner) == false;
}

public void StartDance(int danceIndex)
{
if (IsDead)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ private void Update()
return;
}

if (motor != null && motor.IsDanceLocked)
{
return;
}

if (WasAttackPressedThisFrame() == false)
{
return;
Expand Down Expand Up @@ -200,6 +205,11 @@ private bool CanStartAttackNow()
return false;
}

if (motor != null && motor.IsDanceLocked)
{
return false;
}

if (IsGroundedNow() == false)
{
return false;
Expand Down
57 changes: 54 additions & 3 deletions GGJ26/Assets/01. Scripts/Network/FusionThirdPersonMotor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class FusionThirdPersonMotor : NetworkBehaviour
[Networked] private int NetDanceIndex { get; set; }
[Networked] private TickTimer SabotageStunTimer { get; set; }
[Networked] private TickTimer MeleeMoveLockTimer { get; set; }
[Networked] private TickTimer ForcedDanceTimer { get; set; }

private CharacterController controller;
private Animator animator;
Expand Down Expand Up @@ -114,6 +115,8 @@ private void Awake()
danceEventPublisher = FindFirstObjectByType<DanceEventPublisher>();

}

public bool IsDanceLocked => NetIsDancing || IsForcedDanceActive();

// --- FIX: Added Spawned() to initialize render position ---
public override void Spawned()
Expand Down Expand Up @@ -196,7 +199,7 @@ public override void FixedUpdateNetwork()

if (GetInput(out PlayerInputData input) == false)
{
if (NetIsDancing)
if (NetIsDancing && IsForcedDanceActive() == false)
{
NetIsDancing = false;
ApplyDanceStop();
Expand All @@ -206,6 +209,7 @@ public override void FixedUpdateNetwork()
return;
}

bool forcedDanceActive = IsForcedDanceActive();
bool lockMovement = (GameManager.Instance != null && GameManager.Instance.IsGroupDanceActive) || IsMeleeMoveLocked();
// Seeker NPC dance command (disabled during group dance).
if (lockMovement == false && input.npcDanceCommand && role != null && role.IsSeeker && Runner.SimulationTime >= NextNpcDanceCommandTime)
Expand All @@ -226,7 +230,7 @@ public override void FixedUpdateNetwork()
}

// Hold-to-dance (edge-triggered to avoid retriggering every tick).
if (input.danceIndex != lastDanceIndex)
if (forcedDanceActive == false && input.danceIndex != lastDanceIndex)
{
if (input.danceIndex == -1)
{
Expand All @@ -239,7 +243,7 @@ public override void FixedUpdateNetwork()

lastDanceIndex = input.danceIndex;
}
else if (input.danceIndex == -1 && NetIsDancing)
else if (forcedDanceActive == false && input.danceIndex == -1 && NetIsDancing)
{
// Safety: if input says stop but state didn't update, force stop once.
StopDance();
Expand Down Expand Up @@ -471,6 +475,53 @@ private bool IsSabotageStunned()
return SabotageStunTimer.ExpiredOrNotRunning(Runner) == false;
}

public void RequestForcedDance(int danceIndex, float durationSeconds)
{
if (Object == null)
{
return;
}

if (Object.HasStateAuthority)
{
ApplyForcedDanceInternal(danceIndex, durationSeconds);
return;
}

RpcRequestForcedDance(danceIndex, durationSeconds);
}

[Rpc(RpcSources.All, RpcTargets.StateAuthority)]
private void RpcRequestForcedDance(int danceIndex, float durationSeconds)
{
ApplyForcedDanceInternal(danceIndex, durationSeconds);
}

private void ApplyForcedDanceInternal(int danceIndex, float durationSeconds)
{
if (Object == null || Object.HasStateAuthority == false || Runner == null)
{
return;
}

int resolvedDanceIndex = Mathf.Clamp(danceIndex, 0, 4);
float clampedDuration = Mathf.Clamp(durationSeconds, 0.1f, 10f);
NetDanceIndex = resolvedDanceIndex;
NetIsDancing = true;
ForcedDanceTimer = TickTimer.CreateFromSeconds(Runner, clampedDuration);
ApplyDanceStart();
}

private bool IsForcedDanceActive()
{
if (Runner == null)
{
return false;
}

return ForcedDanceTimer.ExpiredOrNotRunning(Runner) == false;
}

public void RequestMeleeMovementLock(float durationSeconds)
{
if (Object == null)
Expand Down
Loading
Loading