Exemplo n.º 1
0
    //--------------------------------------------------------------------------------------------------------
    public void GainInjury(BodyHitLocation location)
    {
        InjuryData injury = injuryChart.GetRandomInjury(location);

        Injuries.Add(injury);

        Debug.Log(hostUnit.UnitData.DisplayName + ": New " + location + " injury gained: " + injury.Name + " (" +
                  injury.Description + ").");
    }
Exemplo n.º 2
0
    //--------------------------------------------------------------------------------------------------------
    public void TakeDamage(BodyHitLocation location, int amount)
    {
        foreach (var region in regions.Where(region => region.HitLocation == location))
        {
            region.CurrentHealth = Mathf.Max(region.CurrentHealth - amount, 0);
            Debug.Log(hostUnit.UnitData.DisplayName + ": " + amount + " damage taken to " + location);

            if (region.CurrentHealth == 0)
            {
                GainInjury(location);
            }

            // if we have 3 injuries, die
            if (Injuries.Count >= 3)
            {
                hostUnit.Die();
            }
        }
    }
Exemplo n.º 3
0
    //----------------------------------------------------------------------------------------------
    public InjuryData GetRandomInjury(BodyHitLocation hitLocation)
    {
        List <InjuryData> locInjuries = Injuries.Where(injury => injury.HitLocation == hitLocation).ToList();

        return(locInjuries[Random.Range(0, locInjuries.Count - 1)]);
    }
Exemplo n.º 4
0
 //--------------------------------------------------------------------------------------------------------
 public int GetMaxtHealth(BodyHitLocation location)
 {
     return(regions.Where(region => region.HitLocation == location).Select(region => region.MaxHealth).FirstOrDefault());
 }
Exemplo n.º 5
0
    //--------------------------------------------------------------------------------------------------------
    public void TakeDamage(int amount)
    {
        BodyHitLocation randomHitLoc = regions[Random.Range(0, regions.Count)].HitLocation;

        TakeDamage(randomHitLoc, amount);
    }