feat: improve map lighting and expand the playable training range
Add real-time lighting and shadows, training courses and targets, and animated salvage crates. Include bilingual assets and curated verification results.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Ironspore
|
||||
{
|
||||
@@ -31,6 +32,9 @@ namespace Ironspore
|
||||
Camera view;
|
||||
Transform visual;
|
||||
GameObject cockpit;
|
||||
Renderer[] worldRenderers;
|
||||
ShadowCastingMode[] worldShadowModes;
|
||||
bool displayedFirstPerson;
|
||||
float yaw, pitch, vertical, boostRemaining, boostCooldown, shotCooldown, sideCooldown;
|
||||
Vector3 boostDirection;
|
||||
bool freshTrigger = true;
|
||||
@@ -53,7 +57,12 @@ namespace Ironspore
|
||||
visual.localPosition = Vector3.zero;
|
||||
foreach (var t in visual.GetComponentsInChildren<Transform>())
|
||||
t.gameObject.layer = 8;
|
||||
worldRenderers = visual.GetComponentsInChildren<Renderer>(true);
|
||||
worldShadowModes = new ShadowCastingMode[worldRenderers.Length];
|
||||
for (int i = 0; i < worldRenderers.Length; i++)
|
||||
worldShadowModes[i] = worldRenderers[i].shadowCastingMode;
|
||||
var cam = new GameObject("PilotCamera");
|
||||
cam.tag = "MainCamera";
|
||||
cam.transform.SetParent(transform);
|
||||
view = cam.AddComponent<Camera>();
|
||||
view.nearClipPlane = .08f;
|
||||
@@ -165,8 +174,14 @@ namespace Ironspore
|
||||
view.transform.SetPositionAndRotation(desired, rotation);
|
||||
float fov = game.MenuOpen ? 70 : game.Action("Aim").IsPressed() ? 50 : FirstPerson ? 78 : 70;
|
||||
view.fieldOfView = Mathf.Lerp(view.fieldOfView, fov, Time.unscaledDeltaTime * 12);
|
||||
visual.gameObject.SetActive(!FirstPerson);
|
||||
cockpit.SetActive(FirstPerson);
|
||||
if (displayedFirstPerson != FirstPerson)
|
||||
{
|
||||
displayedFirstPerson = FirstPerson;
|
||||
for (int i = 0; i < worldRenderers.Length; i++)
|
||||
if (worldRenderers[i])
|
||||
worldRenderers[i].shadowCastingMode = FirstPerson ? ShadowCastingMode.ShadowsOnly : worldShadowModes[i];
|
||||
cockpit.SetActive(FirstPerson);
|
||||
}
|
||||
}
|
||||
void Shoot(bool secondary)
|
||||
{
|
||||
@@ -201,6 +216,8 @@ namespace Ironspore
|
||||
enemy.Damage(part.damage * (1 + game.Run.upgrades * .15f));
|
||||
lastHitTime = Time.time;
|
||||
}
|
||||
else if (game.Trial && hit.collider.GetComponentInParent<RangeTarget>() is RangeTarget plate && plate.Hit())
|
||||
lastHitTime = Time.time;
|
||||
}
|
||||
WorldFactory.Tracer(muzzle, target, secondary ? new Color(1, .65f, .2f) : new Color(.2f, 1, .85f));
|
||||
GameAudio.Cue(secondary ? 140 : 240, .06f, .07f);
|
||||
|
||||
Reference in New Issue
Block a user