예제 #1
0
파일: Character.cs 프로젝트: Deus0/Zeltex
		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 "";
		}
예제 #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);
			}
		}
예제 #3
0
파일: Quest.cs 프로젝트: Deus0/Zeltex
		public bool CheckCompleted(Character MyCharacter) {
			//IsCompleted = false;
			Inventory MyInventory = MyCharacter.gameObject.GetComponent<Inventory> ();
			if (IsConditionTrue(MyCharacter))
				IsCompleted = true;
			else 
				IsCompleted = false;

			return IsCompleted;
		}
예제 #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);
            }
        }
예제 #5
0
파일: Quest.cs 프로젝트: Deus0/Zeltex
		// 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;
		}
예제 #6
0
파일: Character.cs 프로젝트: Deus0/Zeltex
		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;
		}
예제 #7
0
파일: Character.cs 프로젝트: Deus0/Zeltex
		public void EndTalk(Character ConversationStarter) {
			MySpeechBubble.ToggleSpeech (false);
		}
예제 #8
0
파일: Character.cs 프로젝트: Deus0/Zeltex
		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);
				}*/
			}
		}
예제 #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 ();
        }
예제 #10
0
 public void SetCharacter2(Character MyCharacter2_)
 {
     MyCharacter2 = MyCharacter2_;
 }
예제 #11
0
 public void SetCharacter(Character MyCharacter_)
 {
     //MyCharacter = MyCharacter_;
 }
예제 #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;
        }