Exemple #1
0
    protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
    {
        base.DoEventTriggered(args);

        if (args.TargetEntity != null)
        {
            foreach (Spell atch in attachSpells)
            {
                if (atch.SpellType != SpellType.Attached)
                {
                    Debug.LogError("Trying to attach spell: " + atch.SpellID + " which is of type: " + atch.SpellType);
                    continue;
                }
                if (!args.TargetEntity.HasSingleInstanceSpell(atch))
                {
                    Spell sp = SpellList.Instance.GetNewSpell(atch);
                    // Set the spell properties. The caster should be whoever cast the initial spell, but the spell
                    // target will be that of the target entity.
                    sp.CastSpell(effectSetting.spell.CastingEntity, args.TargetEntity.transform, null, args.TargetEntity.transform);
                    // Actually attach the spell to the target entity.
                    args.TargetEntity.AttachSpell(sp);
                    args.TargetEntity.AddSingleInstanceSpell(sp);
                }
                else
                {
                    args.TargetEntity.RefreshSingleInstanceSpell(atch);
                }
            }
        }
    }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     if (args.TargetEntity != null)
     {
         if (args.TargetEntity.EntityAnimator != null)
             args.TargetEntity.EntityAnimator.PlayAnimation(_animation);
     }
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     if (Vector3.Distance(effectSetting.spell.SpellTargetTransform.position, effectSetting.spell.CastingEntity.transform.position) <= range)
     {
         TryTriggerCollision(new ColliderEventArgs(), effectSetting.spell.SpellTargetTransform.GetComponent<Collider>());
     }
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     if(!_markerID.Equals(AddSpellMarker.NOTSETID) && args.TargetEntity != null && args.TargetEntity.HasSpellMarker(_markerID))
     {
         args.TargetEntity.RemoveSpellMarker(_markerID);
     }
 }
Exemple #5
0
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     var mult = 1f -
         MathUtility.GetPercent(
             Vector3.Distance(effectSetting.transform.position,
                 GameMainReferences.Instance.PlayerController.transform.position), maxDistanceFromPlayer);
     GameMainReferences.Instance.RTSCamera.TriggerShake(shakeTime, shakeAmount * mult);
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     switch (gameObjectEvent)
     {
         case GameObjectEvent.Activate:
             gameObject.SetActive(true);
             break;
         case GameObjectEvent.Deactivate:
             gameObject.SetActive(false);
             break;
     }
 }
    protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
    {
        base.DoEventTriggered(args);

        Collider[] colliders = Physics.OverlapSphere(effectSetting.transform.position, _radius);
        foreach (Collider hit in colliders)
        {
            Rigidbody rb = hit.GetComponent<Rigidbody>();

            if (rb != null)
                rb.AddExplosionForce(_power, effectSetting.transform.position, _radius, _upwardsModifer, _forceMode);
        }
    }
    protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
    {
        base.DoEventTriggered(args);

        if (args.TargetEntity != null)
        {
            _affectedEntities.Add(args.TargetEntity);
        }
        else
        {
            return;
        }
        args.TargetEntity.StatHandler.ApplyStatModifier(effectSetting.spell.SpellID, _statModifier);
    }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     switch (emissionEvent)
     {
         case EmissionEvent.EmitAmount:
             DoEmitAmount();
             break;
         case EmissionEvent.Play:
             DoPlay();
             break;
         case EmissionEvent.Stop:
             DoStop();
             break;
     }
 }
    protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
    {
        base.DoEventTriggered(args);

        if(args.TargetEntity != null)
        {
            if (args.TargetEntity.LivingState != EntityLivingState.Alive)
                return;

            // Apply the elemental properties
            args.TargetEntity.ApplyElementalSpell(this);
        }
        else
        {
            Debug.LogWarning("Effect: " + gameObject + " on spell: " + effectSetting.spell + " tried applying to null entity");
        }
    }
Exemple #11
0
    protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
    {
        base.DoEventTriggered(args);

        var ent = EntityPool.Instance.GetObjectFromPool(_targetEntity.PoolID, (e) =>
        {
            // Set new Entity to the level of the Entity that cast the spell
            e.LevelHandler.CurrentLevel = effectSetting.spell.CastingEntity.LevelHandler.CurrentLevel;
            e.transform.position = args.TargetPosition;
        });

        var fx = ObjectTransitionPool.Instance.GetObjectFromPool(_transitionFx.PoolID, (o) =>
        {
            o.FXTransitionMethod = ObjectTransitionFx.TransitionMethod.Activate;
            o.TargetObject = ent.gameObject;
        });
        fx.gameObject.SetActive(true);
    }
Exemple #12
0
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     _audioSource.PlayOneShot(audioClip);
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     _triggered = true;
 }
Exemple #14
0
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     CheckForTargets();
 }
Exemple #15
0
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     _particles.particleMask = _particles.particleCount - Mathf.RoundToInt(_particles.particleCount * ParticleMask);
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     CameraController.Instance.BlendTo(_LutTarget, blendInTime, blendOutTime);
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     gameObject.SetActive(_setActiveValue);
 }
 /// <summary>
 /// Triggers an event when a spell has been applied and if the trigger event is set to OnSpellApply
 /// </summary>
 protected override void effectSetting_OnSpellApply(Entity entity)
 {
     base.effectSetting_OnSpellApply(entity);
     _lastApplyEntity = entity;
     if (_triggerEvent == SpellEffectTriggerEvent.SpellApply)
     {
         // Set the args and check if the target entity should be passed in as spell apply
         var args = new SpellEffectStandardEventArgs(SpellEffectTriggerEvent.SpellApply);
         if (EntityTargetMethod == EntityTarget.ApplyEntity)
         {
             args.TargetEntity = entity;
         }
         EventTriggered(args);
     }
 }
    /// <summary>
    /// Trigegrs an event when a special event has been triggered and if the trigger event is set to OnSpecialEvent
    /// </summary>
    /// <param name="eventID"></param>
    protected override void OnSpecialEvent(string eventID)
    {
        base.OnSpecialEvent(eventID);
        // Check if any of the listening IDs are equal to the event ID and trigger the event
        foreach (var id in _listenForEventIDs)
        {
            if (id.Equals(eventID))
            {
                if (_triggerEvent == SpellEffectTriggerEvent.SpecialEvent)
                {
                    var args = new SpellEffectStandardEventArgs(SpellEffectTriggerEvent.SpecialEvent);
                    args.EventID = eventID;
                    EventTriggered(args);
                }
                return;
            }
        }

    }
 /// <summary>
 /// Called when an event should be triggered. This is a private method for handling
 /// the event before calling DoEventTriggered which will register the actual event.
 /// </summary>
 /// <param name="args"></param>
 private void EventTriggered(SpellEffectStandardEventArgs args)
 {
     // If casting Entity set the casting Entity
     // If it is the last Apply Entity use that instead
     // If it uses any other method it should have already been assigned.
     switch (EntityTargetMethod)
     {
         case EntityTarget.CastingEntity:
             args.TargetEntity = effectSetting.spell.CastingEntity;
             break;
         case EntityTarget.LastApplyEntity:
             args.TargetEntity = _lastApplyEntity;
             break;
     }
     switch (PositionTarget)
     {
         case SpellPositionTarget.SpellStartPosition:
             args.TargetPosition = effectSetting.spell.SpellStartPosition;
             break;
         case SpellPositionTarget.SpellStartTransform:
             if (effectSetting.spell.SpellTargetTransform == null)
                 Debug.LogErrorFormat("Spell {0} with spell effect {1} using postion target of SpellTargetTransform had no spell Target", effectSetting.name, name);
             args.TargetPosition = effectSetting.spell.SpellStartTransform.position;
             break;
         case SpellPositionTarget.SpellTargetPosition:
             args.TargetPosition = effectSetting.spell.SpellTargetPosition.Value;
             break;
         case SpellPositionTarget.SpellTargetTransform:
             if (effectSetting.spell.SpellTargetTransform == null)
                 Debug.LogErrorFormat("Spell {0} with spell effect {1} using postion target of SpellTargetTransform had no spell Target", effectSetting.name, name);
             args.TargetPosition = effectSetting.spell.SpellTargetTransform.position;
             break;
     }
     DoEventTriggered(args);
 }
    protected virtual void DoEventTriggered(SpellEffectStandardEventArgs args)
    {

    }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     AddEvolutionPoints(1);
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     effectSetting.spell.CastingEntity.SubtractElementCost(drainOnTick);
 }
Exemple #24
0
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     UpdateMissile();
 }
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     if (effectSetting.spell.SpellTargetPosition.HasValue)
         effectSetting.spell.CastingEntity.EntityPathFinder.SetPosition(effectSetting.spell.SpellTargetPosition.Value);
 }
Exemple #26
0
 protected override void DoEventTriggered(SpellEffectStandardEventArgs args)
 {
     base.DoEventTriggered(args);
     DoApply();
 }