JohnSmithSpeech.cs 4.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class JohnSmithSpeech : MonoBehaviour, Character {

    private Queue<string> conversation = new Queue<string>();
    private Queue<string[]> responseQueue = new Queue<string[]>();

    private string[] currentResponses;

13
14
15
16
    public float getLevel() {
        return GameManager.JohnLevel;
    }

17
18
19
20
    public string getName() {
        return "John";
    }

21
22
    public string GreetingMessage() {
        loadConversation();
23
24
        

25
        if ((int)GameManager.getLevel(getName()) == 1) {
26
27
28
            currentResponses = new string[] { "Hi there"};
            return "Hello, im John Smith";

29
        } else if ((int)GameManager.getLevel(getName()) == 2) {
30
31
32
            currentResponses = new string[] { "stage 2 greeting response" };
            return "stage 2 (hello) grr";

33
        } else if ((int)GameManager.getLevel(getName()) == 3) {
34
35
36
            currentResponses = new string[] { "stage 3 greeting response" };
            return "stage 3 (hello) grr";

37
        } else if ((int)GameManager.getLevel(getName()) == 4) {
38
39
40
41
42
            currentResponses = new string[] { "stage 4 greeting response" };
            return "stage 4 (hello) grr";

        }
        return "Something has gone terribly wrong: The stage is: " + GameManager.ConversationStage;
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    }
    public string GoodbyeMessage() {
        currentResponses = new string[] { };
        return "See you soon!";
    }

    public string ProximityMessage() {
        currentResponses = new string[] { };
        return "Clowns are so underrated these days";
    }
    public string butthurtGoodbye() {
        currentResponses = new string[] { };
        return "No attention for poor John Smith?";
    }

    public string nothingMoreToSay() {
        currentResponses = new string[] { };
        if (Random.Range(0, 1f) < 0.8) {
            return "youre still here?";
        } else {
            return "latta";
        }
    }

    public string converse() {
        if (conversation.Count > 0) {
            currentResponses = responseQueue.Dequeue();
            return conversation.Dequeue();
        } else {
            return nothingMoreToSay();
        }
    }

    private void loadConversation() {
        conversation.Clear();
        responseQueue.Clear();

80
        if ((int)GameManager.getLevel(getName()) == 1) {
81
82
            conversationStage1();

83
        } else if ((int)GameManager.getLevel(getName()) == 2) {
84
85
            conversationStage2();

86
        } else if ((int)GameManager.getLevel(getName()) == 3) {
87
88
            conversationStage3();

89
        } else if ((int)GameManager.getLevel(getName()) == 4) {
90
91
92
93
94
95
96
97
98
99
            conversationStage4();

        }
    }

    public string[] getResponses() {
        return currentResponses;
    }

    private void conversationStage1() {
100
101
102
        if (GameManager.HasTalkedToAhava) {
            conversation.Enqueue("welcome to the circus");
            responseQueue.Enqueue(new string[] { "response 1" });
103

104
105
            conversation.Enqueue("line 2");
            responseQueue.Enqueue(new string[] { "response 2", "response 2" });
106

107
108
            conversation.Enqueue("line 3");
            responseQueue.Enqueue(new string[] { "response 3", "response 3", "response 3" });
109

110
111
            conversation.Enqueue("line 4");
            responseQueue.Enqueue(new string[] { "response 4", "response 4" });
112

113
114
            conversation.Enqueue("line 5");
            responseQueue.Enqueue(new string[] { "response 5", "response 5", "response 5" });
115

116
117
118
119
120
121
            conversation.Enqueue("line 6");
            responseQueue.Enqueue(new string[] { "response 6" });
        } else {
            conversation.Enqueue("talk to the bearded lady before you start clowning around");
            responseQueue.Enqueue(new string[] { "okay", "that was a terrible joke" });
        }
122
123
    }

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
    private void conversationStage2() {
        conversation.Enqueue("Stage 2 conversation stuff");
        responseQueue.Enqueue(new string[] { "Stage 2 response 1", "stage 2 resposne 2" });

        conversation.Enqueue("Stage 2 conversation stuff 2");
        responseQueue.Enqueue(new string[] { "Stage 2 response 1", "stage 2 resposne 2" });
    }

    private void conversationStage3() {
        conversation.Enqueue("Stage 3 conversation stuff");
        responseQueue.Enqueue(new string[] { "Stage 3 response 1", "stage 3 resposne 2" });

        conversation.Enqueue("Stage 3 conversation stuff 2");
        responseQueue.Enqueue(new string[] { "Stage 3 response 1", "stage 3 resposne 2" });
    }

    private void conversationStage4() {
        conversation.Enqueue("Stage 4 conversation stuff");
        responseQueue.Enqueue(new string[] { "Stage 4 response 1", "stage 4 resposne 2" });

        conversation.Enqueue("Stage 4 conversation stuff 2");
        responseQueue.Enqueue(new string[] { "Stage 4 response 1", "stage 4 resposne 2" });
146
147
    }
}