zoukankan      html  css  js  c++  java
  • Unity3D——Epitome框架_

    1、Timer timer = new Timer(); 创建时间管理器 参数(float time, TimeUnit timeUnit,bool ignoreTimeScale = false, bool autoStart = true) time:时间值、timeUnit 时间单位(帧率、秒、厘秒、毫秒)、ignoreTimeScale 忽略时间缩放(可以使游戏暂停更容易实现)、autoStart 自动开始计时

    2、timer.loop = true; // 循环          timer.Finished +=method;  // 回调函数     timer.Pause(); // 暂停

    using System.Collections.Generic;
    using UnityEngine;

    namespace Epitome
    {
        public delegate void FinishedHandler();

        public class Timer
        {
            TimerManager.TimerState timer;

            public bool Running { get { return timer.Running; } }

            public bool Paused { get { return timer.Paused; } }

            public bool Loop
            {
                set { timer.HasRepeat = value; }
                get { return timer.HasRepeat; }
            }

            public event FinishedHandler Finished;

            public Timer(float time, TimeUnit timeUnit,bool ignoreTimeScale = false, bool autoStart = true)
            {
                timer = TimerManager.Instance.CreateTimer(time, timeUnit, ignoreTimeScale);
                timer.Finished += TimerFinished;
                if (autoStart) timer.Start();
            }

            public void Start() { timer.Start(); }

            public void Stop() { timer.Stop(); }

            public void Pause() { timer.Pause(http://www.my516.com); }

            public void UnPause() { timer.UnPause(); }

            public void TimerFinished()
            {
                FinishedHandler handler = Finished;
                if (handler != null)
                    handler();
            }
        }
    --------------------- 

  • 相关阅读:
    【Leetcode】92. Reverse Linked List II && 206. Reverse Linked List
    【Leetcode】91. Decode Ways
    记一次面经
    涨知识
    B-Tree 漫谈 (从二叉树到二叉搜索树到平衡树到红黑树到B树到B+树到B*树)
    涨知识
    HDU 1754 I Hate It 【线段树单点修改 维护区间最大值】
    POJ 1632 Vase collection【状态压缩+搜索】
    POJ 1011 Sticks 【DFS 剪枝】
    POJ 1088 滑雪 【记忆化搜索经典】
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11277834.html
Copyright © 2011-2022 走看看