public CompetingForLove(int whichNpcIsVictim, Npc npc1, Npc npc2, Npc lover)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
     this.lover = lover;
 }
 public static string myHisHer(Npc npcReferredTo, Npc npcSpeaking)
 {
     if (npcReferredTo == npcSpeaking) return "my";
     else {
         if (npcReferredTo.gender == Npc.Gender.Male) return "his";
         else return "her";
     }
 }
 public static string getSubjectPronoun(Npc npcReferredTo, Npc npcSpeaking)
 {
     if (npcSpeaking == npcReferredTo) return "I";
     else {
         if (npcReferredTo.gender == Npc.Gender.Male) return "he";
         else return "she";
     }
 }
        public void setRelationships(Npc npc)
        {
            for (int i = 0; i < pg.npcs.Count; i++) {
                relationPanels[i].GetComponent<RelationSliderScript>().changedByUIManager = true;

                int relationLevel = pg.relationships[pg.npcs.IndexOf(npc), i];
                GameObject relationPanel = relationPanels[i];
                relationPanel.transform.FindChild("RelationSlider").GetComponent<Slider>().value = relationLevel;
                relationPanel.transform.FindChild("RelationValue").GetComponent<Text>().text = relationLevel.ToString();
            }
        }
 public void handleInteractionWith(Npc npc)
 {
     gameObject.GetComponent<UIManager>().setRelationships(npc);
     speakingNPC = npc;
     setAudioPitch();
     if (npc.isAlive) {
         NPCGreeting(npc);
     }
     else
         examineBody(npc);
 }
 public void getBody(Npc npc, GameObject go)
 {
     if (npc.gender == Npc.Gender.Male) {
         int i = Random.Range(0, maleBodies.Count);
         go.GetComponent<SpriteRenderer>().sprite = maleBodies[i];
         maleBodies.RemoveAt(i);
     } else {
         int i = Random.Range(0, femaleBodies.Count);
         go.GetComponent<SpriteRenderer>().sprite = femaleBodies[i];
         femaleBodies.RemoveAt(i);
     }
 }
        public NPCLog(Npc npc, Rect rect)
        {
            this.npc = npc;
            nameRect = rect;
            nameRect.height = 20;

            rect.height -= 20;
            rect.y = rect.y + 20;

            this.rect = rect;
            if (npc.isMurderer) { color = Color.red; }
            else if (npc.isVictim) { color = Color.cyan; }
            else { color = Color.green; }
        }
Example #8
0
        public void kill(Npc npc, Weapon weapon)
        {
            Event e = new Murder(pg.timeSteps, this, npc, currentRoom, weapon);
            Timeline.addEvent(new Murder(pg.timeSteps, this, npc, currentRoom, weapon));
            npc.die();
            pg.murderWeapon = weapon;
            hasMurderWeapon = true;
            stress = Mathf.Min(stress + Random.Range(0.1f, 0.3f), 1.0f);

            if (pg.debugMode) Debug.Log(e.toString());
        }
 public static string selfOrNamePossessive(Npc npcReferredTo, Npc npcSpeaking)
 {
     if (npcReferredTo == npcSpeaking) return "my";
     else return npcReferredTo.firstname + "'s";
 }
 public static string selfOrName(Npc npcReferredTo, Npc npcSpeaking)
 {
     if (npcReferredTo == npcSpeaking) return "I";
     else return npcReferredTo.firstname;
 }
 public void repositionNpc(Npc npc)
 {
     List<Npc> npcs = new List<Npc>();
     npcs.Add(npc);
     placeNPCs(npcs);
 }
 public static string getSubjectPronounHave(Npc npcReferredTo, Npc npcSpeaking)
 {
     return getSubjectPronoun(npcReferredTo, npcSpeaking) + getHave(npcReferredTo, npcSpeaking);
 }
 public FiredBy(int whichNpcIsVictim, Npc npc1, Npc npc2)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
 }
 void setMurderer(Npc npc)
 {
     npc.isMurderer = true;
     murderer = npc;
 }
 void NPCGreeting(Npc npc)
 {
     if (npc.lieAccusations > 0) {
         dialogType = dialog.greeting;
         displayText("Good evening detective");
     }
     else {
         dialogType = dialog.lockedOut;
         displayText("I have nothing more to say to you.");
     }
 }
        bool SpreadRumour(History history, bool truth = false, Npc npc = null)
        {
            bool rumourSpread = false;
            //Give unrelated NPCs memory of this event
            List<Npc> NpcCopy = new List<Npc>(npcs);
            NpcCopy.Remove(victim); NpcCopy.Remove(murderer); if (npc!=null) NpcCopy.Remove(npc);

            for (int i = 0; i < NpcCopy.Count; i++) {
                float random = Random.Range(0.0f, 1.0f);
                if (random < rumourSpreadChance) {
                    if (truth) npcsWhoKnowTheTruth.Add(NpcCopy[i]);
                    NpcCopy[i].addHistory(history);
                    rumourSpread = true;
                }
            }
            return rumourSpread;
        }
 public BadBreakup(int whichNpcIsVictim, Npc npc1, Npc npc2)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
 }
 public StoleLover(int whichNpcIsVictim, Npc npc1, Npc npc2, Npc lover)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
     this.lover = lover;
 }
 public RejectedLove(int whichNpcIsVictim, Npc npc1, Npc npc2)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
 }
 public PutOutOfBusiness(int whichNpcIsVictim, Npc npc1, Npc npc2)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
 }
 public Nemeses(int whichNpcIsVictim, Npc npc1, Npc npc2)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
 }
        Npc findPotentialLover(Npc seeker)
        {
            List<Npc> potentialLovers = new List<Npc>();
            Npc lover = null;

            foreach (Npc npc in npcs) {
                if (npc != murderer && npc != seeker && npc.gender != seeker.gender && npc.family != seeker.family) {
                    potentialLovers.Add(npc);
                }
            }

            //If none in the right gender exist outside the seeker's family, then create one
            if (potentialLovers.Count == 0) {
                //Find a random NPC not in the seeker's family and not the possible murderer and make them the opposite gender
                while (lover == null || lover == seeker || lover.family == seeker.family || lover == murderer) {
                    lover = npcs[Random.Range(0, npcs.Count)];
                }
                if (lover.gender == Npc.Gender.Female)
                    lover.gender = Npc.Gender.Male;
                else
                    lover.gender = Npc.Gender.Female;
            }
            //Otherwise, select one randomly from the potentials
            else {
                lover = potentialLovers[Random.Range(0, potentialLovers.Count)];
            }

            return lover;
        }
        Npc[] findSiblings()
        {
            //Find a family with two children
            int a = -1;
            int b = -1;
            Npc[] siblings = new Npc[2];

            foreach (Family family in families) {

                if (family.children.Count > 1) {
                    a = Random.Range(0, family.children.Count);
                    while (b == -1 || b == a) {
                        b = Random.Range(0, family.children.Count);
                    }
                    siblings[0] = family.children[a];
                    siblings[1] = family.children[b];
                    break;
                }
            }
            return siblings;
        }
 public static string getHave(Npc npcReferredTo, Npc npcSpeaking)
 {
     if (npcSpeaking == npcReferredTo) return "'ve";
     else return "'s";
 }
 void setVictim(Npc npc)
 {
     npc.isVictim = true;
     victim = npc;
 }
 public FamilyFeud(int whichNpcIsVictim, Npc npc1, Npc npc2)
 {
     this.whichNpcIsVictim = whichNpcIsVictim;
     this.npc1 = npc1;
     this.npc2 = npc2;
 }
        void Start()
        {
            Seed.setSeed();
            Ceilings.findCeilings();
            npcHolder = new GameObject("NPCS").transform;
            npcHolder.gameObject.AddComponent<DontDestroyOnLoad>();
            itemManager = GetComponent<ItemManager>();
            display = GetComponent<DebugRoomDisplay>();
            mansion = GetComponent<Mansion>();
            //mansion.setupRooms();

            families = new List<Family>();
            npcs = new List<Npc>();
            npcsWhoKnowTheTruth = new List<Npc>();

            relationships = new int[number_of_characters, number_of_characters];
            for (int i = 0; i < number_of_characters; i++) {
                for (int x = 0; x < number_of_characters; x++) {
                    relationships[i, x] = nullRelationship;
                }
            }

            victim = null; murderer = null;

            TestimonyManager.pg = this;
            loadNames();
            generateCharacters();
            gameObject.GetComponent<UIManager>().setupRelationPanel();
            createFamilies();
            if (motive == Motives.none) selectMotive();

            createRelationships();
            placeNPCs();
            prepareMotive();
            createRedHerrings();
            bodyFound = false;
            weaponHidden = false;
            timeSteps = 0;
        }
 void examineBody(Npc npc)
 {
     dialogType = dialog.corpse;
     displayText(npc.getFullName() + "'s lifeless body lies before you");
 }