public void SetUpManual(string text, bool includeDefaultResponse) { // print("Setting up manual dialogue control (" + includeDefaultResponse + ") with text\n" + text); this.gameObject.AddComponent <DialogueEvidence>(); DialogueEvidence e = this.GetComponent <DialogueEvidence>(); e.id = "&&NONE&&"; e.opener = "opener"; DialogueLine l = new DialogueLine(); l.id = e.opener; EvidenceObject eo = gameObject.GetComponent <EvidenceObject>(); if (eo != null) { this.name_ = eo.title; } l.text = text; if (e.lines.ContainsKey(e.opener)) { e.lines[e.opener] = l; } else { e.lines.Add(e.opener, l); } intentionalNoResponse = !includeDefaultResponse; this.SetUp(e); }
public void savePhase() { PlayerPrefs.SetString("phaseID", currentPhaseName); PlayerPrefs.SetInt("chapterNumber", chapterNumber); PlayerPrefs.SetString("GameData_AllIDs", GameData.GetPackedIDs()); // Save Inventory int i = 0; foreach (object o in playerController.inventory) { EvidenceObject eo = (o as GameObject).GetComponent <EvidenceObject>(); PlayerPrefs.SetString("inventory_" + i + "_id", eo.associatedID); PlayerPrefs.SetString("inventory_" + i + "_imagePath", eo.filepath); PlayerPrefs.SetString("inventory_" + i + "_type", eo.type); PlayerPrefs.SetString("inventory_" + i + "_title", eo.title); PlayerPrefs.SetString("inventory_" + i + "_description", eo.description); i++; } PlayerPrefs.SetInt("inventorySize", i); // faction values foreach (string faction in uIManager.getValidFactionNames()) { PlayerPrefs.SetFloat("faction_" + faction, uIManager.getFactionVal(faction)); } }
private void Awake() { detectClick = detectClick != null ? detectClick : gameObject.GetComponent <DetectClick>(); evidenceObject = gameObject.GetComponent <EvidenceObject>(); playerController = playerController != null ? playerController : GameObject.Find("PlayerController").GetComponent <PlayerController>(); gameManager = GameObject.FindObjectOfType <GameManager>(); }
public void collect(GameObject evidence) { EvidenceObject eo = evidence.GetComponent <EvidenceObject>(); if (eo.type == "physical") { // BRENT, CHECK NOTES // collecting adds the GameObject that has the EvidenceObject as a component to // PlayerController.inventory and associatedID to gameData via gameData.addID() // Debug.Log("Collected physical evidence"); inventory.Add(evidence); GameData.AddID(eo.associatedID); evidence.SetActive(false); // collecting evidence gives a small boost to the police faction uiManager.changeFactionValue("police", 5); } else if (eo.type == "dialogue") { // CLAY, CHECK NOTES //Debug.Log("Can't collect dialogue evidence directly; must be navigated to in dialogue"); Debug.Log("Collected a dialogue evidence (as a single line from an NPC)"); inventory.Add(evidence); evidence.SetActive(false); uiManager.changeFactionValue("police", 5); // intentionally left out the call to GameData.AddID() b/c it's handled in the dialogue controller } }
public void Load(EvidenceObject eo) { if (eo.physicalEvidence != null) { Load(eo.physicalEvidence); } else if (eo.dialogueEvidence != null) { Load(eo.dialogueEvidence); } }
public override int GetHashCode() { return(EvidenceObject.GetHashCode()); }
public override bool Equals(object obj) { return(EvidenceObject.Equals(obj)); }
public void LoadDetailedViewForEvidenceObject(EvidenceObject obj) { // TODO: call detailedEvidenceLoader using either obj.physicalEvidence or obj.dialogueEvidence }
void ReadEvidencePhase(XmlReader reader, GameObject phaseObject) { // Debug.Log("======READING EVIDENCE PHASE======="); phaseObject.GetComponent <Phase>().filepath = reader.GetAttribute("background"); phaseObject.GetComponent <Phase>().introText = reader.GetAttribute("introText"); EvidenceObject lastEvo = null; bool notEnd = Read(reader); while (notEnd && (reader.Name == "evidenceObject" || reader.Name == "requirements" || reader.Name == "physicalEvidence" || reader.Name == "dialogueEvidence")) { if (reader.Name == "evidenceObject") { // print("creating an evidence object"); GameObject evo = GameObject.Instantiate(evidenceObjectPrefab) as GameObject;//new GameObject("evidenceObject"); evo.SetActive(true); //evo.AddComponent<EvidenceObject>(); evo.GetComponent <EvidenceObject>().type = reader.GetAttribute("type"); evo.GetComponent <EvidenceObject>().filepath = reader.GetAttribute("filepath"); evo.GetComponent <EvidenceObject>().x = int.Parse(reader.GetAttribute("x")); evo.GetComponent <EvidenceObject>().y = int.Parse(reader.GetAttribute("y")); evo.GetComponent <EvidenceObject>().z = int.Parse(reader.GetAttribute("z")); evo.GetComponent <EvidenceObject>().title = (reader.GetAttribute("title")); evo.GetComponent <EvidenceObject>().description = (reader.GetAttribute("description")); evo.GetComponent <EvidenceObject>().associatedID = (reader.GetAttribute("associatedID")); if (evo.GetComponent <EvidenceObject>().type == "physical") { evo.GetComponent <DialogueController>().name = evo.GetComponent <EvidenceObject>().title; evo.GetComponent <DialogueController>().sentences = new string[] { evo.GetComponent <EvidenceObject>().description }; } lastEvo = evo.GetComponent <EvidenceObject>(); phaseObject.GetComponent <Phase>().evidenceObjects.Add(evo.GetComponent <EvidenceObject>()); notEnd = Read(reader); } else if (reader.Name == "requirements") { // print("reading requirements"); lastEvo.requirements = ReadRequirements(reader); notEnd = Read(reader); } else if (reader.Name == "physicalEvidence") { // print("building a physical evidence"); GameObject ev = ReadPhysicalEvidence(reader); ev.transform.parent = lastEvo.transform; lastEvo.physicalEvidence = ev.GetComponent <PhysicalEvidence>(); } else if (reader.Name == "dialogueEvidence") { // print("building a dialogue evidence"); GameObject ev = ReadDialogueEvidence(reader); ev.transform.parent = lastEvo.transform; lastEvo.dialogueEvidence = ev.GetComponent <DialogueEvidence>(); } else { notEnd = Read(reader); } } }