Ejemplo n.º 1
0
		public string GiveCharacterQuest(string QuestName, Character MyQuestTaker) {
			int QuestIndex = -1;
			for (int i = 0; i < MyQuests.Count; i++) {
				if (MyQuests[i].Name == QuestName) {
					QuestIndex = i;
					i = MyQuests.Count;
				}
			}
			if (QuestIndex == -1)
				return "!";

			if (QuestIndex < MyQuests.Count && QuestIndex >= 0) {
				Quest NewQuest = MyQuests [QuestIndex];
				if (!MyQuestTaker.MyQuests.Contains (NewQuest)) {
					MyQuestTaker.MyQuests.Add (NewQuest);
					//Debug.LogError("Adding quest: " + MyCharacter.MyQuests[QuestIndex].Name);
					if (MyQuestTaker.MyQuestLogGui) {
						MyQuestTaker.MyQuestLogGui.AddQuestGui (NewQuest.Name);
					}
					NewQuest.QuestGiver = this;
					NewQuest.QuestTaker = MyQuestTaker;
					MyQuestTaker.CheckQuestComplete();
					return NewQuest.Name;
				}
			}
			return "";
		}
Ejemplo n.º 2
0
		// Use this for initialization
		void Awake () {
			MyFile = gameObject.name;
			MyCharacter = gameObject.GetComponent<Character> ();
			if (MyFile != "") {
				//SpeechData.PrintText("Loading from: " + MyFile);
				HasLoaded = SpeechFileReader.ReadDialogue(MyFile, this);
			}
		}
Ejemplo n.º 3
0
		public bool CheckCompleted(Character MyCharacter) {
			//IsCompleted = false;
			Inventory MyInventory = MyCharacter.gameObject.GetComponent<Inventory> ();
			if (IsConditionTrue(MyCharacter))
				IsCompleted = true;
			else 
				IsCompleted = false;

			return IsCompleted;
		}
Ejemplo n.º 4
0
        public void BeginDialogue(Character ConversationStarter)
        {
            // Now have speech bubbles pop up
            if (MySpeechBubble.CanTalk() && ConversationStarter.GetSpeechHandler().CanTalk())
            {
                /*if (gameObject.GetComponent<Wander>()) {
                    gameObject.GetComponent<Wander>().ToggleWander(false);
                    gameObject.GetComponent<Movement>().LookAt(ConversationStarter.gameObject);
                }*/
                MySpeechBubble.StartConversation(ConversationStarter, this);

                OnBeginTalking.Invoke();
                if (OnBeginTalkingSound != null)
                    MySource.PlayOneShot (OnBeginTalkingSound);
            }
        }
Ejemplo n.º 5
0
		// checks conditions
		// uses statistics, inventory classes
		public bool IsConditionTrue(Character MyCharacter) {
			// inventory condition checks
			if (DecodedCondition.IsInventory) {
				Inventory MyInventory = MyCharacter.gameObject.GetComponent<Inventory> ();
				//if (MyInventory.MyItems.Count > 0) return true;
				for (int i = 0; i < MyInventory.MyItems.Count; i++) {
					if (MyInventory.MyItems [i].Name == DecodedCondition.ItemName) {
						if (MyInventory.MyItems [i].Quantity >= DecodedCondition.ItemQuantity)
							return true;
					}
				}
			}
			else // if not inventory, check if it's already been completed
			{
				if (IsCompleted)
					return IsCompleted;
			}
			// area in condition

			// 

			return false;
		}
Ejemplo n.º 6
0
		public int RemoveQuest(string QuestName, Character MyQuestGiver) {
			{
				//if (QuestIndex < MyQuests.Count && QuestIndex >= 0) {
				//	QuestIndex = -1;
				int QuestIndex = -1;
				for (int i = 0; i < MyQuests.Count; i++) {
					if (MyQuests[i].Name == QuestName) {
						QuestIndex = i;
						i = MyQuests.Count;
					}
				}
				// if no quest of same name found
				if (QuestIndex == -1)
					return -1;
				Quest MyQuest = MyQuests[QuestIndex];
				if (MyQuest.IsCompleted) {
					//Debug.LogError (name + " Removeing quest: " + QuestIndex);
					MyQuests.RemoveAt (QuestIndex);
					MyQuestLogGui.RemoveQuest(QuestIndex);
					return QuestIndex;
				}
			}
			return -1;
		}
Ejemplo n.º 7
0
		public void EndTalk(Character ConversationStarter) {
			MySpeechBubble.ToggleSpeech (false);
		}
Ejemplo n.º 8
0
		public void BeginDialogue(Character ConversationStarter) {
			// Now have speech bubbles pop up
			if (MySpeechBubble.CanTalk()) 
			{
				if (gameObject.GetComponent<Wander>()) {
					gameObject.GetComponent<Wander>().ToggleWander(false);
					gameObject.GetComponent<Movement>().LookAt(ConversationStarter.gameObject);
				}
				ConversationStarter.MySpeechBubble.SetCharacter2(this);
				ConversationStarter.MySpeechBubble.SetSecondaryTalker();
				MySpeechBubble.SetCharacter2(ConversationStarter);
				MySpeechBubble.ToggleSpeech (true, false);
				MySpeechBubble.SetMainTalker();
				MySpeechBubble.Activate ();
				/*if (gameObject.GetComponent<FaceUpdate>()) 
				{
					gameObject.GetComponent<FaceUpdate>().SetAnimation(3);
				}*/
			}
		}
Ejemplo n.º 9
0
        // example: the player starts the conversation, second character is the npc
        public void StartConversation(Character FirstCharacter, Character SecondCharacter)
        {
            //Debug.LogError ("Inside of: " + name + " - at: " + Time.time);
            //Debug.LogError ("Char1: " + FirstCharacter.name + " - Char2: " + SecondCharacter.name);
            FirstCharacter.GetSpeechHandler().SetCharacter2(SecondCharacter);
            FirstCharacter.GetSpeechHandler().SetSecondaryTalker();
            FirstCharacter.GetSpeechHandler ().IsTalking = true;

            SetCharacter2(FirstCharacter);
            ToggleSpeech (true, false);
            SetMainTalker();
            Activate ();
        }
Ejemplo n.º 10
0
 public void SetCharacter2(Character MyCharacter2_)
 {
     MyCharacter2 = MyCharacter2_;
 }
Ejemplo n.º 11
0
 public void SetCharacter(Character MyCharacter_)
 {
     //MyCharacter = MyCharacter_;
 }
Ejemplo n.º 12
0
        // when player is handing in a quest
        public int RemoveQuest(string QuestName, Character MyQuestGiver)
        {
            int QuestIndex = -1;
            for (int i = 0; i < MyQuests.Count; i++) {
                if (MyQuests[i].Name == QuestName) {
                    QuestIndex = i;
                    i = MyQuests.Count;
                }
            }
            // if no quest of same name found
            if (QuestIndex == -1)
                return -1;
            Quest MyQuest = MyQuests[QuestIndex];
            if (MyQuest.IsCompleted && !MyQuest.IsHandedIn) {
                //Debug.LogError (name + " Removeing quest: " + QuestIndex);
                MyQuest.HandIn();
                RefreshQuestsGui();		// refresh gui
                //MyQuests.RemoveAt (QuestIndex);
                //MyQuestLogGui.RemoveAt(QuestIndex);

                if (OnHandInQuestSound != null)
                    MySource.PlayOneShot (OnHandInQuestSound);
                return QuestIndex;
            }
            return -1;
        }