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.
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
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 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<NetworkObject>(out var netObj))
|
|
{
|
|
netObj.Spawn();
|
|
boxInstance.GetComponent<ExecutionerBox>().Initialize(
|
|
character,
|
|
adjustedStartPoint,
|
|
adjustedEndPoint,
|
|
travelTime
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|