Heatstroke VFX
Filling the heatstroke meter now results in a postprocessing filter which increasingly distorts the player's view as they get closer to death.
This commit is contained in:
parent
8920b48977
commit
2f088b5590
11 changed files with 183 additions and 26 deletions
|
|
@ -27,7 +27,6 @@ public class Cockpit : IBehavior
|
|||
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public float Heatstroke { get; private set; }
|
||||
|
||||
public Cockpit(ItemManager context, CockpitData data, Entity entity, EquippedItem item)
|
||||
{
|
||||
|
|
@ -35,22 +34,10 @@ public class Cockpit : IBehavior
|
|||
_data = data;
|
||||
Entity = entity;
|
||||
Item = item;
|
||||
Heatstroke = 0;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
if (Item.Temperature > Context.GameplaySettings.HeatstrokeTemperature)
|
||||
{
|
||||
Heatstroke = saturate(
|
||||
Heatstroke +
|
||||
pow(Item.Temperature - Context.GameplaySettings.HeatstrokeTemperature, Context.GameplaySettings.HeatstrokeExponent) *
|
||||
Context.GameplaySettings.HeatstrokeMultiplier * delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Heatstroke = saturate(Heatstroke - Context.GameplaySettings.HeatstrokeRecoverySpeed * delta);
|
||||
}
|
||||
return Heatstroke < Context.GameplaySettings.HeatstrokeControlLimit;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -97,6 +97,8 @@ public abstract class Entity
|
|||
}
|
||||
|
||||
public Shield Shield { get; private set; }
|
||||
public Cockpit Cockpit { get; private set; }
|
||||
public float Heatstroke { get; private set; }
|
||||
|
||||
public float TargetRange { get; private set; }
|
||||
public float MaxTemp { get; private set; }
|
||||
|
|
@ -112,6 +114,7 @@ public abstract class Entity
|
|||
public Subject<EquippedItem> ItemOnline = new Subject<EquippedItem>();
|
||||
public Subject<float> HullDamage = new Subject<float>();
|
||||
public Subject<Entity> Docked = new Subject<Entity>();
|
||||
public Subject<Unit> HeatstrokeRisk = new Subject<Unit>();
|
||||
|
||||
public UniRx.IObservable<EquippedItem> ItemDestroyed;
|
||||
public UniRx.IObservable<int2> HullArmorDepleted;
|
||||
|
|
@ -123,6 +126,7 @@ public abstract class Entity
|
|||
public virtual void Activate()
|
||||
{
|
||||
_active = true;
|
||||
Heatstroke = 0;
|
||||
foreach (var item in Equipment)
|
||||
foreach (var behavior in item.Behaviors)
|
||||
{
|
||||
|
|
@ -355,6 +359,8 @@ public abstract class Entity
|
|||
_heatsinks.Remove(heatsink);
|
||||
if (b is Shield)
|
||||
Shield = null;
|
||||
if (b is Cockpit)
|
||||
Cockpit = null;
|
||||
}
|
||||
|
||||
return item.EquippableItem;
|
||||
|
|
@ -533,6 +539,8 @@ public abstract class Entity
|
|||
_heatsinks.Add(heatsink);
|
||||
if (b is Shield shield)
|
||||
Shield = shield;
|
||||
if (b is Cockpit cockpit)
|
||||
Cockpit = cockpit;
|
||||
}
|
||||
|
||||
equippedItem.OnOnline += () => ItemOnline.OnNext(equippedItem);
|
||||
|
|
@ -731,6 +739,24 @@ public abstract class Entity
|
|||
|
||||
UpdateTemperature(delta);
|
||||
|
||||
if(Cockpit != null)
|
||||
{
|
||||
if (Cockpit.Item.Temperature > ItemManager.GameplaySettings.HeatstrokeTemperature)
|
||||
{
|
||||
var previous = Heatstroke;
|
||||
Heatstroke = saturate(
|
||||
Heatstroke +
|
||||
pow(Cockpit.Item.Temperature - ItemManager.GameplaySettings.HeatstrokeTemperature, ItemManager.GameplaySettings.HeatstrokeExponent) *
|
||||
ItemManager.GameplaySettings.HeatstrokeMultiplier * delta);
|
||||
if(previous < ItemManager.GameplaySettings.SevereHeatstrokeRiskThreshold && Heatstroke > ItemManager.GameplaySettings.SevereHeatstrokeRiskThreshold)
|
||||
HeatstrokeRisk.OnNext(Unit.Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
Heatstroke = saturate(Heatstroke - ItemManager.GameplaySettings.HeatstrokeRecoverySpeed * delta);
|
||||
}
|
||||
}
|
||||
|
||||
if (_active)
|
||||
{
|
||||
foreach (var equippedItem in _orderedEquipment)
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public class ZoneGenerationSettings
|
|||
[Serializable, MessagePackObject(keyAsPropertyName: true), JsonObject]
|
||||
public class GameplaySettings
|
||||
{
|
||||
public float SevereHeatstrokeRiskThreshold = .25f;
|
||||
public float WormholeDepth = 1000;
|
||||
public float WormholeExitVelocity = 20;
|
||||
public float WormholeExitRadius = 50;
|
||||
|
|
|
|||
Loading…
Reference in a new issue