void OnTriggerStay(Collider collider) { if (collider.gameObject.tag == "GameController") { NPC_AI NPC = collider.gameObject.GetComponent <NPC_AI>(); NPC.addFear((SpellsDefinitions.spells2Dmg[0] / NPCsInside.Count) * 1.5f * NPC.ReportFearSusceptibility() * Time.deltaTime); } }
void Awake() { npcAI = GetComponentInParent<NPC_AI>(); npcSight = GetComponentInParent<NPC_Sight>(); flash = GetComponentInChildren<Light>(); if(flash.type == LightType.Spot) flash.spotAngle = lightAngle; playerHead = GameObject.FindGameObjectWithTag(Tags.playerHead); }
void TellIpToGoToHisTent() { NPC_AI m_AI = GetComponentInParent <NPC_AI>(); Animator animator = GetComponentInParent <Animator>(); animator.SetBool("run", true); m_AI.GoToTent(); DialogueEvents.OnDialogueEnd -= Handle_OnDialogueEnd; Destroy(this); }
void Awake() { // Zuweisung der Variablen #region col = GetComponent<SphereCollider>(); playerTracker = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<PlayerTracker>(); player = GameObject.FindGameObjectWithTag(Tags.player); playerRigid = player.GetComponent<Rigidbody>(); playerMovement = player.GetComponent<Player_Movement>(); playerHealth = player.GetComponent<Player_Health>(); npcAI = GetComponent<NPC_AI>(); flashLight = GetComponentInChildren<NPC_Flashlight>(); #endregion targetSightingPosition = playerTracker.resetPosition; }
void NextSentence() { isTyping = true; if (index < sentence.Length - 1) { index++; textDisplay.text = ""; StartCoroutine(Talk()); isTyping = false; } else//conversation complete { Global.HAVING_A_CONVERSATION = false; //my_rigidBody.isKinematic = false; Initialized = false; conversationOver = true; DialogueEvents.FireAnEvent_OnDialogueEnd(this); //Debug.Log(this + " fired an OnDialogueEnd"); GetComponentInParent <QuestGiver>().EnableAndAssignMyQuest(assignsQuestWhenOver); //Debug.Log("Conversation complete, achievement unlocked");//TODO achievement system popup PlayerController player = ObjectFinder.PlayerController; //Debug.Log("dialogue fetched " + player); player.alreadySpeaking = false; Global.USER_INPUT_ENABLED = true; player.transform.rotation = Quaternion.identity; Rigidbody playersRigidBody = player.GetComponent <Rigidbody>(); playersRigidBody.constraints = RigidbodyConstraints.None; //unfreeze playersRigidBody.constraints = RigidbodyConstraints.FreezeRotation; //refreeze to ground Invoke("ClearText", 2f); textDisplay.enabled = false; FacingFriend = false; //reset secret dialogue flag so they can load another conversation GetComponentInParent <QuestGiver>().hasDisocveredSecretDialogue = false; if (dialogueID == "Ip-0") { NPC_AI ip_AI = GetComponentInParent <NPC_AI>(); ip_AI.GoHome(); } } }
public static void Initialize_NewGame() { AccusationEncounters.Initialize_Accusation(); Conversation.Initialize_Conversation(); Flood.Initialize_Flood(); // Lists.Initialize_Lists(); LocationEncounters.Initialize_Locations(); Map.Initialize_Map(); Movement.Initialize_Movement(); Notebook.Initialize_Notebook(); NPC_AI.Initialize_AI_Variables(); NPC_AI.Initialize_NPCs(); NPC_Traits.Initialize_Traits(); RandomEncounters.Initialize_Actors(); RandomEncounters.Initialize_RandomEncounters(); Search.Initialize_Search(); TheBunny.Initialize_Bunny(); Title.Initialize_TitleVars(); Title.Initialize_Secrets(); Variables.Initialize_MainVars(); }
public float angleResponseTime = 0.6f; // Response time for turning an angle into angularSpeed. void Awake() { // Zuweisung von Variablen #region initialPosition = new Vector3(transform.position.x, 0f, transform.position.z); initialForward = transform.forward; playerTracker = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<PlayerTracker>(); npcSight = GetComponent<NPC_Sight>(); npcAI = GetComponent<NPC_AI>(); nav = GetComponent<NavMeshAgent>(); anim = GetComponent<Animator>(); hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>(); #endregion nav.updateRotation = false; anim.SetLayerWeight(1, 0.9f); anim.SetLayerWeight(2, 1f); deadZone *= Mathf.Deg2Rad; }
static void Main(string[] args) { Game_StartNewGame(); // Title screen. Title.ScreenDimensions(); Title.TitleScreen(); // Gah. Start the game. Get on with it already. while (Variables.bGameActive) { if (iInitializeGame == 1) { Lists.Initialize_Lists(); iInitializeGame = 2; } if (Variables.iRemainingTurns > Variables.iTurn60) // end of game, i.e. 0 turns remaining { // First, check for cutscene. These scenes preempt the game display. Cutscenes.ShouldSomethingBePlaying(); // Second, check for Bunny Text. And ditto the aforementioned preemption. TheBunny.BunnyText(); // NPCs Scavenge each round, behind the scenes. NPC_AI.NPCs_Go_Looting(); // Opening cutscene. Odd place for it but its a legacy of the port. Cutscenes.GameStart_Cutscene(); if (Variables.iRemainingTurns != 125) // Ugly, but this is to prevent text from flashing on screen and then instantly disappearing, on turn 125. { // Display Header Info (minutes remaining, current location). First thing player sees outside of story text. Display_UIHeader(); // If everyone is dead, set the proper variable accordingly. AnyoneStillAliveICanFixThat(); if (Variables.iRemainingTurns == (Variables.iTurn50 - 1)) // If turn = 19. { RandomEncounters.DitchTheBestie(); } // Reset the Lists I'm using to track data. Lists.ClearMostLists(); // Populate the NPC Roster list Lists.PopulateNPCRoster(); // Check/Increment Island Flooding Flood.HereComesTheFlood(); Flood.FloodBlocksSomeLocations(); // Add space before shuffler, if anyone is here: NPC_AI.AnyoneHere_NeedShufflerSpace(); // The "Shuffler" Loop where NPC actions are shown. // Order: NPCs come/go/emote, corpse, lightning, bunny. for (int i = 1; Lists.NPCRoster.Count > 0; i++) { NPC_AI.SetUpForShuffler(); NPC_AI.Shuffler_01To89(); NPC_AI.NPC100_ShufflerOverride(); NPC_AI.Shuffler_90To100(); Notebook.DoYouComeHereOftenYouLookFamiliar(); Flood.HopeYouNPCsCanSwim(); NPC_AI.SetAllNPCLocals(); NPC_AI.CanIStopShufflingYet(); // Note: Triggers SoWhoAllIsDead() when everyone has been accounted for. } TheBunny.BunnyCode(); Title.ButPopularityIsImportant(); // Reset NPC Roster, modify spacing. Lists.PopulateNPCRoster(); NPC_AI.IsAnyoneHere(); // The killer's attack routine. NPC_AI.NPC100_PantsDownGenderCheck(); Killer.KillerIsHunting(); } // Random Encounters RandomEncounters.PickAnyRandomEncounter(); // Launches Run_RandomEncounter##(); RandomEncounters.Resolve_RandomEncounters(); // Launches SetAllActorLocals(); & Initialize_Actors(); // Drown Player (if necessary, of course) Flood.ThePlayerCantSwim(); // Random Encounter #8, The Special Friend RandomEncounters.YourVeryOwnBestie(); // Player options. PlayerOptions.PlayerOptionsList(); // Dock one turn and Loop (unless game is over) Variables.waitMove = true; Variables.iRemainingTurns--; Console.Clear(); if (Variables.iRemainingTurns == 0) { Cutscenes.GameOver_OutOfTurns(); } } else { // Handle game over scoring, etc. Title.ShowScore(); } } }
protected override void Awake() { base.Awake(); NPC_AI = GetComponent <NPC_AI>(); }
public static void Cutscene05_MetByTheKiller() { NPC_AI.NPC100_PantsDownGenderCheck(); NPC_AI.NPC100_CurrentNumLocation = Variables.iCurrentLocation; NPC_AI.NPC100_CurrentStrLocation = Variables.sGetLocation; NPC_AI.NPC100_LastStrLocation = NPC_AI.NPC100_CurrentStrLocation; NPC_AI.DesireToMove100 = 0; TheBunny.iBunnyLocation = 0; Console.WriteLine("'There you are.'"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("You turn around to see " + NPC_AI.NPC_100 + ", a slight smile on " + NPC_AI.sGenderHisHer + " face."); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("'Wondered when it would be our turn, whether it'd be later. Or sooner. "); Console.WriteLine("And there's always not-at-all, though those times make me sad.'"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("As " + NPC_AI.sGenderHeShe + " speaks, the falling rain grows warmer, as does the deep, soft"); Console.WriteLine("puddles hugging your ankles. You imagine how nice it would be to"); Console.WriteLine("spread out your arms and fall backward, to fall asleep and float away."); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(NPC_AI.NPC_100 + " looks down, then raises " + NPC_AI.sGenderHisHer + " gaze to meet yours. 'A little bunny"); Console.WriteLine("tells me you've been busy, but not at what. Busy at nothing or"); Console.WriteLine("something? The right or the wrong things -- whatever those might be?'"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(NPC_AI.NPC_100 + " offers up a playful wink, and the world fades away into a furry"); Console.WriteLine("embrace. You catch yourself holding your breath and tell yourself that"); Console.WriteLine("it's OK to rest your eyes, but just until it's time to breathe again."); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("The ground rotates to rest against your back, and you curl up into a ball"); Console.WriteLine("so small that nothing can get to you. Warmth and safety hold you tight,"); Console.WriteLine("and everything falls impossibly still. Even the rain stops in place."); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("'... we know better than to believe that fluffy animals are talking.'"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("The words slip through the tranquility with care, but still knock the"); Console.WriteLine("occasional thought astray. " + NPC_AI.NPC_100 + "? Is " + NPC_AI.sGenderHeShe + " talking about the bunny? You"); Console.WriteLine("want to look, to see. Was it all in my head? Why does it matter to " + NPC_AI.sGenderHimHer + "?"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("The world falls back and stands you up. Your eyes open and you breathe"); Console.WriteLine("in cool, fresh air. Sensations dance across your face as you take a step,"); Console.WriteLine("then another. You breathe again, and smell the rain, the ocean. You feel"); Console.WriteLine("the hunger in your belly. You break into a run, bubbles of rain popping"); Console.WriteLine("all around you, a hint of deepest blue clawing up on the horizon."); NPC_AI.bHunting = true; // the following is to allow the player to reclaim some of his lost MacGuffins in order to escape. // this ensures that areas 9-25 can be searched even if they were already searched. Search.bSearchedLocation_A09 = false; Search.bSearchedLocation_A10 = false; Search.bSearchedLocation_A11 = false; Search.bSearchedLocation_A12 = false; Search.bSearchedLocation_A13 = false; Search.bSearchedLocation_A14 = false; Search.bSearchedLocation_A15 = false; Search.bSearchedLocation_A16 = false; Search.bSearchedLocation_A17 = false; Search.bSearchedLocation_A18 = false; Search.bSearchedLocation_A19 = false; Search.bSearchedLocation_A20 = false; Search.bSearchedLocation_A21 = false; Search.bSearchedLocation_A22 = false; Search.bSearchedLocation_A23 = false; Search.bSearchedLocation_A24 = false; Search.bSearchedLocation_A25 = false; // If the player previously used the lighthouse, they can still search again. Search.bSearchedLocation_B09 = false; Search.bSearchedLocation_B10 = false; Search.bSearchedLocation_B11 = false; Search.bSearchedLocation_B12 = false; Search.bSearchedLocation_B13 = false; Search.bSearchedLocation_B14 = false; Search.bSearchedLocation_B15 = false; Search.bSearchedLocation_B16 = false; Search.bSearchedLocation_B17 = false; Search.bSearchedLocation_B18 = false; Search.bSearchedLocation_B19 = false; Search.bSearchedLocation_B20 = false; Search.bSearchedLocation_B21 = false; Search.bSearchedLocation_B22 = false; Search.bSearchedLocation_B23 = false; Search.bSearchedLocation_B24 = false; Search.bSearchedLocation_B25 = false; int iRunFromKiller = Program.rand.Next(9, 26); while (iRunFromKiller == Variables.iCurrentLocation) { iRunFromKiller = Program.rand.Next(9, 26); // areas 1-8 are now flooded. } if (iRunFromKiller == 9) { Variables.sGetLocation = LocationEncounters.location_009; NPC_AI.NPC100_CurrentNumLocation = 9; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_009; } if (iRunFromKiller == 10) { Variables.sGetLocation = LocationEncounters.location_010; NPC_AI.NPC100_CurrentNumLocation = 10; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_010; } if (iRunFromKiller == 11) { Variables.sGetLocation = LocationEncounters.location_011; NPC_AI.NPC100_CurrentNumLocation = 11; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_011; } if (iRunFromKiller == 12) { Variables.sGetLocation = LocationEncounters.location_012; NPC_AI.NPC100_CurrentNumLocation = 12; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_012; } if (iRunFromKiller == 13) { Variables.sGetLocation = LocationEncounters.location_013; NPC_AI.NPC100_CurrentNumLocation = 13; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_013; } if (iRunFromKiller == 14) { Variables.sGetLocation = LocationEncounters.location_014; NPC_AI.NPC100_CurrentNumLocation = 14; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_014; } if (iRunFromKiller == 15) { Variables.sGetLocation = LocationEncounters.location_015; NPC_AI.NPC100_CurrentNumLocation = 15; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_015; } if (iRunFromKiller == 16) { Variables.sGetLocation = LocationEncounters.location_016; NPC_AI.NPC100_CurrentNumLocation = 16; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_016; } if (iRunFromKiller == 17) { Variables.sGetLocation = LocationEncounters.location_017; NPC_AI.NPC100_CurrentNumLocation = 17; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_017; } if (iRunFromKiller == 18) { Variables.sGetLocation = LocationEncounters.location_018; NPC_AI.NPC100_CurrentNumLocation = 18; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_018; } if (iRunFromKiller == 19) { Variables.sGetLocation = LocationEncounters.location_019; NPC_AI.NPC100_CurrentNumLocation = 19; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_019; } if (iRunFromKiller == 20) { Variables.sGetLocation = LocationEncounters.location_020; NPC_AI.NPC100_CurrentNumLocation = 20; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_020; } if (iRunFromKiller == 21) { Variables.sGetLocation = LocationEncounters.location_021; NPC_AI.NPC100_CurrentNumLocation = 21; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_021; } if (iRunFromKiller == 22) { Variables.sGetLocation = LocationEncounters.location_022; NPC_AI.NPC100_CurrentNumLocation = 22; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_022; } if (iRunFromKiller == 23) { Variables.sGetLocation = LocationEncounters.location_023; NPC_AI.NPC100_CurrentNumLocation = 23; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_023; } if (iRunFromKiller == 24) { Variables.sGetLocation = LocationEncounters.location_024; NPC_AI.NPC100_CurrentNumLocation = 24; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_024; } if (iRunFromKiller == 25) { Variables.sGetLocation = LocationEncounters.location_025; NPC_AI.NPC100_CurrentNumLocation = 25; Variables.iCurrentLocation = NPC_AI.NPC100_CurrentNumLocation; NPC_AI.NPC100_CurrentStrLocation = LocationEncounters.location_025; } }
void Start() { Bot = GetComponent <NPC_AI>(); StartCoroutine("FindVisibleTargetsWithDelay", 0.2f); }
// public abstract NPC_BehaviorState NextState(); protected virtual void Start() { npcController = GetComponent<NPC_Controller>(); npcAI = GetComponent<NPC_AI>(); npcStats = GetComponent<NPCStats>(); }
private void Awake() { ai = transform.parent.GetComponentInChildren <NPC_AI>(); }