Ejemplo n.º 1
0
    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");
            }
        }
    }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
    public void onOtherJoinConversation(AiPerson joiner)
    {
        if (talkedTo.Contains(joiner))
        {
            talkedTo.Remove(joiner);
        }

        talkedTo.Add(joiner);
        lastMetTotalTime = Time.time;
    }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
    public virtual bool Reserve(AiPerson participant)
    {
        if (!CanJoin(participant))
        {
            return(false);
        }

        Reserved.Add(participant);
        return(true);
    }
Ejemplo n.º 6
0
 protected void notifyJoined(AiPerson joiner)
 {
     foreach (var existing in Participants)
     {
         if (existing != joiner)
         {
             joiner.onOtherJoinConversation(existing);
             existing.onOtherJoinConversation(joiner);
         }
     }
 }
Ejemplo n.º 7
0
    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);
    }
Ejemplo n.º 8
0
 public virtual bool Leave(AiPerson participant)
 {
     return(Participants.Remove(participant));
 }
Ejemplo n.º 9
0
 public virtual bool CanJoin(AiPerson participant)
 {
     return((Participants.Count + Reserved.Count < MaxParticipants) && !Participants.Contains(participant));
 }