Beispiel #1
0
        public void Trigger(Unit unit)
        {
            if (!destroyTriggerEffect)
            {
                ObjectPoolManager.Spawn(triggerEffectObj, transform.position, Quaternion.identity);
            }
            else
            {
                ObjectPoolManager.Spawn(triggerEffectObj, transform.position, Quaternion.identity, triggerEffectDuration);
            }

            if (facAbilityIDList.Count > 0)
            {
                int facAbilityID = facAbilityIDList[Random.Range(0, facAbilityIDList.Count)];

                FactionAbility ability = AbilityManagerFaction.GetFactionAbility(facAbilityID);
                if (ability != null)
                {
                    if (!ability.requireTargetSelection)
                    {
                        AbilityManager.ApplyAbilityEffect(null, ability.Clone(), (int)ability.type);
                    }
                    else
                    {
                        AbilityManager.ApplyAbilityEffect(unit.tile, ability.Clone(), (int)ability.type);
                    }
                }
            }

            unit.ApplyEffect(CloneEffect());

            CollectibleManager.TriggerCollectible(this);

            Destroy(gameObject);
        }