コード例 #1
0
    // Use this for initialization
    void Start()
    {
        //Randomly decide which player goes first
        if (Random.Range(1,3) == 2) playerTurn = PlayerIndex.One;
        else playerTurn = PlayerIndex.Two;

        player1 = new Player();
        player2 = new Player();

        if(!fromUpdate){
            if (temp1 == null)
            {
                temp1 = GameObject.Find("default1").GetComponent<PlayerCard>();
            }

            PassStats((Player)player1, temp1, out player1);

            if (temp2 == null)
            {
                temp2 = GameObject.Find("default2").GetComponent<PlayerCard>();
            }
            PassStats((Player)player2, temp2, out player2);
        }
        else{
            passPlayer ((Player)playTemp1, out player1);
            passPlayer ((Player)playTemp2, out player2);
        }
        player1.playerIndex = PlayerIndex.One;
        player2.playerIndex = PlayerIndex.Two;
        player1.RecoverHP(player1.hpMax);
        player2.RecoverHP(player2.hpMax);
        player1.UseEndurance(player1.enduranceMax);
        player2.UseEndurance(player2.enduranceMax);

        player1.profileObject = player1Object;
        player2.profileObject = player2Object;

        healthBar1Width = healthBar.width;
        healthBar2Width = healthBar.width;
        enduranceBar1Height = 0;
        enduranceBar2Height = 0;
    }