Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        private void OnHitDelegate(HitEffectList effects, Target target)
        {
            if (!this.targetable_OnHit)
            {
                return;
            }
            MessageData_TargetableOnHit arg = new MessageData_TargetableOnHit(effects, target);

            this.handleMsg <MessageData_TargetableOnHit>("Targetable_OnHit", arg);
        }
Exemplo n.º 3
0
        public HitEffectList CopyWithHitTime()
        {
            HitEffectList newlist = new HitEffectList();

            base.ForEach(delegate(HitEffect effect)
            {
                effect.hitTime = Time.time;
                newlist.Add(effect);
            });
            return(newlist);
        }
Exemplo n.º 4
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);
     }
 }
        /// <summary>
        /// Get a copy of this list with effects hitTime set to 'now'.
        /// </summary>
        /// <returns>HitEffectList</returns>
        public HitEffectList CopyWithHitTime()
        {
            var       newlist = new HitEffectList();
            HitEffect effect;
            IEnumerator <HitEffect> enumerator = base.GetEnumerator();

            while (enumerator.MoveNext())
            {
                effect         = enumerator.Current;
                effect.hitTime = Time.time;
                newlist.Add(effect);
            }

            return(newlist);
        }
Exemplo n.º 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);
 }
Exemplo n.º 7
0
 public HitEffectList(HitEffectList hitEffectList) : base(hitEffectList)
 {
 }
 public MessageData_TargetableOnHit(HitEffectList effects, Target target)
 {
     this.effects = effects;
     this.target  = target;
 }