diff --git a/Assets/Prefabs/Bullets/Grenade.prefab b/Assets/Prefabs/Bullets/Grenade.prefab index b51a563..33de83f 100644 --- a/Assets/Prefabs/Bullets/Grenade.prefab +++ b/Assets/Prefabs/Bullets/Grenade.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 4482402865533696887} - component: {fileID: 4551943312015413705} - component: {fileID: 3294967542024180344} + - component: {fileID: 5711847736799164130} m_Layer: 9 m_Name: Grenade m_TagString: Untagged @@ -107,6 +108,21 @@ MonoBehaviour: Torque: 5 Lifetime: 1 ExplodeRadius: 2 +--- !u!114 &5711847736799164130 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4482402865533696886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ddad1ebb72ff9484db3585dbc08a3bea, type: 3} + m_Name: + m_EditorClassIdentifier: + LightSize: 6 + LightIntensity: 0 + LightTint: {r: 1, g: 0.60249305, b: 0, a: 1} --- !u!1 &5552990435088311320 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Bullets/MobcatBullet.prefab b/Assets/Prefabs/Bullets/MobcatBullet.prefab index 0cf3438..d1614be 100644 --- a/Assets/Prefabs/Bullets/MobcatBullet.prefab +++ b/Assets/Prefabs/Bullets/MobcatBullet.prefab @@ -9519,6 +9519,7 @@ GameObject: - component: {fileID: 30050365576565218} - component: {fileID: 4482402865533696887} - component: {fileID: 3311105517541852250} + - component: {fileID: 4454922943827466308} m_Layer: 9 m_Name: MobcatBullet m_TagString: Untagged @@ -9612,6 +9613,21 @@ MonoBehaviour: Trail: {fileID: 4595570391660610945} Explosion: {fileID: 6411602551704027216} Damage: 3.4 +--- !u!114 &4454922943827466308 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4482402865533696886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ddad1ebb72ff9484db3585dbc08a3bea, type: 3} + m_Name: + m_EditorClassIdentifier: + LightSize: 2 + LightIntensity: 0 + LightTint: {r: 1, g: 0.35703805, b: 0, a: 1} --- !u!1 &5552990435088311320 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Bullets/RevolverBullet.prefab b/Assets/Prefabs/Bullets/RevolverBullet.prefab index 46549e2..81fc995 100644 --- a/Assets/Prefabs/Bullets/RevolverBullet.prefab +++ b/Assets/Prefabs/Bullets/RevolverBullet.prefab @@ -9519,6 +9519,7 @@ GameObject: - component: {fileID: 30050365576565218} - component: {fileID: 4482402865533696887} - component: {fileID: 894503829911440170} + - component: {fileID: 4685539796267488652} m_Layer: 9 m_Name: RevolverBullet m_TagString: Untagged @@ -9612,6 +9613,21 @@ MonoBehaviour: Trail: {fileID: 4595570391660610945} Explosion: {fileID: 6411602551704027216} Damage: 12 +--- !u!114 &4685539796267488652 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4482402865533696886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ddad1ebb72ff9484db3585dbc08a3bea, type: 3} + m_Name: + m_EditorClassIdentifier: + LightSize: 2 + LightIntensity: 0 + LightTint: {r: 1, g: 0.45679283, b: 0, a: 1} --- !u!1 &5552990435088311320 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Bullets/Rocket.prefab b/Assets/Prefabs/Bullets/Rocket.prefab index f7f2c6c..7899a04 100644 --- a/Assets/Prefabs/Bullets/Rocket.prefab +++ b/Assets/Prefabs/Bullets/Rocket.prefab @@ -9519,6 +9519,7 @@ GameObject: - component: {fileID: 30050365576565218} - component: {fileID: 4482402865533696887} - component: {fileID: 3794182723186641758} + - component: {fileID: 4668899990243774728} m_Layer: 9 m_Name: Rocket m_TagString: Untagged @@ -9612,6 +9613,21 @@ MonoBehaviour: Trail: {fileID: 4595570391660610945} Explosion: {fileID: 6411602551704027216} ExplodeRadius: 1.5 +--- !u!114 &4668899990243774728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4482402865533696886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ddad1ebb72ff9484db3585dbc08a3bea, type: 3} + m_Name: + m_EditorClassIdentifier: + LightSize: 4 + LightIntensity: 0 + LightTint: {r: 1, g: 0.4116228, b: 0, a: 1} --- !u!1 &5552990435088311320 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Bullets/ShotgunSubBullet.prefab b/Assets/Prefabs/Bullets/ShotgunSubBullet.prefab index c6113a8..d27a148 100644 --- a/Assets/Prefabs/Bullets/ShotgunSubBullet.prefab +++ b/Assets/Prefabs/Bullets/ShotgunSubBullet.prefab @@ -9519,6 +9519,7 @@ GameObject: - component: {fileID: 30050365576565218} - component: {fileID: 4482402865533696887} - component: {fileID: 894503829911440170} + - component: {fileID: 5070506563770326296} m_Layer: 9 m_Name: ShotgunSubBullet m_TagString: Untagged @@ -9612,6 +9613,21 @@ MonoBehaviour: Trail: {fileID: 4595570391660610945} Explosion: {fileID: 6411602551704027216} Damage: 3.4 +--- !u!114 &5070506563770326296 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4482402865533696886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ddad1ebb72ff9484db3585dbc08a3bea, type: 3} + m_Name: + m_EditorClassIdentifier: + LightSize: 2 + LightIntensity: 0 + LightTint: {r: 1, g: 0.65001845, b: 0, a: 1} --- !u!1 &5552990435088311320 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Guns/Grenade.cs b/Assets/Scripts/Guns/Grenade.cs index b64ad2e..a97e64a 100644 --- a/Assets/Scripts/Guns/Grenade.cs +++ b/Assets/Scripts/Guns/Grenade.cs @@ -1,12 +1,14 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using Saltosion.OneWeapon.Effects; namespace Saltosion.OneWeapon.Guns { [RequireComponent(typeof(Bullet))] public class Grenade : MonoBehaviour { private Bullet Bullet; + private CustomLight Light; [Header("Children")] public Rigidbody2D Body; @@ -22,6 +24,7 @@ namespace Saltosion.OneWeapon.Guns { void Start() { Bullet = GetComponent(); Body = GetComponent(); + Light = GetComponent(); Body.SetRotation(Bullet.InitialRotation); Body.AddForce(Bullet.Direction.normalized * ShootForce, ForceMode2D.Impulse); @@ -37,7 +40,10 @@ namespace Saltosion.OneWeapon.Guns { Bullet.HasExploded = true; Destroy(Body); Destroy(Sprite); - Bullet.DoDamageAOE(18, ExplodeRadius, 1.5f); + Bullet.DoDamageAOE(18, ExplodeRadius, 1f); + } + if (Lifetime < 0) { + Light.LightIntensity = Mathf.Max(2 + Lifetime * 6, 0); } if (Lifetime < -1) { Destroy(gameObject); diff --git a/Assets/Scripts/Guns/MobcatBullet.cs b/Assets/Scripts/Guns/MobcatBullet.cs index 93c37ae..dd1e442 100644 --- a/Assets/Scripts/Guns/MobcatBullet.cs +++ b/Assets/Scripts/Guns/MobcatBullet.cs @@ -4,7 +4,7 @@ using Saltosion.OneWeapon.Enemies; using Saltosion.OneWeapon.Effects; namespace Saltosion.OneWeapon.Guns { - [RequireComponent(typeof(Bullet))] + [RequireComponent(typeof(Bullet), typeof(CustomLight))] public class MobcatBullet : MonoBehaviour { public Rigidbody2D Body; @@ -19,12 +19,16 @@ namespace Saltosion.OneWeapon.Guns { private float DeathTimer = 0; private Bullet Bullet; + private CustomLight Light; void Start() { Bullet = GetComponent(); + Light = GetComponent(); Vector2 Direction = Bullet.Direction; float Rot = Bullet.InitialRotation; + Light.LightIntensity = 1.1f; + Body.velocity = Direction * 15; Body.rotation = Rot - 90; @@ -36,6 +40,9 @@ namespace Saltosion.OneWeapon.Guns { if (DeathTimer > 20) { Destroy(gameObject); } + if (DeathTimer > 19) { + Light.LightIntensity = Mathf.Max(2 - (DeathTimer - 19f) * 10, 0); + } } void OnTriggerEnter2D(Collider2D collider) { @@ -44,6 +51,7 @@ namespace Saltosion.OneWeapon.Guns { Destroy(Sprite); Destroy(Body); Destroy(GetComponent()); + Light.LightSize = 4; Explosion.Play(); Trail.Stop(); DeathTimer = 19; diff --git a/Assets/Scripts/Guns/RegularBullet.cs b/Assets/Scripts/Guns/RegularBullet.cs index de1f84c..8a48c48 100644 --- a/Assets/Scripts/Guns/RegularBullet.cs +++ b/Assets/Scripts/Guns/RegularBullet.cs @@ -7,7 +7,7 @@ using Saltosion.OneWeapon.Effects; using Saltosion.OneWeapon.Environment; namespace Saltosion.OneWeapon.Guns { - [RequireComponent(typeof(Bullet))] + [RequireComponent(typeof(Bullet), typeof(CustomLight))] public class RegularBullet : MonoBehaviour { public Rigidbody2D Body; @@ -21,12 +21,16 @@ namespace Saltosion.OneWeapon.Guns { private float DeathTimer = 0; private Bullet Bullet; + private CustomLight Light; void Start() { Bullet = GetComponent(); + Light = GetComponent(); Vector2 Direction = Bullet.Direction; float Rot = Bullet.InitialRotation; + Light.LightIntensity = 1.1f; + Body.velocity = Direction * 15; Body.rotation = Rot - 90; @@ -38,6 +42,9 @@ namespace Saltosion.OneWeapon.Guns { if (DeathTimer > 20) { Destroy(gameObject); } + if (DeathTimer > 19) { + Light.LightIntensity = Mathf.Max(2 - (DeathTimer - 19f) * 10, 0); + } } void OnTriggerEnter2D(Collider2D collider) { @@ -50,6 +57,7 @@ namespace Saltosion.OneWeapon.Guns { Destroy(Sprite); Destroy(Body); Destroy(GetComponent()); + Light.LightSize = 4; Explosion.Play(); Trail.Stop(); DeathTimer = 19; diff --git a/Assets/Scripts/Guns/Rocket.cs b/Assets/Scripts/Guns/Rocket.cs index ec438aa..10b53eb 100644 --- a/Assets/Scripts/Guns/Rocket.cs +++ b/Assets/Scripts/Guns/Rocket.cs @@ -7,7 +7,7 @@ using Saltosion.OneWeapon.Effects; using Saltosion.OneWeapon.Environment; namespace Saltosion.OneWeapon.Guns { - [RequireComponent(typeof(Bullet))] + [RequireComponent(typeof(Bullet), typeof(CustomLight))] public class Rocket : MonoBehaviour { public Rigidbody2D Body; @@ -22,15 +22,18 @@ namespace Saltosion.OneWeapon.Guns { private float DeathTimer = 0; private Bullet Bullet; + private CustomLight Light; void Start() { Bullet = GetComponent(); + Light = GetComponent(); Vector2 Direction = Bullet.Direction; float Rot = Bullet.InitialRotation; Body.velocity = Direction * 8; Body.rotation = Rot - 90; + Light.LightIntensity = 1.1f; Explosion.Stop(); } @@ -40,6 +43,9 @@ namespace Saltosion.OneWeapon.Guns { if (DeathTimer > 20) { Destroy(gameObject); } + if (DeathTimer > 19) { + Light.LightIntensity = Mathf.Max(2 - (DeathTimer - 19f) * 10, 0); + } } void OnTriggerEnter2D(Collider2D collider) { @@ -54,9 +60,10 @@ namespace Saltosion.OneWeapon.Guns { Destroy(GetComponent()); Explosion.Play(); Trail.Stop(); + Light.LightSize = 6; DeathTimer = 19; - Bullet.DoDamageAOE(20, ExplodeRadius, 2); + Bullet.DoDamageAOE(20, ExplodeRadius, 1.5f); } private void OnDrawGizmosSelected() { diff --git a/Assets/Scripts/Utils/LightUpdater.cs b/Assets/Scripts/Utils/LightUpdater.cs index 118c0e8..a9a74c3 100644 --- a/Assets/Scripts/Utils/LightUpdater.cs +++ b/Assets/Scripts/Utils/LightUpdater.cs @@ -42,7 +42,6 @@ namespace Saltosion.OneWeapon.Utils { public void RegisterLight(CustomLight Light) { if (Light != null) { Lights.Add(Light); - Debug.Log("Got Light!"); } } @@ -50,7 +49,6 @@ namespace Saltosion.OneWeapon.Utils { int idx = Lights.IndexOf(Light); if (idx > 0) { Lights.Remove(Light); - Debug.Log("Removed Light!"); } } } diff --git a/Assets/Shaders/DefaultMat.mat b/Assets/Shaders/DefaultMat.mat index be82927..b32a40b 100644 --- a/Assets/Shaders/DefaultMat.mat +++ b/Assets/Shaders/DefaultMat.mat @@ -43,7 +43,7 @@ Material: - PixelSnap: 0 - _EnableExternalAlpha: 0 - _Intensity: 0 - - _LightCount: 37 + - _LightCount: 38 m_Colors: - _AmbientLight: {r: 0, g: 0, b: 0, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Shaders/Particle.mat b/Assets/Shaders/Particle.mat index c34c706..7c4aa40 100644 --- a/Assets/Shaders/Particle.mat +++ b/Assets/Shaders/Particle.mat @@ -94,7 +94,7 @@ Material: - _Glossiness: 0.5 - _GlossyReflections: 1 - _Intensity: 0 - - _LightCount: 37 + - _LightCount: 38 - _LightingEnabled: 0 - _Metallic: 0 - _Mode: 1