Update Platform.cs

dev-hazim
Hazim Bin Ijaz 1 week ago
parent 1f7438e10d
commit 51501e46d3

@ -152,14 +152,39 @@ namespace Unity.Multiplayer.Samples.BossRoom
return; return;
} }
int multiplier = (int)Vector3.Distance(platformA.transform.position, platformB.transform.position); // Define distance ranges and their corresponding multipliers
float distance = Vector3.Distance(platformA.transform.position, platformB.transform.position);
Debug.Log($"the distance is: {distance}");
float multiplier = 1.0f;
if (distance < 5f)
{
multiplier = 1.1f; // Small distance
}
else if (distance < 10f)
{
multiplier = 1.2f; // Medium distance
}
else if (distance < 20f)
{
multiplier = 1.5f; // Large distance
}
else
{
multiplier = 2.0f; // Max multiplier cap
}
Debug.Log($"[Occupy] Distance multiplier: {multiplier} (from {platformA.PlatformID.Value} to {platformB.PlatformID.Value})"); Debug.Log($"[Occupy] Distance multiplier: {multiplier} (from {platformA.PlatformID.Value} to {platformB.PlatformID.Value})");
int score = (player.TargetPlatformId.HasValue && player.TargetPlatformId.Value == PlatformID.Value) ? 10 : 20; // Base score calculation
score *= multiplier; int baseScore = (player.TargetPlatformId.HasValue && player.TargetPlatformId.Value == PlatformID.Value) ? 10 : 20;
int score = Mathf.RoundToInt(baseScore * multiplier);
Debug.Log($"[Occupy] Calculated score for player {player.OwnerClientId}: {score}"); Debug.Log($"[Occupy] Calculated score for player {player.OwnerClientId}: {score}");
// Add the calculated score
ScoreManager.Instance.AddPlayerScore(player.OwnerClientId, score); ScoreManager.Instance.AddPlayerScore(player.OwnerClientId, score);
} }
Debug.Log($"[Occupy] Player {player.OwnerClientId} successfully occupied platform {PlatformID.Value}. Starting penalty coroutine."); Debug.Log($"[Occupy] Player {player.OwnerClientId} successfully occupied platform {PlatformID.Value}. Starting penalty coroutine.");

Loading…
Cancel
Save