コード例 #1
0
ファイル: Snake.cs プロジェクト: bschug/CLaUn.vs.SnaKe
	public IEnumerator Spawn (float delay) {
		yield return new WaitForSeconds( delay );
		CurrentPath = SnakePathRegistry.Instance.GetUnusedPath();
		SnakePathRegistry.Instance.LockPath( CurrentPath );

		CurrentPath.ShowDigAtStart();
		yield return new WaitForSeconds( BalanceValues.Instance.SnakeSpawnDigDelay );
		SoundManager.Instance.SnakeSpawned();

		var SpawnQueue = new Queue<SnakeSegment>( Segments );
		while (SpawnQueue.Count > 0) {
			var nextSegment = SpawnQueue.Dequeue();
			nextSegment.transform.position = CurrentPath.StartPosition;
			nextSegment.gameObject.SetActive( true );
			nextSegment.Path = CurrentPath;
			while (nextSegment.transform.position == CurrentPath.StartPosition) {
				yield return null;
			}
		}

		CurrentPath.HideDigAtStart();
	}