BARKING WITH SWITCH-CASE STATEMENT

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
HAELENT
Posts: 3
Joined: Sun May 03, 2020 3:50 am

BARKING WITH SWITCH-CASE STATEMENT

Post by HAELENT »

Hi again, sorry to trouble you but can someone tell me how can i make Barking using switch - case statement that is already is in my game? I want it to bark different lines depended on which case it is.

My code:

Code: Select all

private void GiveAwardByAngle()
    {
        // Here you can set up rewards for every sector of wheel
        switch ((int)_startAngle)
        {
            case 0:
                RewardStars(1);
                StartScriptCameraSwitch.enabled = true;
                StartScriptCameraSwitch.StartSwitchCameras();
                break;
            case -300:
                RewardCoins(100);
                break;
            case -240:
                RewardCoins(0);
                break;
            case -180:
                RewardCoins(50);
                break;
            case -120:
                RewardCoins(100);
                break;
            case -60:
                RewardCoins(50);
                break;
            default:
                RewardCoins(0);                
                break;
        }
    }
Help?
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: BARKING WITH SWITCH-CASE STATEMENT

Post by Tony Li »

Hi,

You can bark strings. Example:

Code: Select all

private void GiveAwardByAngle()
    {
        // Here you can set up rewards for every sector of wheel
        switch ((int)_startAngle)
        {
            case 0:
                DialogueManager.BarkString("You won a star!", barker);
                RewardStars(1);
                StartScriptCameraSwitch.enabled = true;
                StartScriptCameraSwitch.StartSwitchCameras();
                break;
            case -300:
                DialogueManager.BarkString("You get 100 coins!", barker);
                RewardCoins(100);
                break;
etc.
HAELENT
Posts: 3
Joined: Sun May 03, 2020 3:50 am

Re: BARKING WITH SWITCH-CASE STATEMENT

Post by HAELENT »

Wow, that was pretty simple. Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: BARKING WITH SWITCH-CASE STATEMENT

Post by Tony Li »

You're welcome! :-)
Post Reply