Skip to content

Commit 1ae8bdc

Browse files
committed
Add explosion effects to buildings and vehicles
Introduced an explosionEffect ParticleSystem field to both Building and Vehicle ScriptableObjects and updated their destruction logic to instantiate the effect upon destruction. Updated relevant asset and prefab references to support the new effect. Also made minor adjustments to the BluePlanetArea scene and improved the cloud shader with a new color property.
1 parent 6ac6218 commit 1ae8bdc

File tree

21 files changed

+124
-136
lines changed

21 files changed

+124
-136
lines changed

Red Strike/Assets/BuildingPlacement/Building.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ namespace BuildingPlacement
55
[CreateAssetMenu(fileName = "NewBuilding", menuName = "Buildings/BuildingsDatabase")]
66
public class Building : ScriptableObject
77
{
8+
[Header("Building Settings")]
89
public string buildingName;
910
public GameObject buildingPrefab;
1011
public int maxHealth;
1112
public float buildTime;
1213
public int maxCreatedUnits;
14+
15+
[Header("Effects")]
16+
public ParticleSystem explosionEffect;
1317
}
1418
}

Red Strike/Assets/BuildingPlacement/Buildings/Building.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace BuildingPlacement.Buildings
55
{
66
public class Building : Unit.Unit
77
{
8-
public Building buildingData;
8+
public BuildingPlacement.Building buildingData;
99
public ParticleSystem[] buildEffects;
1010

1111
protected float health;
@@ -21,7 +21,7 @@ private void Start()
2121
main.startColor = playerType == PlayerType.Red ? Color.red : Color.blue;
2222
}
2323

24-
maxHealth = buildingData.health;
24+
maxHealth = buildingData.maxHealth;
2525
health = maxHealth;
2626
}
2727

@@ -35,6 +35,7 @@ public override void TakeDamage(float damage)
3535
if (health <= 0)
3636
{
3737
Debug.Log($"Building {BuildingName} destroyed.");
38+
Instantiate(buildingData.explosionEffect, transform.position, Quaternion.identity);
3839
Destroy(gameObject);
3940
}
4041
}

Red Strike/Assets/BuildingPlacement/Buildings/EnergyTower/EnergyTower.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ MonoBehaviour:
1717
maxHealth: 150
1818
buildTime: 3.51
1919
maxCreatedUnits: 3
20+
explosionEffect: {fileID: 19800002, guid: 6ecf76dc4f268d340b2666896a954bcc, type: 3}

Red Strike/Assets/BuildingPlacement/Buildings/EnergyTower/EnergyTower.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ MonoBehaviour:
131131
teamId: 0
132132
playerType: 0
133133
unitType: 1
134-
buildingData: {fileID: -4322946230525120543}
134+
buildingData: {fileID: 11400000, guid: 99f7c912324c6684c915f1110a575fbf, type: 2}
135135
buildEffects:
136136
- {fileID: 2273246402830813632}
137137
- {fileID: 9072490561556554335}

Red Strike/Assets/BuildingPlacement/Buildings/Hangar/Hangar.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ MonoBehaviour:
1717
maxHealth: 300
1818
buildTime: 3.51
1919
maxCreatedUnits: 2
20+
explosionEffect: {fileID: 19800002, guid: 6ecf76dc4f268d340b2666896a954bcc, type: 3}

Red Strike/Assets/BuildingPlacement/Buildings/Hangar/Hangar.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ MonoBehaviour:
221221
teamId: 0
222222
playerType: 1
223223
unitType: 1
224-
buildingData: {fileID: 5840819227562748720}
224+
buildingData: {fileID: 11400000, guid: a20ea262914989645a27af443d4c8b0b, type: 2}
225225
buildEffects:
226226
- {fileID: 1855726554393846403}
227227
- {fileID: 4273443631821389091}

Red Strike/Assets/BuildingPlacement/Buildings/MainStation/MainStation.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ MonoBehaviour:
1717
maxHealth: 500
1818
buildTime: 3.51
1919
maxCreatedUnits: 1
20+
explosionEffect: {fileID: 19800002, guid: 6ecf76dc4f268d340b2666896a954bcc, type: 3}

Red Strike/Assets/BuildingPlacement/Buildings/MainStation/MainStation.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ MonoBehaviour:
109109
teamId: 0
110110
playerType: 0
111111
unitType: 1
112-
buildingData: {fileID: 5269824642355325504}
112+
buildingData: {fileID: 11400000, guid: 25b5998dd3a37a74fbed9e8adcc609ce, type: 2}
113113
buildEffects:
114114
- {fileID: 8204242674232356029}
115115
- {fileID: 4710826401873965783}

Red Strike/Assets/PlanetAtmosphereSystem/CloudMaterial.mat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Material:
4141
- _QueueControl: 0
4242
- _QueueOffset: 0
4343
m_Colors:
44+
- _Color: {r: 0, g: 1.0177532, b: 1.5933679, a: 1}
4445
- _GunesYonu: {r: -1, g: 0, b: 0, a: 0}
4546
- _SunDirection: {r: -0, g: 0.4099231, b: -0.9121201, a: 0}
4647
m_BuildTextureStacks: []

Red Strike/Assets/PlanetAtmosphereSystem/CloudShader.shadergraph

Lines changed: 94 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"m_Properties": [
66
{
77
"m_Id": "70977b918b5a423a8effc17b78ac0ff5"
8+
},
9+
{
10+
"m_Id": "660b9209546f4a638204c18676149413"
811
}
912
],
1013
"m_Keywords": [],
@@ -39,9 +42,6 @@
3942
{
4043
"m_Id": "c0c4289691f74b248b3e99de9d04c31b"
4144
},
42-
{
43-
"m_Id": "684d34cc10e143f8a306b6b739a6d30b"
44-
},
4545
{
4646
"m_Id": "f529c10b17374d5f9d17ada1d4937eb1"
4747
},
@@ -68,6 +68,9 @@
6868
},
6969
{
7070
"m_Id": "8588b9ec83b84581875428555824989c"
71+
},
72+
{
73+
"m_Id": "7b0b70d0f9ac49c6a1ad55d6682b375a"
7174
}
7275
],
7376
"m_GroupDatas": [],
@@ -104,7 +107,7 @@
104107
{
105108
"m_OutputSlot": {
106109
"m_Node": {
107-
"m_Id": "684d34cc10e143f8a306b6b739a6d30b"
110+
"m_Id": "7b0b70d0f9ac49c6a1ad55d6682b375a"
108111
},
109112
"m_SlotId": 0
110113
},
@@ -830,47 +833,33 @@
830833
}
831834

832835
{
833-
"m_SGVersion": 1,
834-
"m_Type": "UnityEditor.ShaderGraph.ColorNode",
835-
"m_ObjectId": "684d34cc10e143f8a306b6b739a6d30b",
836-
"m_Group": {
837-
"m_Id": ""
836+
"m_SGVersion": 3,
837+
"m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty",
838+
"m_ObjectId": "660b9209546f4a638204c18676149413",
839+
"m_Guid": {
840+
"m_GuidSerialized": "45836369-fe66-47de-9952-34ac9667a2a4"
838841
},
839842
"m_Name": "Color",
840-
"m_DrawState": {
841-
"m_Expanded": true,
842-
"m_Position": {
843-
"serializedVersion": "2",
844-
"x": -826.0,
845-
"y": 13.000000953674317,
846-
"width": 207.99993896484376,
847-
"height": 124.99993896484375
848-
}
849-
},
850-
"m_Slots": [
851-
{
852-
"m_Id": "87fcd2bbbde5451c9f32e250ca7d986e"
853-
}
854-
],
855-
"synonyms": [
856-
"rgba"
857-
],
858-
"m_Precision": 0,
859-
"m_PreviewExpanded": true,
843+
"m_DefaultRefNameVersion": 1,
844+
"m_RefNameGeneratedByDisplayName": "Color",
845+
"m_DefaultReferenceName": "_Color",
846+
"m_OverrideReferenceName": "",
847+
"m_GeneratePropertyBlock": true,
848+
"m_UseCustomSlotLabel": false,
849+
"m_CustomSlotLabel": "",
860850
"m_DismissedVersion": 0,
861-
"m_PreviewMode": 0,
862-
"m_CustomColors": {
863-
"m_SerializableColors": []
851+
"m_Precision": 0,
852+
"overrideHLSLDeclaration": false,
853+
"hlslDeclarationOverride": 0,
854+
"m_Hidden": false,
855+
"m_Value": {
856+
"r": 1.0,
857+
"g": 1.0,
858+
"b": 1.0,
859+
"a": 1.0
864860
},
865-
"m_Color": {
866-
"color": {
867-
"r": 1.0,
868-
"g": 1.0,
869-
"b": 1.0,
870-
"a": 1.0
871-
},
872-
"mode": 1
873-
}
861+
"isMainColor": false,
862+
"m_ColorMode": 1
874863
}
875864

876865
{
@@ -1021,6 +1010,42 @@
10211010
}
10221011
}
10231012

1013+
{
1014+
"m_SGVersion": 0,
1015+
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
1016+
"m_ObjectId": "7b0b70d0f9ac49c6a1ad55d6682b375a",
1017+
"m_Group": {
1018+
"m_Id": ""
1019+
},
1020+
"m_Name": "Property",
1021+
"m_DrawState": {
1022+
"m_Expanded": true,
1023+
"m_Position": {
1024+
"serializedVersion": "2",
1025+
"x": -723.0,
1026+
"y": 41.0,
1027+
"width": 105.0,
1028+
"height": 34.0
1029+
}
1030+
},
1031+
"m_Slots": [
1032+
{
1033+
"m_Id": "b97c732bb9c2499e8b0a892ad8925979"
1034+
}
1035+
],
1036+
"synonyms": [],
1037+
"m_Precision": 0,
1038+
"m_PreviewExpanded": true,
1039+
"m_DismissedVersion": 0,
1040+
"m_PreviewMode": 0,
1041+
"m_CustomColors": {
1042+
"m_SerializableColors": []
1043+
},
1044+
"m_Property": {
1045+
"m_Id": "660b9209546f4a638204c18676149413"
1046+
}
1047+
}
1048+
10241049
{
10251050
"m_SGVersion": 0,
10261051
"m_Type": "UnityEditor.ShaderGraph.SaturateNode",
@@ -1143,31 +1168,6 @@
11431168
}
11441169
}
11451170

1146-
{
1147-
"m_SGVersion": 0,
1148-
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
1149-
"m_ObjectId": "87fcd2bbbde5451c9f32e250ca7d986e",
1150-
"m_Id": 0,
1151-
"m_DisplayName": "Out",
1152-
"m_SlotType": 1,
1153-
"m_Hidden": false,
1154-
"m_ShaderOutputName": "Out",
1155-
"m_StageCapability": 3,
1156-
"m_Value": {
1157-
"x": 0.0,
1158-
"y": 0.0,
1159-
"z": 0.0,
1160-
"w": 0.0
1161-
},
1162-
"m_DefaultValue": {
1163-
"x": 0.0,
1164-
"y": 0.0,
1165-
"z": 0.0,
1166-
"w": 0.0
1167-
},
1168-
"m_Labels": []
1169-
}
1170-
11711171
{
11721172
"m_SGVersion": 0,
11731173
"m_Type": "UnityEditor.ShaderGraph.NormalVectorNode",
@@ -1394,6 +1394,31 @@
13941394
"m_Labels": []
13951395
}
13961396

1397+
{
1398+
"m_SGVersion": 0,
1399+
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
1400+
"m_ObjectId": "b97c732bb9c2499e8b0a892ad8925979",
1401+
"m_Id": 0,
1402+
"m_DisplayName": "Color",
1403+
"m_SlotType": 1,
1404+
"m_Hidden": false,
1405+
"m_ShaderOutputName": "Out",
1406+
"m_StageCapability": 3,
1407+
"m_Value": {
1408+
"x": 0.0,
1409+
"y": 0.0,
1410+
"z": 0.0,
1411+
"w": 0.0
1412+
},
1413+
"m_DefaultValue": {
1414+
"x": 0.0,
1415+
"y": 0.0,
1416+
"z": 0.0,
1417+
"w": 0.0
1418+
},
1419+
"m_Labels": []
1420+
}
1421+
13971422
{
13981423
"m_SGVersion": 0,
13991424
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
@@ -1707,6 +1732,9 @@
17071732
"m_ChildObjectList": [
17081733
{
17091734
"m_Id": "70977b918b5a423a8effc17b78ac0ff5"
1735+
},
1736+
{
1737+
"m_Id": "660b9209546f4a638204c18676149413"
17101738
}
17111739
]
17121740
}

0 commit comments

Comments
 (0)