void Update() { //możesz to dać nawet w updacie, bo nie można duplikować zadań, jednak lepiej korzystaj z QuestIsExist() dla lepszej wydajności manager.AddQuest("Scroll", "testowe"); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll1", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll2", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll3", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll4", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll5", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll6", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll7", 3); manager.AddTarget("testowe", "TEST SCROLLA!", "scroll8", 3); //sprawdzanie czy "quest1" istnieje if (!manager.QuestIsExist("quest1")) { //Dodawanie questa. //Pierwszy argument to nazwa widoczna w menu. //Drugie to id questa. manager.AddQuest("Nauka Sterowania", "quest1"); //Dodawanie zadania. //Pierwszy argument to id questa. //drugi to napis w menu. //trzeci to id zadania w questcie //czwarty to maksymalny progres manager.AddTarget("quest1", "Nacisnij spacje 5 razy", "spacja", 5); manager.AddTarget("quest1", "Uruchom 2 razy EQ", "eq", 2); } else { //Jeżeli gracz skoczy to dodaj progres. //Pierwszy argument to id questa //Drugi to id zadania //Trzeci to ile progresu ma się dodać if (Input.GetButtonDown("Jump")) { manager.AddProgress("quest1", "spacja", 1); } if (Input.GetButtonDown("Inventory")) { manager.AddProgress("quest1", "eq", 1); } //JESZCZE NIE DZIAŁA //Funkcja będzie zwracać true tylko jeden raz, po tym jak quest zostanie wykonany if (manager.Reward("quest1")) { Debug.Log("zadanie ukończone!"); } } }
void Update() { if (Input.GetKeyDown(KeyCode.G)) { questManager.AddQuest(quests [0].GetComponent <Quest>()); } }
void Update() { if (dialManager.Once("14")) { questManager.AddQuest("Skryba", "Skryba"); questManager.AddTarget("Skryba", "Przynies marchew skrybie", "marchew", 1); questManager.AddTarget("Skryba", "Zdaj mature z polskiego", "polski", 1); } if (questManager.QuestIsExist("Skryba")) { if (dialManager.Once("13")) { questManager.AddProgress("Skryba", "polski", 1); } if (Inventory.instance.EqItemCheck("Marchew") > 0) { questManager.AddProgress("Skryba", "marchew", 1); } } if (questManager.Reward("Skryba")) { questManager.AddQuest("Odnies marchew", "OddajSkrybie"); questManager.AddTarget("OddajSkrybie", "Oddaj marchew skrybie", "marchew", 1); this.GetComponent <CharracterConv>().ID = "14"; } if (questManager.QuestIsExist("OddajSkrybie")) { if (dialManager.ID() == "14") { questManager.AddProgress("OddajSkrybie", "marchew", 1); } } if (questManager.Reward("OddajSkrybie")) { Debug.Log("Quest ukończony"); Inventory.instance.RemoveItem(marchew); Inventory.instance.AddItem(potion); } }
// Start is called before the first frame update // set up all the dialogues and quests void Start() { // in the future, hopefully we can load this using a scriptable object. questManager = GameObject.Find("Canvas").GetComponent <QuestManager>(); questManager.AddQuest("MeetJohnFirstTime"); player.SetDialogue("Intro"); player.TalkOutloud(); John.DisplayTextBubble(); John.SetDialogue("MeetJohnFirstTime"); John.SetQuestDialogueDict("JohnQuestDialogueMap"); }
public static void AddNPC(NPC npc) { int index = QuestManager.Instance.m_NPCList.IndexOf(npc); if (index == -1) { QuestManager.Instance.m_NPCList.Add(npc); Debug.Log("==== Added NPC ===="); Debug.Log(">> " + npc.GetName()); } index = QuestManager.Instance.m_NPCList.IndexOf(npc); QuestManager.SetCurrentQuest(QuestManager.Instance.m_NPCList[index].GetMostRecentQuest()); QuestManager.AddQuest(QuestManager.Instance.m_NPCList[index].GetMostRecentQuest()); }
//==========================// //Awake, Start, Update, Quit// //==========================// private void Start() { Init(); //Make sure all menus are running so init values can be set buildingMenu.SetActive(true); characterMenu.SetActive(true); buildingInfo.SetActive(true); supplyFood = 100; maxVillagers = 0; supplyStone = 100; supplyWood = 100; for (int i = 0; i < 5; i++) { //Create some villagers characterScroll.GetComponent <CharacterDisplay>().AddVillager(SpawnVillager()); } //LoadGame(); //Create new quests int questCount = questManager.GetQuestList().Count; for (int i = 3; i > questCount; i--) { questManager.AddQuest(); } //Close all menus after init buildingMenu.SetActive(false); questMenu.GetComponent <Canvas>().enabled = false; characterMenu.SetActive(false); buildingInfo.SetActive(false); mainUI.SetActive(true); lossPanel.SetActive(false); pauseMenu.SetActive(false); incidentPanel.GetComponentsInChildren <Text>()[0].enabled = false; incidentPanel.GetComponentsInChildren <Text>()[1].enabled = false; }
private void OnGUI() { // Save Control Group GUILayout.BeginHorizontal(); autoSave = GUILayout.Toggle(autoSave, "Auto-Save"); if (!autoSave && GUILayout.Button("Save")) { ManualSave(); } GUILayout.EndHorizontal(); // Quest Creation, Deletion, Editing, and Selection Crontrol Group GUILayout.Label("Editing: " + s_QManager.targetObject.name, EditorStyles.boldLabel); questIndex = EditorGUILayout.Popup("Select Quest: ", questIndex, m_QManager.Quests.Select(x => x.Name).ToArray()); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add Quest", GUILayout.ExpandWidth(true), GUILayout.MinWidth(100), GUILayout.MaxWidth(150))) { m_QManager.AddQuest(); } if (GUILayout.Button("Delete Quest", GUILayout.ExpandWidth(true), GUILayout.MinWidth(100), GUILayout.MaxWidth(150))) { if (questIndex > 0) { m_Quests.DeleteArrayElementAtIndex(questIndex); questIndex--; m_Quest = m_Quest.GetArrayElementAtIndex(questIndex); } else { return; } } EditorGUILayout.EndHorizontal(); // Isolate selected Quest m_Quest = m_Quests.GetArrayElementAtIndex(questIndex); SerializedProperty questName = m_Quest.FindPropertyRelative("Name"); SerializedProperty questDescription = m_Quest.FindPropertyRelative("Description"); SerializedProperty questRewardType = m_Quest.FindPropertyRelative("RewardTypes"); SerializedProperty questReward = m_Quest.FindPropertyRelative("QuestReward"); // Begin Modification Control EditorGUI.BeginChangeCheck(); s_QManager.Update(); // Quest Stage Creation, Deletion, Editing, and Selection Control Group questStageIndex = EditorGUILayout.Popup("Select Quest Stage: ", questStageIndex, m_QManager.Quests[questIndex].QuestStages.Select(x => x.stageName).ToArray()); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add Stage", GUILayout.ExpandWidth(true), GUILayout.MinWidth(100), GUILayout.MaxWidth(150))) { m_QManager.AddStage(m_QManager.Quests[questIndex]); } if (GUILayout.Button("Delete Stage", GUILayout.ExpandWidth(true), GUILayout.MinWidth(100), GUILayout.MaxWidth(150))) { m_QManager.DeleteStage(m_QManager.Quests[questIndex], m_QManager.Quests[questIndex].QuestStages[questStageIndex]); } EditorGUILayout.EndHorizontal(); // Isolate selected Quest Stage IEnumerator questStageEnum = m_Quest.GetEnumerator(); while (questStageEnum.MoveNext()) { SerializedProperty current = questStageEnum.Current as SerializedProperty; if (current.name == "QuestStages") { m_QuestStages = current; break; } } m_QuestStage = m_QuestStages.GetArrayElementAtIndex(questStageIndex); SerializedProperty questStageName = m_QuestStage.FindPropertyRelative("stageName"); SerializedProperty questStageDescription = m_QuestStage.FindPropertyRelative("stageDescription"); SerializedProperty questStageHidden = m_QuestStage.FindPropertyRelative("stageHidden"); SerializedProperty questStageOptional = m_QuestStage.FindPropertyRelative("stageOptional"); InsertGUISpaces(2); EditorGUILayout.LabelField("Quest[" + questIndex + "]: " + m_QManager.Quests[questIndex].Name); EditorGUILayout.PropertyField(questName); EditorGUILayout.PropertyField(questDescription); EditorGUILayout.PropertyField(questReward); InsertGUISpaces(2); EditorGUILayout.LabelField("Stage[" + questStageIndex + "]: " + m_QManager.Quests[questIndex].QuestStages[questStageIndex].stageName); EditorGUILayout.PropertyField(questStageName); EditorGUILayout.PropertyField(questStageDescription); EditorGUILayout.PropertyField(questStageHidden); EditorGUILayout.PropertyField(questStageOptional); EditorGUI.EndChangeCheck(); // End Modification Control // Automatic Saving if (GUI.changed && autoSave) { Undo.RecordObject(s_QManager.targetObject, "save"); s_QManager.ApplyModifiedProperties(); EditorUtility.SetDirty(s_QManager.targetObject); AssetDatabase.SaveAssets(); Debug.LogWarning("Auto-Saved: " + s_QManager.targetObject.name); } }
public override void LargeLoadContent(object sender) { var Content = gameRef.Content; background = new DrawableRectangle(gameRef.GraphicsDevice, new Vector2(10, 10), Color.Black, true).Texture; levelManager = new LevelManager(gameRef); Camera.Initialize(Vector2.Zero, new Rectangle(0, 0, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT), new Vector2(LevelManager.CurrentLevel.WidthInPixels, LevelManager.CurrentLevel.HeightInPixels)); Camera.MaxClamp -= new Vector2(Camera.View.Width / 2, Camera.View.Height / 2); entityManager = new EntityManager(gameRef); if (!loadedGame) { EntityManager.Player.Name = Config.currentlyPlaying; if (LevelManager.CurrentLevel.PlayerSpawnPoint.X > -1 && LevelManager.CurrentLevel.PlayerSpawnPoint.Y > -1) { EntityManager.Player.Position = new Vector2(LevelManager.CurrentLevel.PlayerSpawnPoint.X, LevelManager.CurrentLevel.PlayerSpawnPoint.Y) * Engine.TileWidth; } } else { Config.SetLastLogin(loadedProps.Name); Config.currentlyPlaying = loadedProps.Name; EntityManager.Player.LoadFromData(loadedProps); } new Pathfinder(LevelManager.CurrentLevel); #region Pause_Normal pauseControls_Normal = new ControlManager(gameRef, gameRef.Content.Load <SpriteFont>("Fonts\\default")); { Label lblPauseDisplay = new Label() { Name = "lblPauseDisplay", Text = "P A U S E D", Color = Color.White }; lblPauseDisplay.Position = new Vector2(MainGame.GAME_WIDTH / 2 - lblPauseDisplay.Width / 2, MainGame.GAME_HEIGHT / 1.8f - lblPauseDisplay.Height - 10); var back = new LinkLabel(1) { Name = "lnklblBack", Text = "Resume" }; var save = new LinkLabel(2) { Name = "lnklblSave", Text = "Save Game" }; var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit to Menu" }; pauseControls_Normal.Add(lblPauseDisplay); pauseControls_Normal.Add(back); pauseControls_Normal.Add(save); pauseControls_Normal.Add(quit); Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f); foreach (Control c in pauseControls_Normal) { if (c is LinkLabel) { var l = (LinkLabel)c; var offset = new Vector2(c.Width / 2, 0); c.Position = startPos - offset; c.Selected += new EventHandler(LinkLabel_Selected); c.Effect = ControlEffect.PULSE; c.Color = Color.Black; l.OnMouseIn += LinkLabel_OnMouseIn; startPos.Y += c.Height + 10f; } } } #endregion #region Pause_Save pauseControls_Save = new ControlManager(gameRef, gameRef.Content.Load <SpriteFont>("Fonts\\default")); Label status = new Label(); status.AutoSize = true; status.Text = "Save game success!"; status.Position = new Vector2(MainGame.GAME_WIDTH / 2 - status.Width / 2, MainGame.GAME_HEIGHT / 2 - status.Height); pauseControls_Save.Add(status); LinkLabel goBack_Save = new LinkLabel(0); goBack_Save.AutoSize = true; goBack_Save.Text = "Go Back"; goBack_Save.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Save.Width / 2, status.Position.Y + status.Height + 10); goBack_Save.Selected += (o, e) => { pauseState = State_Paused.Normal; }; goBack_Save.OnMouseIn += LinkLabel_OnMouseIn; pauseControls_Save.Add(goBack_Save); #endregion #region Pause_Quit pauseControls_Quit = new ControlManager(gameRef, gameRef.Content.Load <SpriteFont>("Fonts\\default")); Label areYouSure1 = new Label(); areYouSure1.Name = "lblAreYouSure?"; areYouSure1.Text = "Are you sure you want to quit?"; areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString( areYouSure1.Text).X / 2, 140); pauseControls_Quit.Add(areYouSure1); LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" }; yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50); yes.OnMouseIn += LinkLabel_OnMouseIn; yes.Selected += (o, e) => { SwitchStateWithFade(new MainMenuState(gameRef, StateManager)); }; yes.Effect = ControlEffect.PULSE; LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" }; no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y); no.OnMouseIn += LinkLabel_OnMouseIn; no.Selected += (o, e) => { pauseState = State_Paused.Normal; }; no.Effect = ControlEffect.PULSE; pauseControls_Quit.Add(yes); pauseControls_Quit.Add(no); #endregion blurOverlay = new GaussianBlur(gameRef); renderTargetWidth = MainGame.GAME_WIDTH; renderTargetHeight = MainGame.GAME_HEIGHT; blurOverlay.ComputeKernel(7, 2.0f); mainTarget = new RenderTarget2D(gameRef.GraphicsDevice, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT); target1 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false, gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); target2 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false, gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); blurOverlay.ComputeOffsets(renderTargetWidth, renderTargetHeight); quests = new QuestManager(); Quest q = new Quest(0, (QuestGiver)EntityManager.Npcs[0], EntityManager.Player); q.CheckSuccess += (delegate() { return(EntityManager.Player.NoClip == true); }); quests.AddQuest(q); ((QuestGiver)EntityManager.Npcs[0]).Quest = q; ((QuestGiver)EntityManager.Npcs[0]).OnQuestCompleted += (delegate(object sender2, EventArgs args) { var questGiverSender = (QuestGiver)sender2; questGiverSender.Dialogues[0] = "Good job!"; }); base.LargeLoadContent(sender); }
public void AcceptQuest() { QuestManager.AddQuest(quest); }