Beispiel #1
0
 public void RepairPart(ScarecrowPartType partType, int amount)
 {
     if (_parts.ContainsKey(partType))
     {
         _parts[partType].Repair(amount);
     }
 }
Beispiel #2
0
    public void DamagePart(ScarecrowPartType partType, int amount)
    {
        if (_parts.ContainsKey(partType))
        {
            _parts[partType].Damage(amount);
        }

        if (partType == ScarecrowPartType.Peg && _parts[partType].State == ScarecrowPartState.Ruined)
        {
            transform.Find("Sprites").Find("Dead").GetComponent <SpriteRenderer>().enabled = true;
        }

        if (_parts.Values.All(p => p.State == ScarecrowPartState.Ruined))
        {
            state = ScarecrowState.Dead;
        }
    }