本文整理汇总了C#中Clock.SetGoalSpawnPos方法的典型用法代码示例。如果您正苦于以下问题:C# Clock.SetGoalSpawnPos方法的具体用法?C# Clock.SetGoalSpawnPos怎么用?C# Clock.SetGoalSpawnPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Clock
的用法示例。
在下文中一共展示了Clock.SetGoalSpawnPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReady
public override void OnReady()
{
// Retrieve player information
GhopperPlayer[] gPlayers = GetPlayers();
numPlayers = gPlayers.Length;
Camera.main.transform.Rotate(0, 0, -180 / numPlayers); // Rotate camera to match board orientation with bezel
boardObject.renderer.material = boardMaterials[numPlayers-2]; // Select board based on number of players
// Game parameters initialization
playerScores = new int[numPlayers];
players = new Player[numPlayers];
scoreBezel = new PlayerScoreBezel(numPlayers);
clock = clockObject.GetComponent<Clock>();
// Player info generation
Color colorRed = new Color (1.0f, 0.2f, 0.2f);
Color colorBlue = new Color (0.3f, 0.3f, 1.0f);
Color colorGreen = new Color (0.3f, 1.0f, 0.3f);
Color colorYellow = new Color (1.0f,0.72f, 0.3f);
Color colorPurple = new Color (0.5f, 0.1f, 0.4f);
Color colorCyan = new Color(0.0f, 0.9f, 0.9f);
Color[] playerColors = {colorRed, colorBlue, colorGreen, colorYellow, colorPurple, colorCyan};
string[] playerNames = {"Red", "Blue", "Green", "Yellow", "Purple", "Cyan"};
// Player info initialization
for (int i = 0; i < numPlayers; ++i) {
playerScores[i] = 0;
GameObject playerObject = (GameObject)GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity);
players[i] = playerObject.GetComponent<Player>();
players[i].InitPlayerInfo(i, playerColors[i], playerMaterials[i], ballMaterials[i], GetBallSpawnPos(i));
scoreBezel.SetPlayerName(i, playerNames[i]);
scoreBezel.SetPlayerColor(i, playerColors[i]);
scoreBezel.SetPlayerScore(i, playerScores[i]);
}
// Initialize Bezel
bezel.LoadTemplate(scoreBezel);
//scoreBezel.Show();
SpawnBall(GetBallSpawnPos(0)); // Spawn a ball at player one's position
clock.SetGoalSpawnPos(GetBallSpawnPos(0)); // Initialize clock's spawn position, in case the ball disappears before a goal is scored, it has a place to spawn again
SpawnBumpers();
SpawnPegs();
// Add touch input listeners
InputMaster.WorldTouchStarted += TouchStarted;
InputMaster.WorldTouchUpdate += TouchUpdate;
InputMaster.WorldTouchEnded += TouchEnded;
Show();
}