RiftMayhem/Assets/Scripts/AbilitySystem/AreaOfEffectAbility.cs
Pedro Gomes 81f2ac424e Insane update
Abilities:

- area of effect ability with impact event/chain reaction type added
- melee slash timing bugfix
- melee slash VFX added
- blizzard (second mage ability) added
- holy circle (ultimate priest ability) added
- consecration (ultimate knight ability) added
- whirling axes (second barbarian ability) added
- glacial bomb (ultimate mage ability) added
- ice shard (first mage ability) added

Others:

- aoe location snapshot on cast mechanic added
- reduced realtime shadows on rifthunters inn
2024-07-04 21:27:15 +01:00

87 lines
2.9 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 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.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();
}
}