Esempio n. 1
0
 public static PlayerData GetPlayerDataFromControlScheme(PlayerData.ControlScheme scheme)
 {
     for (int i = 0; i < CarsSelected.Length; i++)
     {
         if (CarsSelected[i].GetControlScheme() == scheme)
         {
             return(CarsSelected[i]);
         }
     }
     return(null);
 }
Esempio n. 2
0
    //initialization
    void Start()
    {
        l = GameObject.FindWithTag("LevelManager").GetComponent <LevelManager>();

        //Obtaining and saving the initial positions of the cursor and the coin
        CoinPosition   = Coin.transform.position;
        playerPosition = playerButton.transform.position;

        ThisPlayerCar     = 0;
        ThisControlScheme = PlayerData.ControlScheme.NotAssigned;
        ThisPlayerType    = PlayerData.PlayerType.None;
    }
Esempio n. 3
0
    //Updates the variables to be passed to the main game after the GUI selection screen
    void UpdatePlayerData()
    {
        if (ThisPlayerControl == ControlTypesHere.ArrowKeys)
        {
            ThisControlScheme = PlayerData.ControlScheme.Arrows;
        }
        else if (ThisPlayerControl == ControlTypesHere.WSDA)
        {
            ThisControlScheme = PlayerData.ControlScheme.WASD;
        }
        else if (ThisPlayerControl == ControlTypesHere.Joy1)
        {
            ThisControlScheme = PlayerData.ControlScheme.XboxController1;
        }
        else if (ThisPlayerControl == ControlTypesHere.Joy2)
        {
            ThisControlScheme = PlayerData.ControlScheme.XboxController2;
        }
        else
        {
            ThisControlScheme = PlayerData.ControlScheme.NotAssigned;
        }

        if (is_this_active)
        {
            if (!ThisPlayerSelector.is_CPU)
            {
                ThisPlayerType = PlayerData.PlayerType.Player;
            }
            else
            {
                ThisPlayerType = PlayerData.PlayerType.AI;
            }
        }

        else
        {
            ThisPlayerType = PlayerData.PlayerType.None;
        }
    }
    //Updates the variables to be passed to the main game after the GUI selection screen
    void UpdatePlayerData()
    {
        if      (ThisPlayerControl == ControlTypesHere.ArrowKeys) { ThisControlScheme = PlayerData.ControlScheme.Arrows; }
        else if (ThisPlayerControl == ControlTypesHere.WSDA)      { ThisControlScheme = PlayerData.ControlScheme.WASD; }
        else if (ThisPlayerControl == ControlTypesHere.Joy1)      { ThisControlScheme = PlayerData.ControlScheme.XboxController1; }
        else if (ThisPlayerControl == ControlTypesHere.Joy2)      { ThisControlScheme = PlayerData.ControlScheme.XboxController2; }
        else                                                      { ThisControlScheme = PlayerData.ControlScheme.NotAssigned; }

        if (is_this_active)
        {
            if (!ThisPlayerSelector.is_CPU) { ThisPlayerType = PlayerData.PlayerType.Player; }
            else                            { ThisPlayerType = PlayerData.PlayerType.AI; }
        }

        else                                { ThisPlayerType = PlayerData.PlayerType.None; }
    }
    //initialization
    void Start()
    {
        l = GameObject.FindWithTag("LevelManager").GetComponent<LevelManager>();

        //Obtaining and saving the initial positions of the cursor and the coin
        CoinPosition = Coin.transform.position;
        playerPosition = playerButton.transform.position;

        ThisPlayerCar = 0;
        ThisControlScheme = PlayerData.ControlScheme.NotAssigned;
        ThisPlayerType = PlayerData.PlayerType.None;
    }