private void OnHit(HitEffectList effects, Target target, Collider other)
    {
        if (this.isDead) return;

        if (other != null)
            Debug.Log(this.name +  " was hit by collider on " + other.name);

        foreach (HitEffect effect in effects)
        {
            if (effect.name == "Damage")
            {
                this.life -= (int)effect.value;
            }
        }

        if (this.life <= 0)
        {
            this.isDead = true;
            Instantiate
            (
                this.explosion.gameObject,
                this.transform.position,
                this.transform.rotation
            );

            this.gameObject.SetActive(false);
        }
    }
Пример #2
0
    public void OnHit(HitEffectList effects, Target target, Collider other)
    {
        #if UNITY_EDITOR
        // Normal level debug and above
        if (this.debugLevel > DEBUG_LEVELS.Off)
        {
            Debug.Log
            (
                string.Format
                (
                    "Targetable ({0}): HitEffects[{1}]",
                    this.name,
                    effects.ToString()
                )
            );
        }
        #endif

        // Set the hitTime for all effects in the list.
        effects = effects.CopyWithHitTime();

        if (this.onHitDelegates != null)
        {
            this.onHitDelegates(effects, target);
        }

        // Same as above with addition of collider in signature
        if (this.onHitColliderDelegates != null)
        {
            this.onHitColliderDelegates(effects, target, other);
        }
    }
    private void OnHit(HitEffectList effects, Target target, Collider other)
    {
        if (this.isDead)
        {
            return;
        }

        if (other != null)
        {
            Debug.Log(this.name + " was hit by collider on " + other.name);
        }

        foreach (HitEffect effect in effects)
        {
            if (effect.name == "Damage")
            {
                this.life -= (int)effect.value;
            }
        }

        if (this.life <= 0)
        {
            this.isDead = true;
            Instantiate
            (
                this.explosion.gameObject,
                this.transform.position,
                this.transform.rotation
            );

            this.gameObject.SetActive(false);
        }
    }
Пример #4
0
 private void OnHit(HitEffectList effects, Target target, Collider other)
 {
     if (this.isDead)
     {
         return;
     }
     if (other != null)
     {
         Debug.Log(base.name + " was hit by collider on " + other.name);
     }
     foreach (HitEffect current in effects)
     {
         if (current.name == "Damage")
         {
             this.life -= (int)current.value;
         }
     }
     if (this.life <= 0)
     {
         this.isDead = true;
         UnityEngine.Object.Instantiate(this.explosion.gameObject, base.transform.position, base.transform.rotation);
         base.gameObject.SetActive(false);
     }
 }
Пример #5
0
    public void OnHit(HitEffectList effects, Target target, Collider other)
    {
        #if UNITY_EDITOR
        // Normal level debug and above
        if (this.debugLevel > DEBUG_LEVELS.Off)
        {
            Debug.Log
            (
                string.Format
                (
                    "Targetable ({0}): HitEffects[{1}]",
                    this.name,
                    effects.ToString()
                )
            );
        }
        #endif

        // Set the hitTime for all effects in the list.
        effects = effects.CopyWithHitTime();

        if (this.onHitDelegates != null)
            this.onHitDelegates(effects, target);

        // Same as above with addition of collider in signature
        if (this.onHitColliderDelegates != null)
            this.onHitColliderDelegates(effects, target, other);
    }
Пример #6
0
 /// <summary>
 /// Triggered when a target is hit
 /// </summary>
 /// <param name="source">The HitEffectList to send</param>
 /// <param name="source">
 /// The target struct used to cache this target when sent
 /// </param>
 public void OnHit(HitEffectList effects, Target target)
 {
     this.OnHit(effects, target, null);
 }
Пример #7
0
 public MessageData_TargetableOnHit(HitEffectList effects, Target target)
 {
     this.effects = effects;
     this.target  = target;
 }
 public MessageData_TargetableOnHit(HitEffectList effects, Target target)
 {
     this.effects = effects;
     this.target = target;
 }
Пример #9
0
 /// <summary>
 /// Triggered when a target is hit
 /// </summary>
 /// <param name="source">The HitEffectList to send</param>
 /// <param name="source">
 /// The target struct used to cache this target when sent
 /// </param>
 public void OnHit(HitEffectList effects, Target target)
 {
     this.OnHit(effects, target, null);
 }
Пример #10
0
 public void OnHit(HitEffectList effects, Target target, Collider other)
 {
     effects = effects.CopyWithHitTime();
     if (this.onHitDelegates != null)
     {
         this.onHitDelegates(effects, target);
     }
     if (this.onHitColliderDelegates != null)
     {
         this.onHitColliderDelegates(effects, target, other);
     }
 }