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


C# Clock.SetGoalSpawnPos方法代码示例

本文整理汇总了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();
    }
开发者ID:shu1,项目名称:dfu,代码行数:57,代码来源:Game.cs


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