You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HighGroundRoyaleNetcode/Assets/Scripts/Gameplay/TheExecutionerAbility.cs

29 lines
906 B
C#

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 override void Execute(ServerCharacter character, Vector3 startPoint, Vector3 direction)
{
Vector3 endPoint = startPoint + (direction * lineLength);
GameObject boxInstance = Instantiate(prefab, startPoint, Quaternion.LookRotation(direction));
if (boxInstance.TryGetComponent<NetworkObject>(out var netObj))
{
netObj.Spawn();
boxInstance.GetComponent<ExecutionerBox>().Initialize(
character,
startPoint,
endPoint,
travelTime
);
}
}
}