Merge branch 'dev-hazim' into dev-main

dev-ali
Hazim Bin Ijaz 2 days ago
commit 6906dd450f

8
.gitignore vendored

@ -72,3 +72,11 @@ crashlytics-build.properties
/[Aa]ssets/[Ss]treamingAssets/aa.meta /[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/* /[Aa]ssets/[Ss]treamingAssets/aa/*
ProjectSettings/Packages/com.unity.learn.iet-framework/Settings.json
ProjectSettings/ShaderGraphSettings.asset
Assets/URP/Windows/0_UniversalRenderPipelineAsset_Windows_Low.asset
Assets/URP/Windows/1_UniversalRenderPipelineAsset_Windows_Medium.asset
Assets/URP/Windows/2_UniversalRenderPipelineAsset_Windows_High.asset
Assets/URP/Windows/3_UniversalRenderPipelineAsset_Windows_Ultra.asset
Packages/com.unity.multiplayer.samples.coop/Utilities/Net/RNSM/RNSM Panel Settings.asset
Assets/Material/Dungeon/M_Lava.mat

@ -17,9 +17,9 @@ MonoBehaviour:
abilityRadius: 100 abilityRadius: 100
abilityMagnitude: 0 abilityMagnitude: 0
abilityDuration: 10 abilityDuration: 10
abilityCooldownTime: 0 abilityCooldownTime: 10
abilityApplicationRadius: 20 abilityApplicationRadius: 20
prefab: {fileID: 2026889198986879358, guid: cbe217685dd069b47ac56eefeb3f6cdc, type: 3} prefab: {fileID: 2026889198986879358, guid: cbe217685dd069b47ac56eefeb3f6cdc, type: 3}
travelTime: 3 travelTime: 3
spawnRadius: 30 spawnRadius: 30
moveThroughCenterDistance: 60 warningTime: 3

@ -424,4 +424,19 @@ public class AbilitySystem : NetworkBehaviour
currentAbilityIndicator.transform.localScale = Vector3.one * activeAbility.abilityRadius; currentAbilityIndicator.transform.localScale = Vector3.one * activeAbility.abilityRadius;
} }
} }
public void InitiateGlobalCooldown(string abilityKey)
{
Debug.Log($"InitiateGlobalCooldown: Initiating Global Cooldown");
var ability = abilities.FirstOrDefault(a => a.abilityKey == abilityKey);
if (ability != null)
{
Debug.Log($"InitiateGlobalCooldown: Found ability: {ability.abilityKey}");
StartCoroutine(StartCooldown(ability));
}
else
{
Debug.Log($"InitiateGlobalCooldown: Count find ability: {abilityKey}");
}
}
} }

@ -8,7 +8,7 @@ public class CrowManager : NetworkBehaviour
{ {
public static CrowManager Instance { get; private set; } public static CrowManager Instance { get; private set; }
private List<ServerCharacter> players = new List<ServerCharacter>(); public List<ServerCharacter> players = new List<ServerCharacter>();
private ServerCharacter currentCrow; private ServerCharacter currentCrow;
public Transform mapCenter; public Transform mapCenter;

@ -1,7 +1,8 @@
using UnityEngine; using UnityEngine;
using Unity.Netcode; using Unity.Netcode;
using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.BossRoom.Gameplay.GameplayObjects.Character;
using UnityEngine.SocialPlatforms.Impl; using System.Collections;
using Unity.BossRoom.Gameplay.GameplayObjects;
public class ExecutionerBox : NetworkBehaviour public class ExecutionerBox : NetworkBehaviour
{ {
@ -10,26 +11,60 @@ public class ExecutionerBox : NetworkBehaviour
private float _travelTime; private float _travelTime;
private float _startTime; private float _startTime;
private Vector3 _startPos; private Vector3 _startPos;
private float _warningTime;
public void Initialize(ServerCharacter owner, Vector3 startPos, Vector3 endPos, float travelTime) public override void OnNetworkSpawn()
{
var playerList = CrowManager.Instance.players;
foreach (ServerCharacter serverCharacter in playerList)
{
if (serverCharacter.NetworkObject.IsOwner) // Check if this player is the local player
{
var abilitySystem = serverCharacter.GetComponent<AbilitySystem>();
if (abilitySystem != null)
{
abilitySystem.InitiateGlobalCooldown(GameDataSource.Instance.TheExecutionerKey);
}
break; // Exit loop after finding the local player
}
}
}
public void Initialize(ServerCharacter owner, Vector3 startPos, Vector3 endPos, float travelTime, float warningTime)
{ {
_owner = owner; _owner = owner;
_startPos = startPos; _startPos = startPos;
_endPos = endPos; _endPos = endPos;
_travelTime = travelTime; _travelTime = travelTime;
_warningTime = warningTime;
transform.position = startPos; transform.position = startPos;
transform.LookAt(endPos); transform.LookAt(endPos);
_startTime = Time.time;
StartCoroutine(StartExecutionerSequence());
} }
private void Update() private IEnumerator StartExecutionerSequence()
{ {
if (!IsServer) return; // Show warning UI on all clients
// UIManager.Instance.ShowExecutionerWarning(_warningTime);
float journeyProgress = (Time.time - _startTime) / _travelTime; // Wait for the warning time before moving
transform.position = Vector3.Lerp(_startPos, _endPos, journeyProgress); yield return new WaitForSeconds(_warningTime);
_startTime = Time.time;
StartCoroutine(MoveExecutioner());
}
if (journeyProgress >= 1f) private IEnumerator MoveExecutioner()
{
float elapsedTime = 0f;
while (elapsedTime < _travelTime)
{
elapsedTime = Time.time - _startTime;
transform.position = Vector3.Lerp(_startPos, _endPos, elapsedTime / _travelTime);
yield return null;
}
NetworkObject.Despawn(); NetworkObject.Despawn();
} }
@ -37,15 +72,13 @@ public class ExecutionerBox : NetworkBehaviour
{ {
if (!IsServer) return; if (!IsServer) return;
if (other.TryGetComponent<ServerCharacter>(out var victim) && victim != _owner) if (other.TryGetComponent<ServerCharacter>(out var victim))
{ {
// Get owner client ID before despawning
ulong ownerId = _owner.OwnerClientId; ulong ownerId = _owner.OwnerClientId;
// Handle score changes // Handle score changes
ScoreManager.Instance.AddPlayerScore(ownerId, 10,Color.yellow); // Add to owner ScoreManager.Instance.AddPlayerScore(ownerId, 10,Color.yellow); // Add to owner
ScoreManager.Instance.SubtractPlayerScore(victim.OwnerClientId, 10,new Color(1,0.647f,0,1)); // Subtract from victim ScoreManager.Instance.SubtractPlayerScore(victim.OwnerClientId, 10,new Color(1,0.647f,0,1)); // Subtract from victim
Debug.Log($"[ExecutionerBox] Scores updated. " + Debug.Log($"[ExecutionerBox] Scores updated. " +
$"Owner ({ownerId}) gained 10, " + $"Owner ({ownerId}) gained 10, " +
$"Victim ({victim.OwnerClientId}) lost 10"); $"Victim ({victim.OwnerClientId}) lost 10");

@ -8,6 +8,7 @@ public class TheExecutionerAbility : Ability
[Header("Executioner Settings")] [Header("Executioner Settings")]
public float travelTime = 2f; public float travelTime = 2f;
public float spawnRadius = 18f; // Fixed spawn radius around the map center public float spawnRadius = 18f; // Fixed spawn radius around the map center
public float warningTime = 5f;
public override void Execute(ServerCharacter character, Vector3 ignoredStartPoint, Vector3 ignoredDirection) public override void Execute(ServerCharacter character, Vector3 ignoredStartPoint, Vector3 ignoredDirection)
{ {
@ -33,7 +34,8 @@ public class TheExecutionerAbility : Ability
character, character,
spawnPoint, spawnPoint,
endPoint, endPoint,
travelTime travelTime,
warningTime
); );
} }
} }

Loading…
Cancel
Save