예제 #1
0
    /// <summary>
    /// Event where a player is selected and Proceed selected to continut to game - Default/Customized
    /// </summary>
    protected void OnSelectPlayer()
    {
        // Get selected profile
        UIButtonSelection sel = GetCurrentSelectionButton();

        // Get the index of the player profile
        int selectionIndex = GetSelectionButtonIndex(sel);

        PlayerProfile.current.selectedProfileIndex = selectionIndex;

        // Get the current game data slot
        var dataSlot = GameData.current.GetCurrentDataSlot();

        dataSlot.ClearPlayer();

        // Add the selected player to it
        var player = dataSlot.AddPlayer(selectionIndex);

        // Set the Color Path for the selected player
        player.colorPath = PlayerProfile.current.GetColorPathFromProfile(selectionIndex);

        Debug.Log("Player Selection: " + selectionIndex);

        GameData.Save();

        PlayerProfile.Save();


        if (dismissOnSelect)
        {
            UINavigationController.DismissController();
        }
        else
        {
            UINavigationController.PushController(controllerRedirectOnSelect);
        }
    }