RiftMayhem/Assets/Scripts/AbilitySystem/AreaOfEffectAbility.cs
Pedro Gomes 888171a4a9 New spell & status & instant effect updates
- burst of hope (second priest ability) added
- instant value effect with modifiers based on targets
- damage income modifier effect added
- status effect option to apply to targets hit
- status effect option to apply to self
2024-07-07 11:44:12 +01:00

89 lines
3.1 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)
{
base.Execute(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)
{
base.Execute(user, userTag, point);
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();
}
}