public void Start(int levelTimeSec,Action OnPortalOpen) { this.OnPortalOpen = OnPortalOpen; timer = MainController.Instance.TimerManager.MakeTimer(new TimeSpan(levelTimeSec/2)); timer.OnTimer += OnMiddleGame; deltaPortalTime = PortalOpenTime/10; }
/// <summary> /// 打开外部的一个进行,eg:1.exe /// </summary> /// <param name="ralativePath">进程的路劲</param> /// <param name="callback">进程关闭的回调</param> public static void StartExternalApp(string ralativePath, Action callback) { string m_ralativePath = ralativePath; Action m_extendAppQuitCallback = callback; System.Diagnostics.Process myProcess; myProcess = new System.Diagnostics.Process(); myProcess.StartInfo.UseShellExecute = false; myProcess.StartInfo.FileName = ralativePath; myProcess.StartInfo.CreateNoWindow = false; myProcess.Start(); //myProcess.WaitForExit(); TimerManager.ITimer timer = null; timer = TimerManager.Add(-1, (x) => { if (!myProcess.HasExited)//没有退出 { } else { if (callback != null) { callback(); TimerManager.Remove(timer); } } }, -1); }
private void OpenNewPortalAction() { OpenPortal(); nextPortalOpenTime -= deltaPortalTime; timer = MainController.Instance.TimerManager.MakeTimer(new TimeSpan(nextPortalOpenTime)); timer.OnTimer += OpenNewPortalAction; }
public void Dispose() { if (timer != null) { timer.Stop(); timer = null; } }
public void Init(float power, TalismanTrapDamage talic) { base.Init(); timer2 = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(LIFE_TIME2),true); timer2.OnTimer += OnCheck; this.talic = talic; this.power = power; }
public StayAction(BaseMonster owner, Action<EndCause> endCallback) : base(owner, endCallback) { timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(UnityEngine.Random.Range(2, 10))); timer.OnTimer += () => { endCallback(EndCause.no); }; }
public TimeEffect(Unit targetUnit) { this.targetUnit = targetUnit; timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(totalTime)); timer.OnTimer += OnTimer; MainController.Instance.level.OnEndLevel += OnEndLevel; targetUnit.OnDead += OnTargetDead; endEffect = new IEndEffect(); }
public void Add() { Count++; if (Timer != null) { //PublicWorld.TimerManager.RemoveTimer(Timer); Timer = null; } }
public BulletEffect(Unit unit,float leightMS,Action setAction,Action undoAction) { trg = unit; this.undoAction = undoAction; unit.OnDead += OnDead; timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromMilliseconds(leightMS)); timer.OnTimer += OnEnd; setAction(); }
public ITextTyper Stop() { if (timer != null) { TimerManager.Remove(timer); timer = null; } return(this as ITextTyper); }
private void OnTimer() { if (gameObject != null) { if (dieEffect != null) { Map.Instance.LeaveEffect(dieEffect,transform); dieEffect.Play(); } timer = null; Destroy(gameObject); } }
public void Init(TalismanChain sourseItem, Hero hero,int targetsCount) { power = sourseItem.Power; transform.position = hero.transform.position; if (hitEffect != null) { hitEffect.Stop(); } maxTargets = targetsCount; timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromMilliseconds(800), true); timer.OnTimer += OnTimer; StartCoroutine(Wait1Frame()); }
private void StartReborn() { if (!isReborned) { int sec = UnityEngine.Random.Range(15, 30); // Debug.Log("Start reborn in " + sec); if (UnityEngine.Random.Range(0, 100) < 95) { Debug.Log("Start reborn in " + sec); timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(sec)); timer.OnTimer += OnReborn; } isReborned = true; } }
private void OnMonsterGetHit(BaseMonster obj) { MonsterSliderHP.gameObject.SetActive(true); if (animator != null && !isOpen) { animator.SetTrigger(KEY_OPEN); // Debug.Log("SetTrigger(KEY_OPEN)"); isOpen = true; } MonsterSliderHP.value = obj.CurHp / obj.Parameters[ParamType.Heath]; if (timer != null) { timer.Stop(); } timer = MainController.Instance.TimerManager.MakeTimer(span); timer.OnTimer += OnTimer; }
public IUIFrameEffect SetRotateSpeed(float rotateSpeed) { this.rotateSpeed = rotateSpeed; if (rotateTimer != null) { TimerManager.Remove(rotateTimer); rotateTimer = null; } if (rotateSpeed != 0) { rotateTimer = TimerManager.Add(-1, (arg) => { FrameImage.transform.localEulerAngles += new Vector3(0, 0, rotateSpeed * Time.deltaTime); }, -1); } return(this); }
public void Stop() { if (rotateTimer != null) { TimerManager.Remove(rotateTimer); rotateTimer = null; } if (curTimer != null) { TimerManager.Remove(curTimer); curTimer = null; } if (PlayEndEvent != null) { PlayEndEvent(this); PlayEndEvent = null; } FrameImage.enabled = false; DestroyedEvent = null; IndexEvent.Clear(); }
public ITextTyper Start(int countPerSecond) { time = 0; isActive = true; words = text.text; charsPerSecond = Mathf.Max(1, countPerSecond); if (timer != null) { TimerManager.Remove(timer); } timer = TimerManager.Add(-1, (e) => { if (isActive) { try { text.text = words.Substring(0, (int)(charsPerSecond * time)); time += Time.deltaTime; } catch (Exception) { isActive = false; time = 0; text.text = words; TimerManager.Remove(timer); timer = null; if (done != null) { done(); } } } }, -1); return(this as ITextTyper); }
public void Play(int index = -1) { if (sprites.Count < 1) { Stop(); return; } TimerManager.Remove(curTimer); FrameImage.enabled = true; FrameImage.raycastTarget = false; this.index = index <0 || index> sprites.Count - 1 ? this.index : index; FrameImage.sprite = sprites[this.index]; FrameImage.SetNativeSize(); if (IndexEvent.ContainsKey(this.index) && this.index == 0) { IndexEvent[this.index](this); } curTimer = TimerManager.Add(speed, (arg) => { this.index++; this.index = this.index > sprites.Count - 1 ? 0 : this.index; if (this.index == 0 && !loop) // 第二轮第一帧且非循环播放,结束特效 { Stop(); } else { FrameImage.sprite = sprites[this.index]; FrameImage.SetNativeSize(); if (IndexEvent.ContainsKey(this.index)) { IndexEvent[this.index](this); } } }, -1); }
public virtual void Init() { timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(LIFE_TIME)); timer.OnTimer += OnTimer; }
private void StartReborn() { if (!isReborned) { int sec = UnityEngine.Random.Range(60*2, 60*3); #if UNITY_EDITOR if (DebugController.Instance.RESPAWN_TIME_CREEPS_FAST) { sec = 15; } #endif timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(sec)); timer.OnTimer += OnReborn; isReborned = true; } }
protected virtual void Use() { Debug.Log("Use!!! " + sourseItem.TalismanType); isUnderCooldown = true; timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromMilliseconds(1500)); timer.OnTimer += OnTimerCome; AddEnergy(sourseItem.costShoot,true); if (CastEffect != null) { CastEffect.SetAndPlay(hero); } DoCallback(); }
private void OnTimerCome() { isUnderCooldown = false; if (CastEffect != null) { CastEffect.Stop(); } DoCallback(); timer = null; }
private void OnReborn() { timer = null; if (work) { BornMosters(); } }