Beispiel #1
0
        /// <summary>
        /// Creates the meteor shower - helper-object that spawns meteorites in a given area and deals damage to enemies.
        /// </summary>
        /// <param name="owner">The skill owner (caster).</param>
        /// <param name="targetsProvider">The targets provider.</param>
        /// <param name="target">The target.</param>
        /// <param name="skillLevel">The skill level.</param>
        /// <param name="objectsPool">The objects pool.</param>
        /// <exception cref="ArgumentNullException">
        /// owner
        /// or
        /// targetsProvider
        /// or
        /// target
        /// or
        /// objectsPool
        /// </exception>
        public void CreateMeteorShower(ISkilled owner, ITargetsProvider targetsProvider, AreaTarget target, int skillLevel,
                                       IObjectsPool objectsPool)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            if (targetsProvider == null)
            {
                throw new ArgumentNullException(nameof(targetsProvider));
            }

            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            if (objectsPool == null)
            {
                throw new ArgumentNullException(nameof(objectsPool));
            }

            var parameters = GetParameters(skillLevel);
            var meteor     = objectsPool.GetOrCreate(parameters.MeteorShowerPrefab);

            meteor.Setup(target, parameters.Damage, targetsProvider, owner);
        }
        /// <summary>
        /// Shoots the arrow to the specified target.
        /// </summary>
        /// <param name="attacker">The attacker.</param>
        /// <param name="target">The target.</param>
        /// <param name="objectsPool">The objects pool.</param>
        /// <exception cref="ArgumentNullException">objectsPool</exception>
        public void ShootArrow(IAttacker attacker, ITargetAttackable target, IObjectsPool objectsPool)
        {
            if (arrowPrefab == null)
            {
                return;
            }

            if (objectsPool == null)
            {
                throw new ArgumentNullException(nameof(objectsPool));
            }

            var arrow = objectsPool.GetOrCreate(arrowPrefab, attacker.transform.position, attacker.transform.rotation);

            arrow.ArrowSetup(target, attacker, arrowSpeed, attacker.DamageValue);
        }
Beispiel #3
0
        /// <summary>
        /// Launches the ice bolt at the given target (magic arrow with freeze effect).
        /// </summary>
        /// <param name="owner">The skill owner (caster).</param>
        /// <param name="target">The target.</param>
        /// <param name="skillLevel">The skill level.</param>
        /// <param name="objectsPool">The objects pool.</param>
        /// <exception cref="ArgumentNullException">
        /// owner
        /// or
        /// target
        /// or
        /// objectsPool
        /// </exception>
        public void LaunchIceBolt(ISkilled owner, ITarget target, int skillLevel, IObjectsPool objectsPool)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            if (objectsPool == null)
            {
                throw new ArgumentNullException(nameof(objectsPool));
            }

            var parameters = GetParameters(skillLevel);
            var arrow      = objectsPool.GetOrCreate(parameters.ArrowPrefab, owner.transform.position, owner.transform.rotation);
            var effect     = parameters.EffectFreeze.CreateEffect(owner, objectsPool);

            arrow.MagicArrowSetup(target, owner, parameters.ArrowSpeed, effect);
        }