SimonSpeech.cs 2.18 KB
Newer Older
1
2
3
4
5
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


6
public class SimonSpeech : MonoBehaviour, Character {
7
8

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

11
12
    private string[] currentResponses;

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

17
    public string GreetingMessage(){
18
        loadConversation();
19
        currentResponses = new string[] { "Hi there", "Who are you", "what is this place" };
20
        return "(happy) grr";
21
22
    }
    public string GoodbyeMessage(){
23
        currentResponses = new string[] { };
24
        return "(relieved) grr";
25
26
27
    }

    public string ProximityMessage(){
28
        currentResponses = new string[] { };
29
        return "(thoughtful) grr";
30
31
    }
    public string butthurtGoodbye(){
32
        currentResponses = new string[] { };
33
        return "(angry) GRR";
34
35
36
    }

    public string nothingMoreToSay() {
37
        currentResponses = new string[] { };
38
        if (Random.Range(0, 1f) < 0.8) {
39
            return "grr?";
40
        } else {
41
            return "*cough cough* ... umm ... GRR";
42
43
44
45
46
        }
    }

    public string converse() {
        if (conversation.Count > 0) {
47
            currentResponses = responseQueue.Dequeue();
48
49
50
51
52
53
54
            return conversation.Dequeue();
        } else {
            return nothingMoreToSay();
        }
    }

    private void loadConversation() {
55
        conversation.Clear();
56
57
        responseQueue.Clear();

58
        conversation.Enqueue("grR");
59
60
        responseQueue.Enqueue(new string[] { "GRR", "..." });

61
        conversation.Enqueue("GrR");
62
63
        responseQueue.Enqueue(new string[] { "GRR", "umm" });

64
        conversation.Enqueue("gRR");
65
66
        responseQueue.Enqueue(new string[] { "GRR", "you sound funny" });

67
        conversation.Enqueue("GRr");
68
69
        responseQueue.Enqueue(new string[] { "GRR", "sorta, non bearish" });

70
        conversation.Enqueue("GRR");
71
72
        responseQueue.Enqueue(new string[] { "GRR", "..." });

73
        conversation.Enqueue("grr");
74
        responseQueue.Enqueue(new string[] { "GRR", "..." });
75
    }
76
77
78
79

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