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


C# Car.StartTimer方法代码示例

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


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

示例1: Start

    // Use this for initialization
    void Start()
    {
        winners = new List<GameObject>();

        laps = new int[cars.Length + 1];
        times = new List<float>();

        respawnTimes = new float[cars.Length + planes.Length +1];
        distanceLeftToTravel = new float[cars.Length + planes.Length +1];
        scripts = new CarController[cars.Length];
        airplaneScripts = new AirplaneController[planes.Length];
        waypoint = new Transform[cars.Length + planes.Length +1];
        finished = new bool[cars.Length + 1];

        //intialize the arrays with starting values
        for(int i=0; i < cars.Length; ++i)
        {
            scripts[i] = cars[i].gameObject.GetComponent<CarController>();
            scripts[i].enabled = false;
            respawnTimes[i] = respawnDelay;
            distanceLeftToTravel[i] = float.MaxValue;
            laps[i] = 0 ;
            finished[i] = false;
            scripts[i].StartTimer();
        }

        //Planes
        //Start at the cars arrays length for the index, then push forward while less then the two added together
        for(int i = cars.Length; i < cars.Length + planes.Length; i++)
        {
            airplaneScripts[i - cars.Length] = planes[i - cars.Length].gameObject.GetComponent<AirplaneController>();
            respawnTimes[i] = respawnDelay;
            distanceLeftToTravel[i] = float.MaxValue;
        }

        playerIndex = cars.Length + planes.Length;
        playerScript = playerCar.gameObject.GetComponent<Car>();
        playerScript.KillTheEngine();
        respawnTimes[playerIndex] = playerRespawnDelay;
        laps[playerIndex - planes.Length] = 0;
        distanceLeftToTravel[playerIndex] = float.MaxValue;
        finished[playerIndex - planes.Length] = false;
        playerScript.StartTimer();

        playerWaypointScript = playerWaypointMarker.GetComponent<WaypointGates>();
        UpdatePlayerMarker();
    }
开发者ID:Grunt-139,项目名称:Wake-Island-Run-Unity3D,代码行数:48,代码来源:RaceManager.cs


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