private void OnTriggerEnter(Collider other) { StudentAI Temp = other.GetComponent <StudentAI>(); if (Temp != null && Temp != Owner && Temp.ChatCooldown <= 0 && Owner.ChatCooldown <= 0 && Owner.ChatEngaged == false && Temp.ChatEngaged == false) { Owner.SocialTarget = Temp; Temp.SocialTarget = Owner; Owner.ChatEngaged = true; Temp.ChatEngaged = true; } }
public StudentAI FindClosetSocialStudent() { StudentAI CloseSocial = null; float Dist = 1000; for (int i = 0; i < School.Students.Length; i++) { float newDist = Vector3.Distance(transform.position, School.Students[i].transform.position); if (newDist < Dist && School.Students[i] != this) { Dist = newDist; CloseSocial = School.Students[i]; } } return(CloseSocial); }
// Use this for initialization void Start() { CurrentRelationshipStatus = RelationshipStatus.Single; Self = GetComponent <StudentAI>(); }
public void ForceInteract(StudentAI Target) { SocialTarget = Target; CurrentState = States.Socialize; }
public void DoConfession() { Agent.SetDestination(SocialTarget.transform.position); if (PSLove.isPlaying == false) { PSLove.Play(); } if (Agent.remainingDistance < 5 && enterChat == false) { Agent.SetDestination(transform.position); enterChat = true; if (!ChatBoxSpawned && !SocialTarget.ChatBoxSpawned) { ChatBoxSpawned = true; PersonTag targetTag = SocialTarget.gameObject.GetComponent <PersonTag>(); PersonTag tag = GetComponent <PersonTag>(); ChatCooldown = 5; //Debug.Log("f**k has occurred"); GameObject NewConvo = Instantiate(PrefabPop, transform.position, Quaternion.identity); ConversationPopup temp = NewConvo.GetComponent <ConversationPopup>(); Person rPerson = Kernal.instance.store.people[SocialTarget.GetComponent <PersonTag>().storeID]; SocialRecord record = null; SocialRecord record2 = null; record = Kernal.instance.store.socialRecords[SocialTarget.GetComponent <PersonTag>().storeID][GetComponent <PersonTag>().storeID]; record2 = Kernal.instance.store.socialRecords[GetComponent <PersonTag>().storeID][SocialTarget.GetComponent <PersonTag>().storeID]; float AVG = record.desire + record2.desire / 2; bool result = (AVG > Random.Range(0, 100)) ? true : false; temp.Feeling = (result) ? 2 : 0; temp.One = this.gameObject; temp.Two = SocialTarget.gameObject; if (result) { if (Partner != null) { Partner.Partner = null; } Partner = SocialTarget; if (Partner.Partner != null) { Partner.Partner = null; } Partner.Partner = this; record.RelationShipStatus = 1; record2.RelationShipStatus = 1; confessed = true; Partner.confessed = false; LoveSource.PlayOneShot(Victory, 2); } Destroy(NewConvo, ChatLength); } SetChatLength = ChatLength; ChatEngaged = false; //Agent.isStopped = true; } if (enterChat == true) { if (SetChatLength <= 0) { PSLove.Stop(); enterChat = false; ChatBoxSpawned = false; // Agent.isStopped = false; NewDestination(); CurrentState = States.Roam; } } SetChatLength -= Time.deltaTime; }