RiftMayhem/Assets/Scripts/Networking/NetworkedAreaOfEffectWithImpactEvent.cs
Pedro Gomes e1081a2bf4 Necromancer and Minions update
- Necromancer class playable
- Savage minion ability & npc
- Mage minion ability & npc
- rogue minion ability & npc
- warrior minion ability & npc
- golem minion ability & npc
- minion abilities
- Class resource (used to automatically summon minions based on the amount of souls drained, in case of necromancer)
- class resource spender (auto cast from priority list)
- class resource regen instant effect option
2024-07-22 16:46:13 +01:00

62 lines
1.5 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, List<Taggable>> onImpactHappened = new UnityEvent<PhotonView, Taggable, List<Taggable>>();
protected override void Awake()
{
base.Awake();
}
public override void Init()
{
if (photonView.IsMine)
{
photonView.RPC(nameof(RPC_RemoteInit), RpcTarget.Others, AbilityIndexer.Instance.Abilities.IndexOf(ability));
StartCoroutine(ApplyTelegraphDelay(impactDelay));
}
}
[PunRPC]
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, targets);
StartCoroutine(SelfDestruct());
}
}