|
|
|
@ -6,7 +6,7 @@ using Unity.BossRoom.Gameplay.GameplayObjects.Character;
|
|
|
|
|
using Unity.Netcode;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.AI;
|
|
|
|
|
using static Codice.Client.Common.WebApi.WebApiEndpoints;
|
|
|
|
|
//using static Codice.Client.Common.WebApi.WebApiEndpoints;
|
|
|
|
|
|
|
|
|
|
public class AbilitySystem : NetworkBehaviour
|
|
|
|
|
{
|
|
|
|
@ -66,18 +66,18 @@ public class AbilitySystem : NetworkBehaviour
|
|
|
|
|
|
|
|
|
|
if (Input.GetMouseButtonUp(0) && isWallPlacementStarted)
|
|
|
|
|
{
|
|
|
|
|
if (isValidPlacement)
|
|
|
|
|
//if (isValidPlacement)
|
|
|
|
|
{
|
|
|
|
|
UseActiveAbility(); // Place the wall when LMB is released
|
|
|
|
|
isWallPlacementStarted = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/*else
|
|
|
|
|
{
|
|
|
|
|
UseActiveAbility(); // Place the wall when LMB is released
|
|
|
|
|
isWallPlacementStarted = false;
|
|
|
|
|
Invoke(nameof(RepositionAgent), 0.5f);
|
|
|
|
|
Debug.Log("Invalid placement! Cannot place wall on top of another player.");
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -121,11 +121,11 @@ public class AbilitySystem : NetworkBehaviour
|
|
|
|
|
//AliSharoz
|
|
|
|
|
isValidPlacement = IsPlacementValid(hit.point, wallIndicator.transform.rotation, playerLayer);
|
|
|
|
|
|
|
|
|
|
//var meshRenderer = wallIndicator.GetComponent<MeshRenderer>();
|
|
|
|
|
//if (meshRenderer != null)
|
|
|
|
|
//{
|
|
|
|
|
// meshRenderer.material = isValidPlacement ? validPlacementMaterial : invalidPlacementMaterial;
|
|
|
|
|
//}
|
|
|
|
|
/*var meshRenderer = wallIndicator.GetComponent<MeshRenderer>();
|
|
|
|
|
if (meshRenderer != null)
|
|
|
|
|
{
|
|
|
|
|
meshRenderer.material = isValidPlacement ? validPlacementMaterial : invalidPlacementMaterial;
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -133,27 +133,25 @@ public class AbilitySystem : NetworkBehaviour
|
|
|
|
|
{
|
|
|
|
|
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out RaycastHit hit))
|
|
|
|
|
{
|
|
|
|
|
if (isValidPlacement)
|
|
|
|
|
//if (isValidPlacement)
|
|
|
|
|
{
|
|
|
|
|
wallSpawnPosition = hit.point; // Save spawn position
|
|
|
|
|
initialMousePosition = Input.mousePosition; // Store the initial mouse position on click
|
|
|
|
|
isWallPlacementStarted = true;
|
|
|
|
|
Debug.Log($"[AbilitySystem] Wall placement started at {wallSpawnPosition}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/*else
|
|
|
|
|
{
|
|
|
|
|
wallSpawnPosition = hit.point; // Save spawn position
|
|
|
|
|
initialMousePosition = Input.mousePosition; // Store the initial mouse position on click
|
|
|
|
|
isWallPlacementStarted = true;
|
|
|
|
|
Debug.Log("Cannot place the wall on top of another player.");
|
|
|
|
|
Invoke(nameof(RepositionAgent), 0.5f);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public float searchRadius = 5f;
|
|
|
|
|
/*public float searchRadius = 5f;
|
|
|
|
|
|
|
|
|
|
private void RepositionAgent()
|
|
|
|
|
private void RepositionAgent()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("RepositionAgent()1");
|
|
|
|
|
//if (NavMesh.SamplePosition(currentPosition, out hit, 0.01f, NavMesh.AllAreas))
|
|
|
|
@ -180,7 +178,7 @@ public class AbilitySystem : NetworkBehaviour
|
|
|
|
|
//{
|
|
|
|
|
// Debug.LogWarning("No valid NavMesh point found near the agent!");
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
private void RotateWallIndicator()
|
|
|
|
|
{
|
|
|
|
|
if (isWallPlacementStarted && wallIndicator != null)
|
|
|
|
@ -206,20 +204,20 @@ public class AbilitySystem : NetworkBehaviour
|
|
|
|
|
wallIndicator.transform.rotation = Quaternion.Lerp(wallIndicator.transform.rotation, targetRotation, Time.deltaTime * wallRotationSpeed);
|
|
|
|
|
isValidPlacement = IsPlacementValid(wallIndicator.transform.position, wallIndicator.transform.rotation, playerLayer);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// Change indicator color based on placement validity
|
|
|
|
|
//AliSharoz
|
|
|
|
|
//var meshRenderer = wallIndicator.GetComponent<MeshRenderer>();
|
|
|
|
|
//if (meshRenderer != null)
|
|
|
|
|
//{
|
|
|
|
|
// meshRenderer.material = isValidPlacement ? validPlacementMaterial : invalidPlacementMaterial;
|
|
|
|
|
//}
|
|
|
|
|
AliSharoz
|
|
|
|
|
var meshRenderer = wallIndicator.GetComponent<MeshRenderer>();
|
|
|
|
|
if (meshRenderer != null)
|
|
|
|
|
{
|
|
|
|
|
meshRenderer.material = isValidPlacement ? validPlacementMaterial : invalidPlacementMaterial;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isValidPlacement)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Cannot rotate wall here: Overlapping with another object.");
|
|
|
|
|
Invoke(nameof(RepositionAgent), 0.5f);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|