Add lights to bullets
This commit is contained in:
parent
aab4c4c71f
commit
2438624d4c
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<Bullet>();
|
||||
Body = GetComponent<Rigidbody2D>();
|
||||
Light = GetComponent<CustomLight>();
|
||||
|
||||
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);
|
||||
|
@ -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<Bullet>();
|
||||
Light = GetComponent<CustomLight>();
|
||||
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<CapsuleCollider2D>());
|
||||
Light.LightSize = 4;
|
||||
Explosion.Play();
|
||||
Trail.Stop();
|
||||
DeathTimer = 19;
|
||||
|
@ -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<Bullet>();
|
||||
Light = GetComponent<CustomLight>();
|
||||
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<CapsuleCollider2D>());
|
||||
Light.LightSize = 4;
|
||||
Explosion.Play();
|
||||
Trail.Stop();
|
||||
DeathTimer = 19;
|
||||
|
@ -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<Bullet>();
|
||||
Light = GetComponent<CustomLight>();
|
||||
|
||||
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<CapsuleCollider2D>());
|
||||
Explosion.Play();
|
||||
Trail.Stop();
|
||||
Light.LightSize = 6;
|
||||
DeathTimer = 19;
|
||||
|
||||
Bullet.DoDamageAOE(20, ExplodeRadius, 2);
|
||||
Bullet.DoDamageAOE(20, ExplodeRadius, 1.5f);
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected() {
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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}
|
||||
|
@ -94,7 +94,7 @@ Material:
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Intensity: 0
|
||||
- _LightCount: 37
|
||||
- _LightCount: 38
|
||||
- _LightingEnabled: 0
|
||||
- _Metallic: 0
|
||||
- _Mode: 1
|
||||
|
Loading…
Reference in New Issue
Block a user