RiftMayhem/Assets/Scripts/AbilitySystem/AreaOfEffectAbility.cs
Pedro Gomes c286d28fd4 Mage Updates & bugfixing
- Added an option for instant effects to generate class resource per hit for the user
- fixed an issue where some extended ability scripts were not spending all required resources (inheritance issue)
- Added a class-based melee ability for Mages
- Added a class Signature ability for Mages to make use of class resource
2024-07-23 18:24:48 +01:00

108 lines
3.8 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "AoEAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Area of Effect Ability", order = 0)]
public class AreaOfEffectAbility : BaseAbility
{
public GameObject aoePrefab;
public LayerMask movementMask;
public float lifeSpan;
public float radius;
public bool shouldResizeVisuals;
public float telegraphDelay;
public bool canHitSelf;
public bool spawnUnderUser;
protected GameObject instantiatedArea;
private NetworkedAreaOfEffect networkedAreaOfEffect;
protected Camera cam;
protected Ray ray;
protected RaycastHit hit;
protected void Awake()
{
cam = Camera.main;
}
public override void Execute(PhotonView user, Taggable userTag)
{
SpendResourcesNecessary(user, userTag);
if (spawnUnderUser)
{
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.transform.position, Quaternion.identity);
networkedAreaOfEffect = instantiatedArea.GetComponent<NetworkedAreaOfEffect>();
networkedAreaOfEffect.owner = user;
networkedAreaOfEffect.ownerTag = userTag;
networkedAreaOfEffect.ability = this;
networkedAreaOfEffect.radius = radius;
networkedAreaOfEffect.shouldResizeVisuals = shouldResizeVisuals;
networkedAreaOfEffect.telegraphDelay = telegraphDelay;
networkedAreaOfEffect.lifeSpan = lifeSpan;
networkedAreaOfEffect.canHitSelf = canHitSelf;
networkedAreaOfEffect.Init();
return;
}
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.GetComponentInChildren<AoERayHitLocationSnapshotController>().aoeRayHitLocationSnapshot.position, Quaternion.identity);
networkedAreaOfEffect = instantiatedArea.GetComponent<NetworkedAreaOfEffect>();
networkedAreaOfEffect.owner = user;
networkedAreaOfEffect.ownerTag = userTag;
networkedAreaOfEffect.ability = this;
networkedAreaOfEffect.radius = radius;
networkedAreaOfEffect.telegraphDelay = telegraphDelay;
networkedAreaOfEffect.lifeSpan = lifeSpan;
networkedAreaOfEffect.canHitSelf = canHitSelf;
networkedAreaOfEffect.Init();
}
public override void Execute(PhotonView user, Taggable userTag, Vector3 point)
{
SpendResourcesNecessary(user, userTag);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, point, Quaternion.identity);
networkedAreaOfEffect = instantiatedArea.GetComponent<NetworkedAreaOfEffect>();
networkedAreaOfEffect.owner = user;
networkedAreaOfEffect.ownerTag = userTag;
networkedAreaOfEffect.ability = this;
networkedAreaOfEffect.radius = radius;
networkedAreaOfEffect.telegraphDelay = telegraphDelay;
networkedAreaOfEffect.lifeSpan = lifeSpan;
networkedAreaOfEffect.canHitSelf = canHitSelf;
networkedAreaOfEffect.Init();
}
public override void Execute(PhotonView user, Taggable userTag, Transform target)
{
SpendResourcesNecessary(user, userTag);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, target.position, Quaternion.identity);
networkedAreaOfEffect = instantiatedArea.GetComponent<NetworkedAreaOfEffect>();
networkedAreaOfEffect.owner = user;
networkedAreaOfEffect.ownerTag = userTag;
networkedAreaOfEffect.ability = this;
networkedAreaOfEffect.radius = radius;
networkedAreaOfEffect.telegraphDelay = telegraphDelay;
networkedAreaOfEffect.lifeSpan = lifeSpan;
networkedAreaOfEffect.canHitSelf = canHitSelf;
networkedAreaOfEffect.Init();
}
}