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

52 lines
1.6 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetworkMultipleProjectileChainReaction : NetworkAbilityChainReaction, IPunObservable
{
public List<NetworkedProjectile> projectiles = new List<NetworkedProjectile>();
ProjectileAbility projectileAbility;
public override void ExecuteAbilityChainReaction(PhotonView owner, Taggable ownerTag, List<Taggable> targets)
{
if (!owner.IsMine) return;
projectileAbility = (ProjectileAbility)ability;
foreach (NetworkedProjectile projectile in projectiles)
{
projectile.speed = projectileAbility.projectileSpeed;
projectile.owner = owner;
projectile.ownerTag = ownerTag;
projectile.ability = projectileAbility;
projectile.lifeSpan = projectileAbility.lifeSpan;
projectile.canPierce = projectileAbility.canPierce;
projectile.canHitSelf = projectileAbility.canHitSelf;
projectile.gameObject.SetActive(true);
projectile.Init();
}
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
for (int i = 0; i < projectiles.Count; i++)
{
stream.SendNext(projectiles[i].gameObject.activeSelf);
}
}
if (stream.IsReading)
{
for (int i = 0; i < projectiles.Count; i++)
{
projectiles[i].gameObject.SetActive((bool)stream.ReceiveNext());
}
}
}
}