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();
            }
        }
    --------------------- 

  • 相关阅读:
    实现连续测试,要做的事情【译】
    Go语言HTTPServer开发的六种实现
    JSON必知必会【PDF+视频教程】
    给JSONObject添加自定义遍历方法
    利用守护线程隐式关闭线程池
    从错误中学习
    Groovy动态添加方法和属性及Spock单测
    持续测试、持续集成、持续交付、持续部署和DevOps
    有关OAuth 2.0简化模式中步骤D-F的解释
    Spring笔记(五):bean的自动装配
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11277834.html
Copyright © 2011-2022 走看看