// Use this for initialization void Start() { text = GetComponent <Text>(); exclamation = FindObjectOfType <Exclamation>(); activateRunes = FindObjectOfType <ActivateRunes>(); rebirth = FindObjectOfType <Rebirth>(); }
private void Start() { dw = FindObjectOfType <DialogueWindow>(); exclamation = GetComponentInChildren <Exclamation>(); soulCounter = FindObjectOfType <SoulCounter>(); Debug.Log("Exclamation: " + exclamation); }
// Use this for initialization void Awake() { animator = GetComponent <Animator>(); exclamation = GetComponentInChildren <Exclamation>(); dialogue = GetComponent <ShamanDialogue>(); cavemanThrow = FindObjectOfType <Caveman_Throw>(); ChangeCursor = false; audio = GetComponent <AudioSource>(); }
public Sentence(Exclamation exclamation, Punctuation punctuation, SentenceDiagnostics diagnostics) { LaFragment = new List <Fragment>(); this.degenerateExclamation = exclamation; this.punctuation = punctuation; this.diagnostics = diagnostics; }
private void CheckSight(NPC npc) { RaycastHit2D hit = Physics2D.Raycast(npc.transform.position, npc.Direction, npc.renderer.bounds.size.x * 20); if (hit.collider != null) { if (hit.collider.gameObject.tag.Equals("Player") && npc.renderer.isVisible && !npc.Freeze) { npc.Freeze = true; GameObject exclamation = Instantiate(Resources.Load("Exclamation", typeof(GameObject)), new Vector3(npc.transform.position.x, npc.transform.position.y + npc.renderer.bounds.size.y, npc.transform.position.z), Quaternion.identity) as GameObject; Exclamation excl = exclamation.GetComponent <Exclamation>(); excl.attach(npc.gameObject); mediator.RestartGame(); } } }
//language|word|noun|adj|vt|vi|adv|prep|pronoun|kama|conditional|interj|conj| private Sentence SingleExclamation() { Word interj = RandomWord("interj"); //Word[] exclamationModifiers = new Word[] //{ // Words.a, Words.kin //}; Dictionary <int, int> odds = new Dictionary <int, int> { { 0, 85 }, { 1, 10 }, { 2, 5 } }; ConvertToCummulative(odds); int dice = random.Next(0, 101); WordSet ws = new WordSet(); if (dice < 25) { dice = random.Next(0, 101); var howMany = odds.Where(x => dice <= x.Value).Select(x => x.Key).First(); while (howMany > 0) { ws.Add(new Word(Token.Modals[random.Next(0, Token.Modals.Length)])); howMany--; } Exclamation e = new Exclamation(new HeadedPhrase(interj, ws)); Sentence s = new Sentence(e, new Punctuation("!"), SentenceDiagnostics.NotFromParser); return(s); } else { Exclamation e = new Exclamation(new HeadedPhrase(interj)); Sentence s = new Sentence(e, new Punctuation("!"), SentenceDiagnostics.NotFromParser); return(s); } }
private void btnExclamation_Click(object sender, RoutedEventArgs e) { Exclamation.Play(); }
public virtual IEnumerator <ITask> ExclamationHandler(Exclamation exclamation) { return(PlaySound(exclamation.Body.Synchronous, exclamation.ResponsePort, SystemSounds.Exclamation)); }
public Sentence ProcessSimpleSentence(string sentence, Punctuation punctuation, string original) { //Think this is causing a bug. ////HACK: Still need a better way to deal with quotes. //if (sentence.EndCheck("»") || sentence.EndCheck("«")) //{ // sentence = sentence.Substring(0, sentence.Length - 1); //} //Comment? Get out of here! if (sentence.StartCheck("///")) { Comment c = new Comment(sentence); return(new Sentence(c, diagnostics)); } //Simple exclamation! Get out of here! if (Exclamation.IsExclamation(sentence)) { return(new Sentence(new Exclamation(new HeadedPhrase(new Word(sentence))), punctuation, new SentenceDiagnostics(original, sentence))); } List <Vocative> headVocatives = null; //jan Mato o, ale li pona. Head vocative! //kin la o moku. //not a vocative (hopefully dealt with elsewhere) //jan Mato o moku! //Head vocative, & imperative, with 2nd o discarded //jan Mato o o moku! //Head vocative, & imperative, with 2nd o discarded if (sentence.ContainsCheck(" o o "))//Explicit vocative & imperative { //Okay, we know exactly when the head vocatives end. headVocatives = new List <Vocative>(); string justHeadVocatives = sentence.Substring(0, sentence.IndexOf(" o o ", StringComparison.Ordinal)); //Process head vocatives. ProcessHeadVocatives(Splitters.SplitOnO(justHeadVocatives), headVocatives, allAreVocatives: true); //BUG: Add the dummy! (And it still doesn't work!) sentence = "jan Sanwan o " + sentence.Substring(sentence.IndexOf(" o o ", StringComparison.Ordinal) + 5); } //Starts with o, then we have imperative & no head vocatives. bool endsOrStartsWithO = sentence.StartCheck("o ") && sentence.EndCheck(" o"); if (!endsOrStartsWithO) { //jan So o! (We already deal with degenerate vocative sentences elsewhere) //jan So o sina li nasa. //jan So o nasa! //jan So o mi mute o nasa. <-- This is the problem. //These could be vocatives or imperatives. if (sentence.ContainsCheck(" o ", " o,", ",o ") && sentence.ContainsCheck(" li ")) { headVocatives = new List <Vocative>(); ProcessHeadVocatives(Splitters.SplitOnO(sentence), headVocatives, allAreVocatives: false); //int firstLi = sentence.IndexOf(" li "); int lastO = sentence.LastIndexOf(" o ", StringComparison.Ordinal); if (lastO < 0) { lastO = sentence.LastIndexOf(" o,", StringComparison.Ordinal); } sentence = sentence.Substring(lastO + 2); } } //Process tag conjunctions and tag questions Particle conjunction = null; TagQuestion tagQuestion = null; if (sentence.StartCheck("taso ")) { conjunction = Particles.taso; sentence = sentence.Substring(5); } else if (sentence.StartCheck("anu ")) { conjunction = Particles.anu; sentence = sentence.Substring(4); } else if (sentence.StartCheck("en ")) { //Well, either parse it or throw. Otherwise, this gets skipped. //is this legal? conjunction = Particles.en; sentence = sentence.Substring(3); } else if (sentence.StartCheck("ante ")) //never seen it. { conjunction = Particles.ante; sentence = sentence.Substring(5); } //Should already have ? stripped off if (sentence.EndsWith(" anu seme")) { tagQuestion = new TagQuestion(); sentence = sentence.Substring(0, sentence.LastIndexOf(" anu seme", StringComparison.Ordinal)); } if (sentence.EndCheck(" li")) { throw new TpParseException("Something went wrong-- sentenc ends with li. " + sentence); } if (sentence.StartsOrContainsOrEnds("la")) { throw new TpParseException("If it contains a la, anywhere, it isn't a simple sentence. " + sentence); } bool isHortative = false; bool isImperative = false; if (sentence.StartCheck("o ") && sentence.ContainsCheck(" li ")) { //o mi mute li moku isHortative = true; sentence = sentence.RemoveLeadingWholeWord("o"); } if (sentence.StartCheck("o ") && !sentence.ContainsCheck(" li ")) { //o pana e pan isImperative = true; //sentence = sentence.RemoveLeadingWholeWord("o"); } // someting o ==> vocative string[] liParts = Splitters.SplitOnLiOrO(sentence); if (liParts.Length == 1 && Exclamation.IsExclamation(liParts[0])) { //HACK: Duplicate code. & it only deals with a single final puncution mark. string possiblePunctuation = sentence[sentence.Length - 1].ToString(); if (Punctuation.TryParse(possiblePunctuation, out punctuation)) { sentence = sentence.Substring(0, sentence.Length - 1); } //The whole thing is o! (or pakala! or the like) //pona a! a a a! ike a! TokenParserUtils tpu = new TokenParserUtils(); Word[] tokes = tpu.ValidWords(sentence); HeadedPhrase parts = new HeadedPhrase(tokes[0], new WordSet(ArrayExtensions.Tail(tokes))); bool modifiersAreA = true; foreach (Word w in parts.Modifiers) { if (w == "a") { continue; //peculiar to exclamations & repeats. } if (w == "kin") { continue; //modifies just about anything } modifiersAreA = false; } if (modifiersAreA) { Exclamation exclamation = new Exclamation(parts); Sentence s = new Sentence(exclamation, punctuation, diagnostics); return(s); } } //Degenerate sentences. if (liParts[liParts.Length - 1].Trim(new char[] { ',', '«', '»', '!', ' ' }) == "o") { //We have a vocative sentence... Vocative vocative = new Vocative(ProcessEnPiChain(liParts[0])); Sentence s = new Sentence(vocative, punctuation, diagnostics); return(s); } string subjects = liParts[0].Trim(); ComplexChain subjectChain = null; int startAt = 1; //slot 0 is normally a subject if (subjects.Contains("«")) { int foo = 3; } if (subjects.StartCheck("o ") || subjects.StartCheck("«o ")) { //This is a verb phrase with implicit subjects! startAt = 0; } else { subjectChain = ProcessEnPiChain(subjects); } PredicateList verbPhrases = new PredicateList(); for (int i = startAt; i < liParts.Length; i++) { string predicate = liParts[i].Trim(); verbPhrases.Add(ProcessPredicates(predicate)); } //Head or complete sentence. Sentence parsedSentence = new Sentence(subjectChain, verbPhrases, diagnostics, new SentenceOptionalParts { Conjunction = conjunction, //Etc Punctuation = punctuation, IsHortative = isHortative, TagQuestion = tagQuestion, HeadVocatives = headVocatives != null ? headVocatives.ToArray() : null }); return(parsedSentence); }
private static void ValidateConstruction(Word head, WordSet modifiers) { if (head == null) { throw new ArgumentNullException("head", "Cannot construct with null"); } //HACK: related to taso in la fragment, and logical operators not implemented yet. if (!(Exclamation.IsExclamation(head.Text) || head.Text == "taso" || head.Text == "anu") && Token.CheckIsParticle(head.Text)) { throw new TpSyntaxException( "You cannot have a headed phrase that is headed by a particle. That would be a chain. " + head.Text + " " + (modifiers == null ? "" : modifiers.ToString())); } if (head.Text == "o" && modifiers != null && modifiers.Count > 0) { Console.WriteLine("Warning: We have an o with modifiers. This should be crazy rare." + head.Text + " " + modifiers); //Warning: } if (ProperModifier.IsProperModifer(head.Text)) { string warning = string.Empty; if (Word.IsWord(head.Text.ToLower())) { warning = " (This is a valid word, maybe it shouldn't be capitalized?)"; } if (!Number.IsPomanNumber(head.Text)) { throw new TpSyntaxException("Proper modifiers cannot be the head of a headed phrase " + head.Text + warning); } } if (modifiers != null) { foreach (Word word in modifiers) { if (word.Text == "en" || word.Text == "anu") { continue; //HACK: Deferring dealing with these. } if (word.Text == "taso") { continue; //Taso actually is a modifier. Carry on. } if (Particle.CheckIsParticle(word.Text)) { throw new TpSyntaxException("Particles shouldn't be modifiers: " + head.Text + " " + modifiers); } } if (modifiers.Contains(Words.ona)) { if (modifiers.Contains(Words.mi)) { throw new TpSyntaxException("Can't have ona and mi in modifier list." + head.Text + " " + modifiers); } if (modifiers.Contains(Words.sina)) { throw new TpSyntaxException("Can't have ona and sina in modifier list." + head.Text + " " + modifiers); } } if (modifiers.Contains(Words.sina)) { if (modifiers.Contains(Words.mi)) { throw new TpSyntaxException("Can't have sina and mi in modifier list." + head.Text + " " + modifiers); } } } if (modifiers != null && modifiers.Count > 1) { var query = modifiers.GroupBy(x => x) .Where(g => g.Count() > 1) .Select(y => y.Key) .ToList(); if (query.Count > 0) { throw new TpSyntaxException("Degenerate modifiers-- doubles " + modifiers); } } //5 about never gets false positives. if (modifiers != null && modifiers.Count > 3) { if (head.Text == "nanpa") { //no surprise there } else if (head.Text == "kama" || head.Text == "kama") { //Defer kama/tawa, they take unmarked complements, so they make for long verb phrases. } //HACK: else if (modifiers.Any(x => x.Text == "anu" || x.Text == "en" || x.Text == "kama" || x.Text == "tawa")) //Because we've deferred dealing with conj. & serial verbs { } else { throw new TpSyntaxException("Suspiciously long headed phrase " + head + " " + modifiers); } } }