Aetheric Drive
Added Aetheric Drive hardpoint and item behavior Added Drive RPM UI to HUD Fixed death not disabling continue option Disabling global input when dialog is visible Fixed loadout generator failure when zero price item present Replaced fixed top speed with drag coefficients
This commit is contained in:
parent
b171b940dc
commit
11bfc739fe
65 changed files with 2312 additions and 320 deletions
121
Assets/Scripts/ServerShared/Behaviors/AetherDrive.cs
Normal file
121
Assets/Scripts/ServerShared/Behaviors/AetherDrive.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
|
||||
public class AetherDriveData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("diameters"), Key(1)]
|
||||
public float3 RotorDiameter;
|
||||
|
||||
[Inspectable, JsonProperty("masses"), Key(2)]
|
||||
public float3 RotorMass;
|
||||
|
||||
[Inspectable, JsonProperty("rpm"), Key(3), RuntimeInspectable]
|
||||
public PerformanceStat MaximumRpm;
|
||||
|
||||
[Inspectable, JsonProperty("couplingLambdas"), Key(4)]
|
||||
public float3 CouplingLambda;
|
||||
|
||||
[Inspectable, JsonProperty("couplingEfficiency"), Key(5), RuntimeInspectable]
|
||||
public PerformanceStat CouplingEfficiency;
|
||||
|
||||
[Inspectable, JsonProperty("torque"), Key(6), RuntimeInspectable]
|
||||
public PerformanceStat Torque;
|
||||
|
||||
[Inspectable, JsonProperty("torqueProfile"), Key(7), RuntimeInspectable]
|
||||
public BezierCurve TorqueProfile;
|
||||
|
||||
[Inspectable, JsonProperty("draw"), Key(8), RuntimeInspectable]
|
||||
public PerformanceStat EnergyDraw;
|
||||
|
||||
[Inspectable, JsonProperty("passiveCoupling"), Key(9), RuntimeInspectable]
|
||||
public PerformanceStat PassiveCoupling;
|
||||
|
||||
public override IBehavior CreateInstance(EquippedItem item)
|
||||
{
|
||||
return new AetherDrive(this, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class AetherDrive : IBehavior
|
||||
{
|
||||
private AetherDriveData _data;
|
||||
private float3 _axis;
|
||||
|
||||
public EquippedItem Item { get; }
|
||||
public float3 Thrust { get; private set; }
|
||||
public float3 Rpm { get; private set; }
|
||||
public float MaximumRpm { get; private set; }
|
||||
|
||||
public BehaviorData Data => _data;
|
||||
public AetherDriveData DriveData => _data;
|
||||
|
||||
public float3 Axis
|
||||
{
|
||||
get => _axis;
|
||||
set => _axis = clamp(value, -1, 1);
|
||||
}
|
||||
|
||||
public AetherDrive(AetherDriveData data, EquippedItem item)
|
||||
{
|
||||
_data = data;
|
||||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
var rotorSpeed = Rpm * _data.RotorDiameter / 100;
|
||||
|
||||
var forward = normalize(Item.Entity.Direction);
|
||||
var right = forward.Rotate(ItemRotation.Clockwise);
|
||||
|
||||
var speed = float2(dot(Item.Entity.Velocity, forward), dot(Item.Entity.Velocity, right));
|
||||
var couplingEfficiency = Item.Evaluate(_data.CouplingEfficiency);
|
||||
var efficiency = float3(saturate(1 - speed / max(rotorSpeed.xy, 1) * sign(_axis.xy)) * couplingEfficiency, 1);
|
||||
|
||||
Thrust = (Rpm - AetheriaMath.Decay(Rpm, _data.CouplingLambda, dt)) * _data.RotorMass * efficiency;
|
||||
|
||||
var couplingLambda = _data.CouplingLambda * max(abs(_axis), Item.Evaluate(_data.PassiveCoupling));
|
||||
var previousRpm = Rpm;
|
||||
Rpm = AetheriaMath.Decay(Rpm, couplingLambda, dt);
|
||||
var rpmLoss = previousRpm - Rpm;
|
||||
var force = rpmLoss * _data.RotorMass * efficiency;
|
||||
|
||||
var heat = rpmLoss * _data.RotorMass * (1 - couplingEfficiency);
|
||||
Item.AddHeat((heat.x + heat.y + heat.z)*Item.ItemManager.GameplaySettings.AetherHeatMultiplier);
|
||||
|
||||
Item.Entity.Velocity += forward * (_axis.x * force.x / Item.Entity.Mass);
|
||||
Item.Entity.Velocity += right * (_axis.y * force.y / Item.Entity.Mass);
|
||||
Item.Entity.Direction = mul(Item.Entity.Direction,
|
||||
Unity.Mathematics.float2x2.Rotate(force.z * _axis.z * Item.ItemManager.GameplaySettings.AetherTorqueMultiplier / Item.Entity.Mass));
|
||||
|
||||
if(float.IsNaN(Item.Entity.Velocity.x))
|
||||
Item.ItemManager.Log("FUCK FUCK FUCK FUCK");
|
||||
|
||||
MaximumRpm = Item.Evaluate(_data.MaximumRpm);
|
||||
var torqueProfile = float3(
|
||||
_data.TorqueProfile.Evaluate(Rpm.x / MaximumRpm),
|
||||
_data.TorqueProfile.Evaluate(Rpm.y / MaximumRpm),
|
||||
_data.TorqueProfile.Evaluate(Rpm.z / MaximumRpm));
|
||||
var potentialTorque = Item.Evaluate(_data.Torque) * torqueProfile;
|
||||
var potentialRpmDelta = potentialTorque / length(_data.RotorMass) * dt;
|
||||
var actualRpmDelta = min(MaximumRpm - Rpm, potentialRpmDelta);
|
||||
var torqueRatio = actualRpmDelta / potentialRpmDelta;
|
||||
var draw = torqueRatio * Item.Evaluate(_data.EnergyDraw) / 3;
|
||||
|
||||
if (Item.Entity.TryConsumeEnergy((draw.x + draw.y + draw.z)*dt))
|
||||
{
|
||||
Rpm += actualRpmDelta;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2022c838bbc64a0d86cfbd477e6a379c
|
||||
timeCreated: 1618332827
|
||||
|
|
@ -22,11 +22,11 @@ public class AutoWeapon : InstantWeapon
|
|||
{
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
if(_firing && _burstRemaining == 0 && _cooldown < 0)
|
||||
Trigger();
|
||||
return base.Execute(delta);
|
||||
return base.Execute(dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ using static Unity.Mathematics.noise;
|
|||
|
||||
public interface IBehavior
|
||||
{
|
||||
bool Execute(float delta);
|
||||
bool Execute(float dt);
|
||||
BehaviorData Data { get; }
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ public abstract class PersistentBehaviorData
|
|||
Union(9, typeof(WearData)),
|
||||
Union(10, typeof(VelocityConversionData)),
|
||||
Union(11, typeof(VelocityLimitData)),
|
||||
// Union(13, typeof(PatrolControllerData)),
|
||||
Union(12, typeof(AetherDriveData)),
|
||||
// Union(14, typeof(TowingControllerData)),
|
||||
Union(15, typeof(CooldownData)),
|
||||
Union(16, typeof(HeatData)),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class Capacitor : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Capacity = Item.Evaluate(_data.Capacity);
|
||||
Efficiency = Item.Evaluate(_data.Efficiency);
|
||||
|
|
|
|||
|
|
@ -112,14 +112,14 @@ public class ChargedWeapon : InstantWeapon, IEventBehavior
|
|||
Velocity *= lerp(1, _data.ChargeFiringVelocityMultiplier, saturate(_charge));
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
if (_charging)
|
||||
{
|
||||
_charge += delta / ChargeTime;
|
||||
_charge += dt / ChargeTime;
|
||||
if (!_charged)
|
||||
{
|
||||
Item.AddHeat(ChargeHeat * (delta / ChargeTime));
|
||||
Item.AddHeat(ChargeHeat * (dt / ChargeTime));
|
||||
if(_charge > 1)
|
||||
{
|
||||
_charged = true;
|
||||
|
|
@ -136,7 +136,7 @@ public class ChargedWeapon : InstantWeapon, IEventBehavior
|
|||
Item.EquippableItem.Durability -= _data.FailureDamage;
|
||||
}
|
||||
}
|
||||
return base.Execute(delta);
|
||||
return base.Execute(dt);
|
||||
}
|
||||
|
||||
public override void Activate()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class Cockpit : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior
|
|||
_data = data;
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
base.Execute(delta);
|
||||
base.Execute(dt);
|
||||
if (_firing)
|
||||
{
|
||||
if (!Item.Entity.TryConsumeEnergy(Item.Evaluate(_data.Energy) * delta))
|
||||
if (!Item.Entity.TryConsumeEnergy(Item.Evaluate(_data.Energy) * dt))
|
||||
{
|
||||
_firing = false;
|
||||
OnStopFiring?.Invoke();
|
||||
|
|
@ -77,7 +77,7 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior
|
|||
{
|
||||
if (_reloading)
|
||||
{
|
||||
_reload -= delta / _data.ReloadTime;
|
||||
_reload -= dt / _data.ReloadTime;
|
||||
if (_reload < 0)
|
||||
{
|
||||
_reloading = false;
|
||||
|
|
@ -86,7 +86,7 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior
|
|||
return false;
|
||||
}
|
||||
|
||||
_ammoInterval -= delta / _data.AmmoInterval;
|
||||
_ammoInterval -= dt / _data.AmmoInterval;
|
||||
if (_ammoInterval < 0)
|
||||
{
|
||||
_ammoInterval = 1;
|
||||
|
|
@ -115,10 +115,10 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior
|
|||
}
|
||||
}
|
||||
|
||||
var dmg = Item.Wear * delta;
|
||||
var dmg = Item.Wear * dt;
|
||||
Item.EquippableItem.Durability -= dmg;
|
||||
Item.Entity.ItemDamage.OnNext((Item, dmg));
|
||||
Item.AddHeat(Item.Evaluate(_data.Heat) * delta);
|
||||
Item.AddHeat(Item.Evaluate(_data.Heat) * dt);
|
||||
Item.Entity.VisibilitySources[this] = Item.Evaluate(_data.Visibility);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class Cooldown : IBehavior, IAlwaysUpdatedBehavior, IProgressBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
if (_cooldown < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ public class EnergyDraw : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
return Item.Entity.TryConsumeEnergy(Item.Evaluate(_data.EnergyDraw) * (_data.PerSecond ? delta : 1));
|
||||
return Item.Entity.TryConsumeEnergy(Item.Evaluate(_data.EnergyDraw) * (_data.PerSecond ? dt : 1));
|
||||
}
|
||||
}
|
||||
|
|
@ -36,9 +36,9 @@ public class Heat : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Item.AddHeat(Item.Evaluate(_data.Heat) * (_data.PerSecond ? delta : 1));
|
||||
Item.AddHeat(Item.Evaluate(_data.Heat) * (_data.PerSecond ? dt : 1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class HeatStorage : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,12 +136,12 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior
|
|||
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
base.Execute(delta);
|
||||
base.Execute(dt);
|
||||
if (_coolingDown)
|
||||
{
|
||||
_cooldown -= delta / (_data.MagazineSize > 0 && _ammo == 0 ? _data.ReloadTime : Cooldown);
|
||||
_cooldown -= dt / (_data.MagazineSize > 0 && _ammo == 0 ? _data.ReloadTime : Cooldown);
|
||||
if (_cooldown < 0)
|
||||
{
|
||||
_coolingDown = false;
|
||||
|
|
@ -155,7 +155,7 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior
|
|||
}
|
||||
}
|
||||
|
||||
_burstTimer += delta;
|
||||
_burstTimer += dt;
|
||||
while (_burstRemaining > 0 && _burstTimer > 0)
|
||||
{
|
||||
// If multiple ammo is consumed per burst, perform ammo and energy consumption here
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ItemUsage : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
var cargo = Item.Entity.FindItemInCargo(_data.Item);
|
||||
if (cargo == null) return false;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class LockWeapon : InstantWeapon
|
|||
_data = data;
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
if (_target != Item.Entity.Target.Value)
|
||||
{
|
||||
|
|
@ -81,12 +81,12 @@ public class LockWeapon : InstantWeapon
|
|||
if (degrees < LockAngle)
|
||||
{
|
||||
var lerp = 1 - unlerp(0, 90, degrees);
|
||||
_lock = saturate(_lock + pow(lerp, DirectionImpact) * delta * LockSpeed * pow(Item.Entity.EntityInfoGathered[Item.Entity.Target.Value], SensorImpact));
|
||||
_lock = saturate(_lock + pow(lerp, DirectionImpact) * dt * LockSpeed * pow(Item.Entity.EntityInfoGathered[Item.Entity.Target.Value], SensorImpact));
|
||||
}
|
||||
else _lock = saturate(_lock - delta * Decay);
|
||||
else _lock = saturate(_lock - dt * Decay);
|
||||
}
|
||||
|
||||
return base.Execute(delta);
|
||||
return base.Execute(dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class MiningTool : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Range = Item.Evaluate(_data.Range);
|
||||
var belt = Item.Entity.Zone.AsteroidBelts[AsteroidBelt];
|
||||
|
|
@ -60,7 +60,7 @@ public class MiningTool : IBehavior
|
|||
Item.Entity,
|
||||
AsteroidBelt,
|
||||
Asteroid,
|
||||
Item.Evaluate(_data.DamagePerSecond) * delta,
|
||||
Item.Evaluate(_data.DamagePerSecond) * dt,
|
||||
Item.Evaluate(_data.Efficiency),
|
||||
Item.Evaluate(_data.Penetration));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class Radiator : IBehavior, IAlwaysUpdatedBehavior, IInitializableBehavio
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
PumpedHeat = Item.Evaluate(_data.PumpedHeat);
|
||||
WasteHeat = Item.Evaluate(_data.WasteHeat);
|
||||
|
|
@ -63,7 +63,7 @@ public class Radiator : IBehavior, IAlwaysUpdatedBehavior, IInitializableBehavio
|
|||
// Temperature ratio would cause more waste heat than pump capacity, stop executing
|
||||
if (tempRatio > PumpedHeat / WasteHeat) return true;
|
||||
|
||||
if (!Item.Entity.TryConsumeEnergy(EnergyUsage * tempRatio * delta)) return false;
|
||||
if (!Item.Entity.TryConsumeEnergy(EnergyUsage * tempRatio * dt)) return false;
|
||||
|
||||
var pumpedHeat = PumpedHeat * max(itemTemperature - _data.TemperatureFloor, 0);
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ public class Radiator : IBehavior, IAlwaysUpdatedBehavior, IInitializableBehavio
|
|||
|
||||
var wasteHeat = WasteHeat * tempRatio;
|
||||
|
||||
Item.AddHeat((wasteHeat - pumpedHeat) * delta);
|
||||
Temperature += pumpedHeat / Item.ItemManager.GetThermalMass(Item.EquippableItem) * delta;
|
||||
Item.AddHeat((wasteHeat - pumpedHeat) * dt);
|
||||
Temperature += pumpedHeat / Item.ItemManager.GetThermalMass(Item.EquippableItem) * dt;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ public class Reactor : IBehavior, IOrderedBehavior
|
|||
Draw += energy;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
var charge = Item.Evaluate(_data.Charge) * delta;
|
||||
var charge = Item.Evaluate(_data.Charge) * dt;
|
||||
var efficiency = Item.Evaluate(_data.Efficiency);
|
||||
|
||||
// This behavior executes last, so any components drawing power have already done so
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class Reflector : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Item.Entity.VisibilitySources[this] = Item.Evaluate(_data.CrossSection) * Item.Entity.Zone.GetLight(Item.Entity.Position.xz);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class ResourceScanner : IBehavior, IAlwaysUpdatedBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
var planetData = Item.Entity.Zone.Planets[ScanTarget];
|
||||
if (planetData != null)
|
||||
|
|
@ -72,7 +72,7 @@ public class ResourceScanner : IBehavior, IAlwaysUpdatedBehavior
|
|||
Asteroid < beltData.Asteroids.Length &&
|
||||
length(Item.Entity.Position.xz - Item.Entity.Zone.AsteroidBelts[ScanTarget].Positions[Asteroid].xz) < Range)
|
||||
{
|
||||
_scanTime += delta;
|
||||
_scanTime += dt;
|
||||
if (_scanTime > ScanDuration)
|
||||
{
|
||||
// TODO: Implement Scanning!
|
||||
|
|
@ -86,7 +86,7 @@ public class ResourceScanner : IBehavior, IAlwaysUpdatedBehavior
|
|||
{
|
||||
if(length(Item.Entity.Position.xz - Item.Entity.Zone.GetOrbitPosition(planetData.Orbit)) < Range)
|
||||
{
|
||||
_scanTime += delta;
|
||||
_scanTime += dt;
|
||||
if (_scanTime > ScanDuration)
|
||||
{
|
||||
//Context.ItemData.Get<Corporation>(Entity.Corporation).PlanetSurveyFloor[ScanTarget] = MinimumDensity;
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ public class Sensor : IBehavior, IEventBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
if (_pinging)
|
||||
{
|
||||
_pingLerp += delta / _data.PingDuration;
|
||||
_pingLerp += dt / _data.PingDuration;
|
||||
_pingRadius = lerp(0, Item.Evaluate(_data.PingRange), pow(_pingLerp, _data.PingRadiusExponent));
|
||||
if (_pingLerp > 1)
|
||||
{
|
||||
|
|
@ -112,7 +112,7 @@ public class Sensor : IBehavior, IEventBehavior
|
|||
}
|
||||
}
|
||||
|
||||
_pingCooldown -= delta / Item.Evaluate(_data.PingCooldown);
|
||||
_pingCooldown -= dt / Item.Evaluate(_data.PingCooldown);
|
||||
|
||||
// TODO: Handle Active Detection / Visibility From Reflected Radiance
|
||||
var hardpoint = Item.Entity.Hardpoints[Item.Position.x, Item.Position.y];
|
||||
|
|
@ -145,9 +145,9 @@ public class Sensor : IBehavior, IEventBehavior
|
|||
entity.Visibility *
|
||||
Item.Evaluate(_data.Sensitivity) *
|
||||
_data.SensitivityCurve.Evaluate(angle / PI) *
|
||||
delta / dist);
|
||||
dt / dist);
|
||||
}
|
||||
next *= 1 - Item.ItemManager.GameplaySettings.TargetInfoDecay * delta;
|
||||
next *= 1 - Item.ItemManager.GameplaySettings.TargetInfoDecay * dt;
|
||||
//Context.Log($"{entity.Name} visibility {(int)(previous * 100)}% -> {(int)(next * 100)}%");
|
||||
Item.Entity.EntityInfoGathered[entity] = next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class Shield : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Efficiency = Item.Evaluate(_data.Efficiency);
|
||||
EnergyUsage = Item.Evaluate(_data.EnergyUsage);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class StatModifier : IBehavior, IInitializableBehavior, IDisposableBehavi
|
|||
}
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
foreach (var stat in _stats)
|
||||
(_data.Type == StatModifierType.Constant
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class Switch : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
return Activated;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class Thermotoggle : IBehavior
|
|||
TargetTemperature = data.TargetTemperature;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
return Item.Temperature < TargetTemperature ^ _data.HighPass;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,15 +63,15 @@ public class Thruster : IAnalogBehavior
|
|||
Thrust = Item.Evaluate(_data.Thrust);
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
if(_input > .01f && Item.Entity.TryConsumeEnergy(_input * Item.Evaluate(_data.EnergyUsage)))
|
||||
{
|
||||
Thrust = Item.Evaluate(_data.Thrust);
|
||||
Item.Entity.Velocity -= Item.Entity.Direction.Rotate(Item.EquippableItem.Rotation) * _input * Thrust / Item.Entity.Mass * delta;
|
||||
Item.Entity.Velocity -= Item.Entity.Direction.Rotate(Item.EquippableItem.Rotation) * _input * Thrust / Item.Entity.Mass * dt;
|
||||
Item.Entity.Direction = mul(Item.Entity.Direction,
|
||||
Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust * Item.ItemManager.GameplaySettings.TorqueMultiplier / Item.Entity.Mass * delta));
|
||||
Item.AddHeat(_input * Item.Evaluate(_data.Heat) * delta);
|
||||
Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust * Item.ItemManager.GameplaySettings.TorqueMultiplier / Item.Entity.Mass * dt));
|
||||
Item.AddHeat(_input * Item.Evaluate(_data.Heat) * dt);
|
||||
var vis = _input * Item.Evaluate(_data.Visibility);
|
||||
if (!Item.Entity.VisibilitySources.ContainsKey(this) || vis > Item.Entity.VisibilitySources[this])
|
||||
Item.Entity.VisibilitySources[this] = vis;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class Trigger : IBehavior, IActivatedBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
if (_pulled)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class TurretController : IBehavior
|
|||
}
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
if (Item.Entity.Target.Value != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class VelocityConversion : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class VelocityLimit : IBehavior
|
|||
Limit = Item.Evaluate(_data.TopSpeed);
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Limit = Item.Evaluate(_data.TopSpeed);
|
||||
if (length(Item.Entity.Velocity) > Limit)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class Visibility : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
Item.Entity.VisibilitySources[this] = Item.Evaluate(_data.Visibility);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public abstract class Weapon : IActivatedBehavior
|
|||
Velocity = Item.Evaluate(_data.Velocity);
|
||||
}
|
||||
|
||||
public virtual bool Execute(float delta)
|
||||
public virtual bool Execute(float dt)
|
||||
{
|
||||
UpdateStats();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ public class Wear : IBehavior
|
|||
Item = item;
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
public bool Execute(float dt)
|
||||
{
|
||||
if (_data.PerSecond)
|
||||
{
|
||||
var dmg = Item.Wear * delta;
|
||||
var dmg = Item.Wear * dt;
|
||||
Item.EquippableItem.Durability -= dmg;
|
||||
Item.Entity.ItemDamage.OnNext((Item, dmg));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue