本文整理汇总了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();
}