12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using UnityEngine;
- using System.Collections;
- using System;
- namespace YLBattle
- {
- /// <summary>
- ///
- /// </summary>
- public class FightingEffectBase : GameBehavior
- {
- /// <summary>
- ///
- /// </summary>
- private float mStartTime = 0;
- /// <summary>
- ///
- /// </summary>
- private Action acEvent = null;
- /// <summary>
- /// 生命周期
- /// </summary>
- public float mLifeTime = 0;
- /// <summary>
- ///
- /// </summary>
- /// <param name="ac"></param>
- public void SetData(Action ac)
- {
- mStartTime = Time.realtimeSinceStartup;
- this.acEvent = ac;
- }
- void Update()
- {
- if (Time.realtimeSinceStartup - this.mStartTime >= this.mStartTime)
- {
- InvokeEvent();
- this.acEvent = null;
- }
- }
- /// <summary>
- ///
- /// </summary>
- public void InvokeEvent()
- {
- if (acEvent != null)
- {
- this.acEvent();
- }
- }
- }
- }
|