/// <summary> /// Constructor /// </summary> /// <param name="objectWithHealth">The object to control</param> /// <param name="normalColor">Shader when status is 'normal'</param> /// <param name="hurtingColor">Shader when status is 'hurting'</param> /// <param name="maxHealth">Maximum health</param> /// <param name="damageTakingTimerMax">How often this object is allowed to take damage</param> public HealthAndDyingBehaviourController(IObjectWithHealth objectWithHealth, Color normalColor, Color hurtingColor, int maxHealth, float damageTakingTimerMax) { _objectWithHealth = objectWithHealth; _normalColor = normalColor; _hurtingColor = hurtingColor; Health = maxHealth; // Assuming we start at full health Dead = false; // Assuming we start alive _damageTakingTimerMax = damageTakingTimerMax; _timeSinceLastHit = damageTakingTimerMax; }
// Mocks private static HealthAndDyingBehaviourController GetHealthAndDyingMock(IObjectWithHealth mock) { return(new HealthAndDyingBehaviourController(mock, Color.white, Color.red, MaxHealth, DamageTakingTimerMax)); }