Merge tree2 UI improvements with equipment and safe case integration
This commit is contained in:
@@ -26,6 +26,11 @@ namespace Ironspore
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public int Rounds { get; private set; }
|
||||
public float ReloadRemaining { get; private set; }
|
||||
public float SecondaryCooldown => Mathf.Max(0, sideCooldown);
|
||||
public float Heading => yaw;
|
||||
public EquipmentDefinition Primary { get; private set; }
|
||||
GameSession game;
|
||||
CharacterController motor;
|
||||
Camera view;
|
||||
@@ -67,6 +72,13 @@ namespace Ironspore
|
||||
}
|
||||
public void ApplyLoadout()
|
||||
{
|
||||
var primary = game.Part(0, game.Run.equipment[0]);
|
||||
if (Primary != primary)
|
||||
{
|
||||
Primary = primary;
|
||||
Rounds = primary ? primary.magazineSize : 0;
|
||||
ReloadRemaining = 0;
|
||||
}
|
||||
visual.localScale = game.chassis[game.Run.chassis].modelScale;
|
||||
}
|
||||
public void RequireFreshTrigger()
|
||||
@@ -75,10 +87,16 @@ namespace Ironspore
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (!game.InField || game.Paused)
|
||||
if (!game.InField || game.Paused || Health <= 0)
|
||||
return;
|
||||
var frame = game.chassis[game.Run.chassis];
|
||||
float dt = Time.deltaTime;
|
||||
if (ReloadRemaining > 0)
|
||||
{
|
||||
ReloadRemaining = Mathf.Max(0, ReloadRemaining - dt);
|
||||
if (ReloadRemaining == 0)
|
||||
Rounds = Primary.magazineSize;
|
||||
}
|
||||
boostCooldown -= dt;
|
||||
shotCooldown -= dt;
|
||||
sideCooldown -= dt;
|
||||
@@ -88,8 +106,10 @@ namespace Ironspore
|
||||
if (!game.MenuOpen)
|
||||
{
|
||||
Vector2 look = game.Action("Look").ReadValue<Vector2>();
|
||||
yaw += look.x * .105f;
|
||||
pitch = Mathf.Clamp(pitch - look.y * .105f, -72, 75);
|
||||
float sensitivity = .105f * game.Settings.LookSensitivity
|
||||
* (game.Action("Aim").IsPressed() ? game.Settings.AimSensitivity : 1);
|
||||
yaw += look.x * sensitivity;
|
||||
pitch = Mathf.Clamp(pitch - look.y * sensitivity, -72, 75);
|
||||
if (game.Action("View").WasPressedThisFrame())
|
||||
FirstPerson = !FirstPerson;
|
||||
if (game.Action("Guard").WasPressedThisFrame() && game.Run.equipment[3] >= 0 && Energy >= 20)
|
||||
@@ -139,8 +159,14 @@ namespace Ironspore
|
||||
{
|
||||
if (!game.Action("Fire").IsPressed())
|
||||
freshTrigger = false;
|
||||
if (!freshTrigger && game.Action("Fire").IsPressed() && shotCooldown <= 0)
|
||||
if (Primary && game.Action("Reload").WasPressedThisFrame() && Rounds < Primary.magazineSize && ReloadRemaining == 0)
|
||||
ReloadRemaining = Primary.reloadSeconds;
|
||||
if (Primary && !freshTrigger && game.Action("Fire").IsPressed() && shotCooldown <= 0 && ReloadRemaining == 0 && Rounds > 0)
|
||||
{
|
||||
Shoot(false);
|
||||
if (--Rounds == 0)
|
||||
ReloadRemaining = Primary.reloadSeconds;
|
||||
}
|
||||
if (game.Action("Secondary").WasPressedThisFrame() && game.Run.equipment[1] >= 0 && sideCooldown <= 0 && Energy >= 15)
|
||||
{
|
||||
Energy -= 15;
|
||||
|
||||
Reference in New Issue
Block a user