コード例 #1
0
ファイル: Person.cs プロジェクト: connellyj/HousingCrisis
    // Stalls the person at its goal house
    protected virtual IEnumerator Stall()
    {
        if (HouseManager.houses.ContainsKey(goalIndex))
        {
            House h = HouseManager.houses[goalIndex];
            if (h.HasAvailableStallSpace())
            {
                MoveToPosition(h.AddStalledPerson(this));
                stalledAt.Add(h);
                yield return(new WaitForSeconds(stallTime));

                h.RemoveStalledPerson(this);
                stalledAt.Remove(h);
                if (spriteRenderer.color == storeColor)
                {
                    UnHighlight();
                }
                CompletePath();
            }
            else
            {
                CompletePath();
            }
        }
        else
        {
            CompletePath();
        }
    }
コード例 #2
0
 // If the targeted house exists and has open space, go attack it
 protected override void Attack()
 {
     if (HouseManager.houses.ContainsKey(goalIndex))
     {
         House h = HouseManager.houses[goalIndex];
         if (h.HasAvailableStallSpace())
         {
             MoveToPosition(h.AddStalledPerson(this));
             stalledAt.Add(h);
             StartCoroutine(Shoot(h));
         }
         else
         {
             CompletePath();
         }
     }
     else
     {
         CompletePath();
     }
 }