//private void Start() //{ // positiveFeedback = positiveMatchFeedback.GetComponent<Animator>(); //negativeFeedback = negativeMatchFeedback.GetComponent<Animator>(); //} public void SetConversationBar(ConvoSystem a, ConvoSystem b) { CharacterA = a; CharacterB = b; canSelect = true; for (int i = 0; i < CharacterA.chara.likes.Count; i++) { if (CharacterA.chara.likes[i].like) { if (CharacterB.chara.likes[i].like) { CharacterB.chara.Goods++; } chALikes.Add(CharacterA.chara.likes[i]); } } for (int j = 0; j < CharacterB.chara.likes.Count; j++) { if (CharacterB.chara.likes[j].like) { if (CharacterA.chara.likes[j].like) { CharacterA.chara.Goods++; } chBLikes.Add(CharacterB.chara.likes[j]); } } turn = Random.Range(0, 2); StartCoroutine(Conversation()); }
// Use this for initialization void Start() { cam = FindObjectOfType <Camera>(); agent = this.GetComponent <NavMeshAgent>(); convsys = this.GetComponent <ConvoSystem>(); characterCollider = this.GetComponent <CapsuleCollider>(); charactergb = this.GetComponent <Character>(); initialLook = transform.forward; }
void StartNewConversation(ConvoSystem CharacterA, ConvoSystem CharacterB) { AloneList.Remove(CharacterA); AloneList.Remove(CharacterB); int idA = LevelManager.instance.Stools.IndexOf(CharacterA.currentStool); int idB = LevelManager.instance.Stools.IndexOf(CharacterB.currentStool); ConversationBar CB; if (idA < idB) { CB = CurrentConversations[idA]; } else { CB = CurrentConversations[idB]; } CB.gameObject.SetActive(true); CB.SetConversationBar(CharacterA, CharacterB); CharacterA.OnFoundPartner(CharacterB); CharacterB.OnFoundPartner(CharacterA); }
public void OnFoundPartner(ConvoSystem p) { partners.Add(p); transform.LookAt(p.transform); chara.isAvailable = false; }
public void FindMatchs() { Debug.Log(AloneList.Count); Debug.Log("Finding Match..."); eventEmitterRef.Play(); Queue <ConvoSystem> WaitingCustomers = new Queue <ConvoSystem>(); int possibleindex; int timesForLoop = AloneList.Count; for (int i = 0; i < timesForLoop; i++) { do { possibleindex = Random.Range(0, timesForLoop); } while (WaitingCustomers.Contains(AloneList[possibleindex])); WaitingCustomers.Enqueue(AloneList[possibleindex]); } while (WaitingCustomers.Count > 0) { // foreach (ConvoSystem currentCS in AloneList) { int i = Random.Range(0, WaitingCustomers.Count - 1); ConvoSystem currentCS = WaitingCustomers.Dequeue(); if (currentCS.chara.isAvailable) { int stoolIndex = LevelManager.instance.Stools.IndexOf(currentCS.currentStool); bool right = LevelManager.instance.CheckCharacterSide(stoolIndex, true); bool left = LevelManager.instance.CheckCharacterSide(stoolIndex, false); //if both true //Debug.Log("available begin" + currentCS.name); if (right && left) { //Debug.Log("Both Sides" + currentCS.name); int choosenSide = Random.Range(0, 1); switch (choosenSide) { case 0: left = true; right = false; break; case 1: left = false; right = true; break; } } if (left) { // Debug.Log("left Sides" + currentCS.name); ConvoSystem matchPartner = LevelManager.instance.Stools[stoolIndex - 1].convosysAttached; if (!currentCS.partners.Contains(matchPartner)) { StartNewConversation(currentCS, LevelManager.instance.Stools[stoolIndex - 1].convosysAttached); } } else if (right) { //Debug.Log("right Sides" + currentCS.name); ConvoSystem matchPartner = LevelManager.instance.Stools[stoolIndex + 1].convosysAttached; if (!currentCS.partners.Contains(matchPartner)) { StartNewConversation(currentCS, LevelManager.instance.Stools[stoolIndex + 1].convosysAttached); } } } } }
public void WaitingList(ConvoSystem cs) { AloneList.Add(cs); }
public void Occupied(ConvoSystem cvs) { convosysAttached = cvs; isAvailable = false; PosA.GetComponent <SphereCollider>().enabled = false; }