using UnityEngine; using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; [CreateAssetMenu(menuName = "Abilities/TheExecutioner")] public class TheExecutionerAbility : Ability { [Header("Executioner Settings")] public float travelTime = 2f; public float lineLength = 50f; public float boxStartingPointOffset = 20f; public float boxEndingPointOffset = 20f; public override void Execute(ServerCharacter character, Vector3 startPoint, Vector3 direction) { // Extend start and end points Vector3 adjustedStartPoint = startPoint - (direction * boxStartingPointOffset); Vector3 adjustedEndPoint = startPoint + (direction * lineLength) + (direction * boxEndingPointOffset); GameObject boxInstance = Instantiate(prefab, adjustedStartPoint, Quaternion.LookRotation(direction)); if (boxInstance.TryGetComponent(out var netObj)) { netObj.Spawn(); boxInstance.GetComponent().Initialize( character, adjustedStartPoint, adjustedEndPoint, travelTime ); } } }