public override ClueItem GetItem(Noun n1, Noun n2) { string sprite = "Newspaper"; string desc = ""; if (n1.Type() == NounType.Identity) { desc = "A newspaper article about " + n1.AsSubject() + ", who " + n2.AsObject() + "."; } else if (n2.Type() == NounType.Identity) { desc = "A newspaper article about " + n2.AsSubject() + ", who " + n1.AsObject() + "."; } else if (n1.Type() == NounType.Name) { desc = "A newspaper article about " + n1.AsSubject() + ", who " + n2.AsObject() + "."; } else if (n2.Type() == NounType.Name) { desc = "A newspaper article about " + n2.AsSubject() + ", who " + n1.AsObject() + "."; } ClueItem item = new ClueItem(n1, n2, Verb.Has, sprite, desc); return(item); }
public Sentence(Noun subj, Verb verb, Noun obj, Adverb adv) { if (subj.Type() > obj.Type()) { Noun tmp = subj; subj = obj; obj = tmp; } this.Subject = subj; this.Verb = verb; this.DirectObject = obj; this.Adverb = adv; }
private ClueItem GetClueInternal(Noun n1, Noun n2) { NounType t1 = n1.Type(); NounType t2 = n2.Type(); foreach (GameObject g in clues) { ClueGenerator generator = g.GetComponent <ClueGenerator>(); if (generator.MatchTypes(t1, t2)) { ClueItem item = generator.GetItem(n1, n2); return(item); } } return(null); }
public override ClueItem GetItem(Noun n1, Noun n2) { // ensure n1 is the hair color if (n1.Type() == NounType.Identity) { Noun temp = n1; n1 = n2; n2 = temp; } string spriteName = Random.Range(0, 2) == 0 ? "Photo" : "Photo2"; //int range is max exclusive string description = "A photo of the victim and " + n2.WithVictim() + ", who " + n1.AsObject() + "."; ClueItem item = new ClueItem(n1, n2, Verb.Is, spriteName, description); return(item); }
public override ClueItem GetItem(Noun n1, Noun n2) { // ensure n1 is the identity if (n1.Type() == NounType.Name) { Noun temp = n1; n1 = n2; n2 = temp; } string spriteName = "Letter"; string description = "A letter to the victim about " + Utilities.bold(n2.ToString()) + ", " + n1.WithVictim() + "."; ClueItem item = new ClueItem(n1, n2, Verb.Is, spriteName, description); return(item); }
public static void Generate(out PersonState[] people, out ClueInfo startingClue, out List <ClueItem> cluesToScatter) { cluesToScatter = new List <ClueItem>(); // Randomly determine the world // The player is going to have some natural questions, and we should // create clues that answer them, otherwise they're going to be unsatisfied. // questions: // who's the killer? // why don't we remember anything? // where are we? // who is each person? // why are we here? // what's the story? what events led to where we are now? // TODO - have predermined pairings between backstory / motive / identity // Generate people by shuffling a list of indexes for each attribute type. Noun[][] attributeLists = { appearances, identities, names }; int[][] shuffledLists = { Utilities.RandomList(3, 3), Utilities.RandomList(3, 3), Utilities.RandomList(3, 3), // Don't randomize backstories and motives // Utilities.RandomList(backstories.Length, 3), // Utilities.RandomList(3, 3), }; people = new PersonState[3]; for (int i = 0; i < names.Length; ++i) { people[i] = new PersonState(i); Dictionary <NounType, Noun> attributes = people[i].AttributeMap; for (int attrIndex = 0; attrIndex < attributeLists.Length; attrIndex++) { Noun playerAttr = attributeLists[attrIndex][shuffledLists[attrIndex][i]]; attributes.Add(playerAttr.Type(), playerAttr); } Noun[] depNouns = mDependentNouns[attributes[NounType.Identity]]; for (int nounI = 0; nounI < depNouns.Length; nounI++) { attributes.Add(depNouns[nounI].Type(), depNouns[nounI]); } } // Each player knows the existence of the hair-colors of the other players for (int i = 0; i < names.Length; i++) { for (int j = 0; j < names.Length; j++) { if (i != j) { people[i].knowledge.KnownWords.Add(people[j].AttributeMap[NounType.HairColor]); } } } // Pick a killer GameState.Get().KillerId = Random.Range(0, 3); people[GameState.Get().KillerId].IsKiller = true; // Pick a person to have no motive int innocentId = Random.Range(0, 2); // two possible values if (innocentId >= GameState.Get().KillerId) { innocentId += 1; } // Generate an additional clue for the killer // starting: victim wrote a name in blood Noun killerName = people[GameState.Get().KillerId].AttributeMap[NounType.Name]; ClueInfo deathClue = new ClueInfo(Noun.SuspectedName, killerName); startingClue = deathClue; // Generate clues for everything else // this is probably too many, and we want to strategically // omit certain clues (so that we don't have an immediate person -> name clue) for (int i = 0; i < names.Length; ++i) { Noun hair = people[i].AttributeMap[NounType.HairColor]; Noun identity = people[i].AttributeMap[NounType.Identity]; Noun name = people[i].AttributeMap[NounType.Name]; Noun motive = people[i].AttributeMap[NounType.Motive]; Noun backstory = people[i].AttributeMap[NounType.Backstory]; ClueItem appearanceToIdentity = ClueManifest.GetClue(hair, identity); if (appearanceToIdentity != null) { cluesToScatter.Add(appearanceToIdentity); } else { Debug.Log("No clue for " + hair + " <-> " + identity + "!"); } ClueItem identityToName = ClueManifest.GetClue(identity, name); if (identityToName != null) { cluesToScatter.Add(identityToName); } else { Debug.Log("No clue for " + hair + " <-> " + identity + "!"); } if (i != innocentId) { // Connect identity to motive (for thematic and mechanical reasons) ClueItem motiveClue = ClueManifest.GetClue(identity, motive); if (motiveClue != null) { cluesToScatter.Add(motiveClue); } else { Debug.Log("No clue for " + identity + " <-> " + motive + "!"); } } // Generate a clue connecting something to backstory Noun identityOrName = Random.Range(0, 2) == 0 ? identity : name; ClueItem backstoryClue = ClueManifest.GetClue(identityOrName, backstory); if (backstoryClue != null) { cluesToScatter.Add(backstoryClue); } else { Debug.Log("No clue for " + identityOrName + " <-> " + backstory + "!"); } } // Unique clues ClueItem potion = ClueManifest.GetClue(Noun.Potion, Noun.MemoryLoss); if (potion != null) { cluesToScatter.Add(potion); } else { Debug.Log("No clue for " + Noun.Potion + " <-> " + Noun.MemoryLoss + "!"); } }