Beispiel #1
0
    // Will trigger the effects in the AIBehaviour Script
    private void UseEffect(AIBehaviour ai, ElementEffect effect)
    {
        if (effect == null)
        {
            return;
        }

        if (effect.willDamage)
        {
            ai.Damage(effect.damage);
        }

        if (effect.willPush)
        {
            Vector3 offset = transform.position - ai.transform.position;
            ai.Push(Mathf.Sign(offset.x), effect.pushForce);
        }

        if (effect.willFreeze)
        {
            ai.Freeze(effect.activeTime);
        }

        if (effect.willStun)
        {
            ai.Stun(effect.activeTime);
        }
    }
    // Triggers different methods depending on the effects active.
    private void UseEffect(ElementEffect effect)
    {
        if (effect == null)
        {
            return;
        }

        // Primary abilities are located in PlayerAttack, and in Projectile.

        // Secondary Abilities
        if (effect.willDash && !_dashing)
        {
            Dash(effect.dashForce, effect.activeTime);
            StartCoroutine(this.abilityCoolingdown(this.cooldowns[selectedElement.Value], effect.cooldown, 1));
        }

        if (effect.willDig)
        {
            Dig(terrain.cellAim, terrain.tileAim);
            StartCoroutine(this.abilityCoolingdown(this.cooldowns[selectedElement.Value], effect.cooldown, 1));
        }

        if (effect.immune)
        {
            Immune(effect.activeTime);
            StartCoroutine(this.abilityCoolingdown(this.cooldowns[selectedElement.Value], effect.cooldown, 1));
        }

        if (effect.willFloat)
        {
            Float(effect.floatSpeed, effect.activeTime);
            StartCoroutine(this.abilityCoolingdown(this.cooldowns[selectedElement.Value], effect.cooldown, 1));
        }
    }
 //--------------------------------------------------------------
 // Passive Ability Effects
 //--------------------------------------------------------------
 public void setPassive(ElementEffect effect)
 {
     if (effect == null)
     {
         return;
     }
     _lavaResistant.Value = effect.resistance;
     _swimming.Value      = effect.swim;
     _wallJump.Value      = effect.wallJump;
     _rockStrength.Value  = effect.strength;
 }
Beispiel #4
0
    public void init(FightScreen fightScreen, Enemy enemy)
    {
        this.fightScreen = fightScreen;
        this.enemy       = enemy;

        while (elementEffects.Count <= 3)
        {
            ElementEffect effect = Instantiate <Transform>(elementEffectPrefab).GetComponent <ElementEffect>();
            effect.init(fightScreen, enemy);
            effect.gameObject.SetActive(false);
            elementEffects.Add(effect);
        }
    }
Beispiel #5
0
    private void UseEffect(ElementEffect effect)
    {
        if (effect.projectile)
        {
            Instantiate(this.projectiles[selectedElement.Value], shotPoint.position, transform.rotation);
            StartCoroutine(_player.abilityCoolingdown(_player.cooldowns[selectedElement.Value], effect.cooldown, 0));
        }

        if (effect.turnInvisible)
        {
            Invisible(effect.activeTime);
            StartCoroutine(_player.abilityCoolingdown(_player.cooldowns[selectedElement.Value], effect.cooldown, 0));
        }

        if (effect.groundEffect)
        {
            groundSlam(this.slamRange);
            StartCoroutine(_player.abilityCoolingdown(_player.cooldowns[selectedElement.Value], effect.cooldown, 0));
        }
    }
Beispiel #6
0
    public void addEffect(ElementType type, int value, Vector2 pos, int iconsCount)
    {
        ElementEffect effect = null;

        foreach (ElementEffect other in elementEffects)
        {
            if (!other.isEffectActive())
            {
                effect = other;
                break;
            }
        }

        if (effect == null)
        {
            effect = Instantiate <Transform>(elementEffectPrefab).GetComponent <ElementEffect>();
            effect.init(fightScreen, enemy);
            elementEffects.Add(effect);
        }

        effect.activateEffect(type, value, pos, iconsCount);

        FightProcessor.FIGHT_ANIM_ENEMY_DONE = false;
    }
Beispiel #7
0
 public Status Effect(ElementEffect effect)
 {
     return(ElementsHelper.Effect(effect));
 }
Beispiel #8
0
 protected abstract void InternalApplyEffect(RenderElement element, ElementEffect effect, DrawGraphicsEventArgs renderArgs);
Beispiel #9
0
        /// <summary>
        /// Experimental method to attempt to execute any type of effect. Unused at the moment and needs work.
        /// </summary>
        /// <param name="elementEffect"></param>
        /// <returns></returns>
        public static Status Effect(ElementEffect elementEffect)
        {
            if (elementEffect == null)
            {
                throw new ArgumentNullException("elementEffect");
            }

            ElementNode node = VixenSystem.Nodes.GetElementNode(elementEffect.Id);

            if (node == null)
            {
                throw new ArgumentException(@"Invalid element id", @"elementEffect");
            }
            var status = new Status();

            IModuleDescriptor effectDescriptor = ApplicationServices.GetModuleDescriptors <IEffectModuleInstance>().Cast <IEffectModuleDescriptor>().FirstOrDefault(x => x.EffectName.Equals(elementEffect.EffectName));

            if (effectDescriptor != null)
            {
                var        effect     = ApplicationServices.Get <IEffectModuleInstance>(effectDescriptor.TypeId);
                EffectNode effectNode = CreateEffectNode(effect, node, TimeSpan.FromMilliseconds(elementEffect.Duration));

                Object[] newValues = effectNode.Effect.ParameterValues;
                int      index     = 0;
                foreach (var sig in effectNode.Effect.Parameters)
                {
                    if (sig.Type == typeof(Color))
                    {
                        newValues[index] = ColorTranslator.FromHtml(elementEffect.Color.First().Key);
                    }
                    else
                    {
                        if (sig.Type == typeof(ColorGradient))
                        {
                            var cg = new ColorGradient();
                            cg.Colors.Clear();
                            foreach (var d in elementEffect.Color)
                            {
                                cg.Colors.Add(new ColorPoint(ColorTranslator.FromHtml(d.Key), d.Value));
                            }
                            newValues[index] = cg;
                        }
                        else
                        {
                            if (sig.Type == typeof(Curve))
                            {
                                var pointPairList = new PointPairList();
                                foreach (KeyValuePair <double, double> keyValuePair in elementEffect.LevelCurve)
                                {
                                    pointPairList.Add(keyValuePair.Key, keyValuePair.Value);
                                }
                                var curve = new Curve(pointPairList);
                                newValues[index] = curve;
                            }
                        }
                    }
                    index++;
                }
                effectNode.Effect.ParameterValues = newValues;
                ApplyOptionParameters(effectNode, elementEffect.Options);
                Module.LiveContext.Execute(effectNode);
                status.Message = string.Format("{0} element(s) turned effect {1} for {2} milliseconds.",
                                               VixenSystem.Nodes.GetElementNode(elementEffect.Id).Name, elementEffect.EffectName, elementEffect.Duration);
            }

            return(status);
        }