コード例 #1
0
    //////////////////////////////////////////////////////////////////////////////
    //                              MAIN METHODS                                //
    //////////////////////////////////////////////////////////////////////////////
    void Start()
    {
        switch (playerNumber)
        {
        case 1:
            inputFunc = leftStick;
            break;

        case 2:
            inputFunc = rightStick;
            break;

        case 3:
            inputFunc = leftStick2;
            break;

        case 4:
            inputFunc = rightStick2;
            break;
        }

        currentMode = modes[0];
        anim        = currentMode.GetComponent <Animator>();
        attacks     = new attackDelegate[3];
        attacks[0]  = basicAttack;
        attacks[1]  = tankAttac;
        attacks[2]  = swardAttac;

        currentAttack = attacks[0];
        rb            = GetComponent <Rigidbody>();
        currentHealth = maxHealth;
    }
コード例 #2
0
 /// <summary>
 /// initializes the game and assigns the input delegate
 /// </summary>
 /// <param name="inputDel">The method that returns input as an int</param>
 public void Initialize(inputDelegate inputDel, bool isP1CPU, bool isP2CPU,
                        Player.CPUDifficulty p1diff, Player.CPUDifficulty p2diff)
 {
     _inputDelegate = inputDel;
     Player1        = new Player('O', 'X', isP1CPU, true, p1diff);
     Player2        = new Player('X', 'O', isP2CPU, false, p2diff);
     RestartGame();
 }