当前位置: 首页>>代码示例>>C#>>正文


C# Stopwatch.startStopwatch方法代码示例

本文整理汇总了C#中Stopwatch.startStopwatch方法的典型用法代码示例。如果您正苦于以下问题:C# Stopwatch.startStopwatch方法的具体用法?C# Stopwatch.startStopwatch怎么用?C# Stopwatch.startStopwatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stopwatch的用法示例。


在下文中一共展示了Stopwatch.startStopwatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    // Get the current scene
    //    public string currentLevel;
    //    public int currentLevelNum;
    //    public float moveTimer;
    // Use this for initialization
    void Start()
    {
        cacheCurrentLevelIndex();

        if (System.IO.File.Exists ("Save/currentSave"))
            System.IO.File.Delete ("Save/currentSave");

        displayMessage = false;
        displayPauseMenu = false;
        bool mattyProfile = false;
        bool liquidProfile = false;
        bool solidProfile = false;
        bool gasProfile = false;
        bool plasmaProfile = false;
        panTriggerActive = false;
        displayTime = 0f;
        one = 1f;
        messageToBeDisplayed = "";
        if (tipDisplayTime == 0f)
            tipDisplayTime = 10f;

        originalAmbientColor = RenderSettings.ambientLight;
        darknessTriggerSpots = new float [2];
        sceneCamera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Transform>();
        camFollow = sceneCamera.gameObject.GetComponent<CameraFollow>();

        iciclesList = new System.Collections.Generic.List<IcicleBase> ();
        GameObject[] icicleBaseArray = GameObject.FindGameObjectsWithTag ("IceCeiling");
        foreach (GameObject icicle in icicleBaseArray)
            iciclesList.Add (icicle.GetComponent<IcicleBase>());

        darkCave = false;
        darkCavesList = new System.Collections.Generic.List<DarkCave>();
        icicleBaseArray = GameObject.FindGameObjectsWithTag ("DarkCave");
        foreach (GameObject darkCaveEnterX in icicleBaseArray)
        {
            DarkCave newCave;
            Transform dcTransform = darkCaveEnterX.GetComponent<Transform>();
            Vector3 dcEnter = dcTransform.Find ("DarkCaveEnter").position;
            Vector3 dcExit = dcTransform.Find ("DarkCaveExit").position;

            newCave.Door1 = new Vector2 (dcEnter.x, dcEnter.y);
            newCave.Door2 = new Vector2 (dcExit.x, dcExit.y);
            darkCavesList.Add (newCave);
        }

        LoadTriggerMessagesFromFile ();
        GUIDimensionSetup ();

        // Creates a backup of the light intensities of all the lights in the scene.
        // This is needed since we need to lerp the light intensities to zero when player
        // enters dark caves.
        lights = GameObject.FindSceneObjectsOfType (typeof(Light)) as Light[];
        origLightIntensities = new float [lights.Length];
        for (int i = 0; i < lights.Length; i ++)
            origLightIntensities [i] = lights [i].intensity;

        // Creates a backup of the skybox assigned to the scene.
        // This is needed since we set the skybox to null as the player enters dark caves.
        origSkybox = RenderSettings.skybox;

        // Needed for dark caves. If background colour is not set to black, dark caves
        // won't be "dark" anymore.
        sceneCamera.gameObject.GetComponent<Camera>().backgroundColor = Color.black;

        // Define the GUIStyle to be used in the State Info Box at the bottom of the screen.
        stateInfoBox = new GUIStyle ();
        stateInfoBox.name = "StateInfoBox";
        stateInfoBox.alignment = TextAnchor.LowerRight;
        stateInfoBox.font = menuFont;
        stateInfoBox.normal.textColor = Color.white;

        player = GameObject.FindGameObjectWithTag ("Player").GetComponent<MainPlayerScript>();

        try
        {
            ld = GameObject.FindGameObjectWithTag ("LevelDirector").GetComponent<LevelDirector>();
        }
        catch (System.Exception e)
        {
            Debug.LogWarning ("A Level Director was not found for this level!");
        }

        try
        {
            levelStopwatch = GameObject.FindGameObjectWithTag("Stopwatch");
            stopwatch = levelStopwatch.GetComponent<Stopwatch>();

            if (PlayerPrefs.GetString(Constants.GameModeKey).Equals(Constants.GameModeSpeedRun))
            {
                stopwatch.startStopwatch();
                isSpeedRun = true;
            }

            player.setIsSpeedRun(isSpeedRun);
//.........这里部分代码省略.........
开发者ID:kdros,项目名称:PhaseGame,代码行数:101,代码来源:Director.cs


注:本文中的Stopwatch.startStopwatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。