示例#1
0
        /// <summary>
        /// Triggered when a target is hit
        /// </summary>
        /// <param name="source">The EventInfoList to send</param>
        /// <param name="source">
        /// The target struct used to cache this target when sent
        /// </param>
        public void OnHit(EventInfoList eventInfoList, Target target)
        {
#if UNITY_EDITOR
            // Normal level debug and above
            if (this.debugLevel > DEBUG_LEVELS.Off)
            {
                Debug.Log
                (
                    string.Format
                    (
                        "Targetable ({0}): EventInfoList[{1}]",
                        this.name,
                        eventInfoList.ToString()
                    )
                );
            }
#endif

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

            if (this.onHitDelegates != null)
            {
                this.onHitDelegates(eventInfoList, target);
            }
        }
示例#2
0
        /// <summary>
        /// Get a copy of this list with effectInfo.hitTime set to 'now'.
        /// </summary>
        /// <returns>EventInfoList</returns>
        public EventInfoList CopyWithHitTime()
        {
            var       newlist = new EventInfoList();
            EventInfo info;
            IEnumerator <EventInfo> enumerator = base.GetEnumerator();

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

            return(newlist);
        }
示例#3
0
 public EventInfoList(EventInfoList eventInfoList) : base(eventInfoList)
 {
 }