public void ShowHintAbout(AiPerson target, float hintHash) { if (isWaiter) { Hint.ShowWineHint(); } else if (isPianist) { Hint.ShowMusicHint(); } else { int index = (int)(hintHash % 3f); if (index == 0) { Hint.ShowClothesHint(target.BodyConfig.Clothes); } else if (index == 1) { Hint.ShowHatHint(target.BodyConfig.Hat); } else if (index == 2) { Hint.ShowGlassesHint(target.BodyConfig.Glasses); } else { throw new Exception("Shouldnt get here"); } } }
public void InfectMe(AiPerson infectedBy) { IsInfected = true; InfectedBy = infectedBy; infectedTotalTime = Time.time; infectedTime = UnityEngine.Random.Range(InfectMinTime, InfectMaxTime); tearPaper.Play(); name += " (Infected)"; Debug.Log("Infected", this); }
public void onOtherJoinConversation(AiPerson joiner) { if (talkedTo.Contains(joiner)) { talkedTo.Remove(joiner); } talkedTo.Add(joiner); lastMetTotalTime = Time.time; }
public virtual void Join(AiPerson participant) { if (!Reserved.Remove(participant)) { throw new System.IndexOutOfRangeException("Participant's spot was not reserved"); } Participants.Add(participant); notifyJoined(participant); }
public virtual bool Reserve(AiPerson participant) { if (!CanJoin(participant)) { return(false); } Reserved.Add(participant); return(true); }
protected void notifyJoined(AiPerson joiner) { foreach (var existing in Participants) { if (existing != joiner) { joiner.onOtherJoinConversation(existing); existing.onOtherJoinConversation(joiner); } } }
private void InfectParticipant(Activity searchIn) { var activityRadius = Vector3.Distance(transform.position, activity.transform.position); var playerDistance = Vector3.Distance(transform.position, player.transform.position); if (playerDistance < activityRadius + 1) { return; //player is in viscinity } AiPerson target = (searchIn.Participants .Where((p) => !p.IsInfected && p != this) .ToArray() .GetRandomItem()); if (target == null) { return; } target.InfectMe(this); }
public virtual bool Leave(AiPerson participant) { return(Participants.Remove(participant)); }
public virtual bool CanJoin(AiPerson participant) { return((Participants.Count + Reserved.Count < MaxParticipants) && !Participants.Contains(participant)); }