34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class NetworkDrainEffectChainReaction : NetworkAbilityChainReaction
|
|
{
|
|
NetworkedDrainProjectile drainProjectile;
|
|
|
|
public bool canDrainAllies;
|
|
|
|
public override void ExecuteAbilityChainReaction(Taggable owner, List<Taggable> targets)
|
|
{
|
|
for (int i = 0; i < targets.Count; i++)
|
|
{
|
|
if(!canDrainAllies)
|
|
{
|
|
if (owner.AlliedTagsContains(targets[i].targetTag)) continue;
|
|
}
|
|
|
|
spawnedChainReaction = Instantiate(abilityPrefabName, targets[i].transform.position + Vector3.up * 0.5f, Quaternion.identity);
|
|
|
|
drainProjectile = spawnedChainReaction.GetComponent<NetworkedDrainProjectile>();
|
|
|
|
drainProjectile.speed = ((ProjectileAbility)ability).projectileSpeed;
|
|
drainProjectile.ownerTag = owner;
|
|
drainProjectile.ability = ((ProjectileAbility)ability);
|
|
drainProjectile.lifeSpan = ((ProjectileAbility)ability).lifeSpan;
|
|
|
|
drainProjectile.Init();
|
|
}
|
|
|
|
}
|
|
}
|