using UnityEngine; using Unity.Netcode; [CreateAssetMenu(menuName = "Abilities/Slow Zone Ability")] public class SlowZoneAbility : Ability { [Header("Slow Zone Settings")] public GameObject slowZonePrefab; protected override void Activate(GameObject owner) { Camera mainCamera = Camera.main; Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out RaycastHit hit)) { Vector3 spawnPosition = hit.point; if (owner.TryGetComponent(out NetworkObject networkOwner)) { SpawnSlowZoneServerRpc(spawnPosition); } } } [Rpc(SendTo.Server)] private void SpawnSlowZoneServerRpc(Vector3 position) { GameObject slowZone = Instantiate(slowZonePrefab, position, Quaternion.identity); slowZone.GetComponent().Spawn(); Debug.Log($"Slow Zone spawned at {position}."); } }