void Start() { numOfQuestPrivate = 0;//modifyc numOfItemsPrivate = 0; dialoguesManager = GameObject.Find("DIALOGUES_MANAGER"); if (dialoguesManager) { try { fillQuestText(dialoguesManager.GetComponent <Dialogues>().GetDictionary(this.getNpcName()).ToArray()); fillDoneQuestText(dialoguesManager.GetComponent <Dialogues>().GetDictionary(this.getNpcName() + "R").ToArray()); } catch (Exception ex) { } } //number_of_quests = questTexts.Length; last_quest_done = 0; stateOfQuest = MyStateOfQuest.haveQuests; if (stateOfQuest == MyStateOfQuest.haveQuests) { SetColorOfHalo(YELLOW_COLOR); } else if (stateOfQuest == MyStateOfQuest.noMoreQuests) { SetColorOfHalo(GREEN_COLOR); } }
public string GetText() { CheckInfo(); if (last_quest_done >= this.questTexts.Length) { return("NONE"); } if (this.stateOfQuest == MyStateOfQuest.questOnProgress) { return(" Ya estás en esta misión"); } else if (this.stateOfQuest == MyStateOfQuest.questDone) { string beforesum = this.responseTexts[last_quest_done]; if (last_quest_done + 1 < this.questTexts.Length)//si se sale es que no hay más, no se suma y se deja siempre la respuesta. { last_quest_done++; this.stateOfQuest = MyStateOfQuest.haveQuests;//hay más misioneS } else { CheckNextQuestOnOtherGO(); } return(beforesum); //si está hecha, mirar texto respuesta o si tiene más, darla. } return(this.questTexts[last_quest_done]); }
private void StartInstantiateQuest(int numOfQuest) { this.stateOfQuest = MyStateOfQuest.questOnProgress; string[] arr = dialoguesManager.GetComponent <Dialogues>().GetDictionary(this.getNpcName() + "I").ToArray(); for (int i = 0, j = 1, y = 2; y < arr.Length;) { GameObject go = Instantiate(this.goToInstantiate[numOfQuest]); go.transform.position = new Vector3(float.Parse(arr[i].ToString()), float.Parse(arr[j].ToString()), float.Parse(arr[y].ToString())); go.AddComponent <BoxCollider>(); go.GetComponent <BoxCollider>().isTrigger = true; go.AddComponent <ItemsQuest>(); go.GetComponent <ItemsQuest>().SetIsQuest(true); go.GetComponent <ItemsQuest>().SetName(goToInstantiate.ToString()); GameObject goParticles = Instantiate(this.particles, go.transform.position, go.transform.rotation); goParticles.transform.parent = go.transform; i = i + 3; j = j + 3; y = y + 3; //se setea un tag de "item_quest_nameOfQuest", cuando el jugador lo detecta, mira a que mision pertenece y suma lo pertinente en el script } target.gameObject.GetComponentInChildren <CanvasItemsUIQuest>().SetText(this.goToInstantiate[numOfQuest].name); target.gameObject.GetComponentInChildren <CanvasItemsUIQuest>().SetTotal((arr.Length / 3)); numOfQuestPrivate = numOfQuest; numOfItemsPrivate = arr.Length / 3; }
public void StartMision() { if (this.stateOfQuest == MyStateOfQuest.questOnProgress || this.stateOfQuest == MyStateOfQuest.questDone) { return; } current_state = true; this.stateOfQuest = MyStateOfQuest.questOnProgress; SetColorOfHalo(BLUE_COLOR); switch (option) { case MyEnumeratedType.isQuestInstantiate: StartInstantiateQuest(last_quest_done); break; case MyEnumeratedType.isQuestToCollect: GivePlayerItem(); StartActiveItemPersist(); StartActiveItemForCollect(); break; case MyEnumeratedType.isQuestTokill: ActiveAndDeactiveArray(); enemyManager.GetComponent <EnemyZoneManager>().StartToSpawn(); enemyManager.GetComponent <EnemyZoneManager>().StopToSpawn(); break; case MyEnumeratedType.isQuestToTalk: StartActiveItemPersist(); GivePlayerItem(); break; case MyEnumeratedType.specialQuest: goToActivate[0].GetComponent <SpecialScript>().DoSomething(); break; } }
private void CheckInfo() { //En que punto de la quest estoy //Modificar color a verde si acabada, amarilla si hay mas, azul progreso switch (this.stateOfQuest) { case MyStateOfQuest.haveQuests: fillTextQuest(); SetColorOfHalo(YELLOW_COLOR); break; case MyStateOfQuest.questDone: case MyStateOfQuest.noMoreQuests: SetColorOfHalo(GREEN_COLOR); break; case MyStateOfQuest.questOnProgress: switch (option) { case MyEnumeratedType.isQuestInstantiate: { int n = target.GetComponentInChildren <InventoryPlayer>().GetCountItemFromInventoryQuest(this.goToInstantiate[numOfQuestPrivate].name); //if (5 == numOfItemsPrivate) if (n == numOfItemsPrivate) { this.stateOfQuest = MyStateOfQuest.questDone; SetColorOfHalo(GREEN_COLOR); target.gameObject.GetComponentInChildren <CanvasItemsUIQuest>().SetText(""); } } break; case MyEnumeratedType.isQuestToCollect: int n1 = target.GetComponentInChildren <InventoryPlayer>().GetCountItemFromInventoryQuest(this.goToInstantiate[numOfQuestPrivate].name); //if (1 == 1) if (n1 == numOfItemsPrivate) { this.stateOfQuest = MyStateOfQuest.questDone; SetColorOfHalo(GREEN_COLOR); ActiveAndDeactiveArray(); target.gameObject.GetComponentInChildren <CanvasItemsUIQuest>().SetText(""); } break; case MyEnumeratedType.isQuestToTalk: { SetColorOfHalo(GREEN_COLOR); this.stateOfQuest = MyStateOfQuest.questDone; target.gameObject.GetComponentInChildren <CanvasItemsUIQuest>().SetText(""); ActiveAndDeactiveArray(); if (flagToDo) { this.gameObject.SetActive(false); } } break; case MyEnumeratedType.isQuestTokill: { if (enemyManager.GetComponent <EnemyZoneManager>().TotallySpawns() == enemyManager.GetComponent <EnemyZoneManager>().TotallyKillSpawns()) { SetColorOfHalo(GREEN_COLOR); this.stateOfQuest = MyStateOfQuest.questDone; target.gameObject.GetComponentInChildren <CanvasItemsUIQuest>().SetText(""); } } break; } break; } }