RiftMayhem/Assets/Scripts/Networking/NetworkedAreaOfEffectWithImpactEvent.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

51 lines
1.3 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class NetworkedAreaOfEffectWithImpactEvent : NetworkedAreaOfEffect
{
public float impactDelay;
public UnityEvent<PhotonView, Taggable> onImpactHappened = new UnityEvent<PhotonView, Taggable>();
public override void Init()
{
if (photonView.IsMine)
{
photonView.RPC(nameof(RPC_RemoteInit), RpcTarget.Others, AbilityIndexer.Instance.Abilities.IndexOf(ability));
StartCoroutine(ApplyTelegraphDelay(impactDelay));
}
}
protected override void RPC_RemoteInit(int abilityIndex)
{
ability = (AreaOfEffectWithImpactEventAbility)AbilityIndexer.Instance.Abilities[abilityIndex];
}
protected override IEnumerator ApplyTelegraphDelay(float delay)
{
effectVisual.SetActive(true);
yield return new WaitForSeconds(impactDelay);
CheckSurroundings();
}
protected override void ApplyArea()
{
}
protected override void CheckSurroundings()
{
base.CheckSurroundings(); //TODO: spread the total value over ticks, for now just apply the instant effect every tick, manage tick values on effect applied
onImpactHappened.Invoke(owner, ownerTag);
StartCoroutine(SelfDestruct());
}
}