// TODO: Add cold/hot animation, Add feedback: Cold breath, sweat. private void ApplyTemperatureEffect() { float adjustedTemperature = (Temperature > 0) ? Temperature - _actor.Statistics.CurrentStatistics[StatisticType.HEAT_RESISTANCE] : Temperature - _actor.Statistics.CurrentStatistics[StatisticType.COLD_RESISTANCE]; Debug.Log("Adjusted Temperature: " + adjustedTemperature); // TODO replace this by CONSTANT if (adjustedTemperature > 25) { StatusEffectScheduler.Instance(_actor.Guid).AddStatusEffect(new StatusEffectSystem.Status(_actor, 0.5f, StatusEffectManager.GetStatusEffectData("Hot"))); } else { // TODO check if there is a hot status effect, if so remove it. } if (adjustedTemperature < 0) { StatusEffectScheduler.Instance(_actor.Guid).AddStatusEffect(new StatusEffectSystem.Status(_actor, 0.5f, StatusEffectManager.GetStatusEffectData("Cold"))); } else { // TODO check if there is a cold status effect, if so add it. } }
/// <summary> /// Suffer X amount of damage. If health is empty, call the virtual OnDeath event. /// </summary> /// <param name="damage">Amount of damage to suffer.</param> public void SufferDamage(float damage) { Health -= damage; OnUpdateHealthEvent?.Invoke(Health / MaxHealth); if (Health <= 0) { StatusEffectScheduler.Instance(_actor.Guid).AddStatusEffect(new StatusEffectSystem.Status(_actor, 1f, StatusEffectManager.GetStatusEffectData(Constant.DEATH))); } }
/// <summary> /// Reduce the food by X. Apply a Hungry status effect if the food equals to 0. /// </summary> /// <param name="value">Amount of food to deduct.</param> public void ReduceFood(float value) { Food -= value; if (Food <= 0) { Food = 0; StatusEffectScheduler.Instance(_actor.Guid).AddStatusEffect(new StatusEffectSystem.Status(_actor, 0.5f, StatusEffectManager.GetStatusEffectData(Constant.STARVING))); } OnUpdateFoodEvent?.Invoke(Food); }
/// <summary> /// Increase the food bar by X. Remove any Hungry status effects. /// </summary> /// <param name="value">Amount of food to restore.</param> public void IncreaseFood(float value) { Food += value; StatusEffectScheduler.Instance(_actor.Guid).RemoveStatusEffect(Constant.STARVING); if (Food > Constant.ACTOR_BASE_FOOD) { Food = Constant.ACTOR_BASE_FOOD; } OnUpdateFoodEvent?.Invoke(Food); }
public void Initialize(Actor actor, AttributesDto attributesDto) { MaxHealth = attributesDto.MaxHealth; Health = attributesDto.Health; HealthRegeneration = attributesDto.HealthRegeneration; Speed = attributesDto.Speed; Damage = attributesDto.Damage; HungerRate = attributesDto.HungerRate; Food = attributesDto.Food; Temperature = attributesDto.Temperature; _actor = actor; StatusEffectScheduler.Instance(_actor.Guid).AddStatusEffect(new StatusEffectSystem.Status(_actor, 1f, StatusEffectManager.GetStatusEffectData(Constant.HUNGRY))); }
public void Initialize(Guid guid) { Debug.Log("Initialized status handler !"); if (_initialized == false) { _initialized = true; StatusEffectScheduler.Instance(guid).OnAddStatusEffectEvent += OnAdd; StatusEffectScheduler.Instance(guid).OnRemoveStatusEffectEvent += OnRemove; StatusEffectScheduler.Instance(guid).OnUpdateStatusEffectsEvent += OnBulkUpdate; StatusEffectScheduler.Instance(guid).OnUpdateStatusEffectEvent += OnUpdate; } else { Debug.LogError("This component has already been initialized with: " + guid.ToString()); } }