private INPC CreateNPC(String type, Vector2 startingPos, String text) { INPC newEnemy = new OldManNPC(game, startingPos, text); switch (type) { case "OldMan": newEnemy = new OldManNPC(game, startingPos, text); break; case "MedicineWoman": newEnemy = new MedicineWomanNPC(game, startingPos); break; case "Merchant": newEnemy = new MerchantNPC(game, startingPos); break; case "Flame": newEnemy = new FlameNPC(game, startingPos); break; case "RickRoll": newEnemy = new RickRollNPC(game, startingPos); break; default: break; } return(newEnemy); }
/// <summary> /// Used to spawn a custom npc just as an example. Don't keep this code. /// GENERATE NPC AND CALL THE CODE /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveEvents_LoadChar(object sender, EventArgs e) { ExtendedNPC myNpc3 = assetPool.generateNPC(Genders.female, 0, 1, new StandardColorCollection(null, null, Color.Blue, null, Color.Yellow, null)); MerchantNPC merch = new MerchantNPC(new List <Item>() { new StardewValley.Object(475, 999) }, myNpc3); npcTracker.addNewNPCToLocation(Game1.getLocationFromName("BusStop", false), merch, new Vector2(2, 23)); }
/// <summary> /// Method for merchant dialogue. /// </summary> /// <param name="merchantNpc">Merchant npc.</param> /// <param name="merchant">Merchant.</param> /// <param name="product">Product.</param> /// <param name="price">Price.</param> /// <param name="kcal">Kcal.</param> public void MerchantDialogue(MerchantNPC merchantNpc, string merchant, string product, int price, int kcal) { if (!isActive) { isActive = true; this.merchantNPC = merchantNpc; dialogueButtons.SetActive(false); dialogueButtonsSell.SetActive(true); dialogueOkButton.SetActive(false); currentNpc = merchant; dialgueName.text = merchant + ":"; dialogueText.text = dialogueMap.GetDialogue(merchant + DialogueMap.DEFAULT); locked = true; isLocked = true; this.productPrice = price; this.productKcal = kcal; } }
/// <summary> /// Raises the trigger exit2 d event. /// </summary> /// <param name="other">Other.</param> void OnTriggerExit2D(Collider2D other) { if (other.gameObject.GetComponent <InteractiveNPC> ()) { InteractiveNPC npcCheck = other.gameObject.GetComponent <InteractiveNPC> (); if (npcCheck.talks) { currentIntreactiveNPC.StopTalk(); currentIntreactiveNPC = null; iButton.color = Color.white; } } if (other.gameObject.GetComponent <GenericNPC> ()) { GenericNPC npcCheck = other.gameObject.GetComponent <GenericNPC> (); if (npcCheck.talks) { currentGenericNpc.StopTalk(); currentGenericNpc = null; iButton.color = Color.white; } } if (other.gameObject.GetComponent <QuestNPC> ()) { QuestNPC npcCheck = other.gameObject.GetComponent <QuestNPC> (); currentQuestNpc.StopTalk(); currentQuestNpc = null; iButton.color = Color.white; } if (other.gameObject.GetComponent <MerchantNPC> ()) { MerchantNPC npcCheck = other.gameObject.GetComponent <MerchantNPC> (); currentMerchant.StopTalk(); currentMerchant = null; iButton.color = Color.white; } }
/// <summary> /// Raises the trigger enter2 d event. /// </summary> /// <param name="other">Other.</param> void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.GetComponent <GenericNPC> ()) { currentGenericNpc = other.gameObject.GetComponent <GenericNPC> (); iButton.color = Color.green; } if (other.gameObject.GetComponent <QuestNPC> ()) { currentQuestNpc = other.gameObject.GetComponent <QuestNPC> (); iButton.color = Color.green; } if (other.gameObject.GetComponent <MerchantNPC> ()) { currentMerchant = other.gameObject.GetComponent <MerchantNPC> (); iButton.color = Color.green; } //Hospial door out if (other.gameObject.name.Equals("Door") && dManager.ObjectiveStatus > 0) { gameController.ChangeScene("hospital", "city", 84f, -72.5f); if (dManager.ObjectiveStatus == 1) { dManager.ObjectiveStatus += 1; gameController.ChangeObjective("Find a way to sell your meds"); dManager.Dialogue("Me", "I should go see my buddy at southwest from here. That junkie definitely buys this shit."); } } else if (other.gameObject.name.Equals("Door") && dManager.ObjectiveStatus == 0) { currentIntreactiveNPC = other.gameObject.GetComponent <InteractiveNPC> (); npc = currentIntreactiveNPC.hospitalDoor; currentIntreactiveNPC.Talk(npc, currentIntreactiveNPC); } if (other.gameObject.name.Equals("Hospital_Door")) { gameController.ChangeScene("city", "hospital", 7f, -17f); } //FastFood door 1 in if (other.gameObject.name.Equals("FastFood_1_Door")) { gameController.ChangeScene("city", "fastfood", 0f, -2.5f); } //FastFood door 1 out if (other.gameObject.name.Equals("FastFood_1_Door_Out")) { gameController.ChangeScene("fastfood", "city", 74f, -88.6f); } //FastFood door 2 in if (other.gameObject.name.Equals("FastFood_2_Door")) { gameController.ChangeScene("city", "fastfood2", 6f, -2.7f); } //FastFood door 2 out if (other.gameObject.name.Equals("FastFood_2_Door_Out")) { gameController.ChangeScene("fastfood2", "city", 82f, -88.6f); } //FastFood door 3 in if (other.gameObject.name.Equals("FastFood_3_Door")) { gameController.ChangeScene("city", "fastfood3", -2f, -17.5f); } //FastFood door 3 Out if (other.gameObject.name.Equals("FastFood_3_Door_Out")) { gameController.ChangeScene("fastfood3", "city", 24.5f, -53.5f); } //FastFood door 4 in if (other.gameObject.name.Equals("FastFood_4_Door")) { gameController.ChangeScene("city", "fastfood4", -2f, -17.5f); } //FastFood door 4 Out if (other.gameObject.name.Equals("FastFood_4_Door_Out")) { gameController.ChangeScene("fastfood4", "city", 37.3f, -53.5f); } //FastFood door 5 in if (other.gameObject.name.Equals("FastFood_5_Door")) { gameController.ChangeScene("city", "fastfood5", 0f, -1.2f); } //FastFood 5 out if (other.gameObject.name.Equals("FastFood_5_Door_Out")) { gameController.ChangeScene("fastfood5", "city", 52f, -89.5f); } //Restaurant door in if (other.gameObject.name.Equals("Restaurant_Door")) { gameController.ChangeScene("city", "restaurant", -4.5f, -12.5f); } //Restaurant out if (other.gameObject.name.Equals("Restaurant_Door_Out")) { gameController.ChangeScene("restaurant", "city", 108f, -74.5f); } //coin if (other.gameObject.name.Equals("Coin")) { gameController.player.wallet.AddMoney(150); Destroy(other.gameObject); } //merchant in fasfood1 if (other.gameObject.name.Equals("FastFoodMerchant")) { iButton.color = Color.green; currentIntreactiveNPC = other.gameObject.GetComponent <InteractiveNPC> (); npc = currentIntreactiveNPC.FastFoodJoe; } if (other.gameObject.name.Equals("BurgerBob")) { iButton.color = Color.green; currentIntreactiveNPC = other.gameObject.GetComponent <InteractiveNPC> (); npc = currentIntreactiveNPC.BurgerBob; } if (other.gameObject.name.Equals("DrugBuyer")) { iButton.color = Color.green; currentIntreactiveNPC = other.gameObject.GetComponent <InteractiveNPC> (); npc = currentIntreactiveNPC.DrugBuyer; } if (other.gameObject.name.Equals("objectiveVegan")) { iButton.color = Color.green; currentIntreactiveNPC = other.gameObject.GetComponent <InteractiveNPC> (); npc = currentIntreactiveNPC.MaleVegan; if (StaticObjects.FREE_CHEESEBURGER) { currentIntreactiveNPC.ChangeDialogueStatus(npc, "Hi I'm Vegan\n\n\"Beat him?\"", true, false); } } }