Skip to content

Commit fdb83f9

Browse files
committed
Refactor Building and Vehicle to inherit from Unit
Introduced a new Unit base class and updated Building and Vehicle to inherit from it. Removed duplicate playerType field from Building. Updated GameScene to remove OrnithopterA prefab instance. Added supporting meta files and a class diagram for the new structure.
1 parent 12e3701 commit fdb83f9

File tree

9 files changed

+271
-61
lines changed

9 files changed

+271
-61
lines changed

.$plan.drawio.bkp

Whitespace-only changes.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
namespace BuildingPlacement.Buildings
44
{
5-
public class Building : MonoBehaviour
5+
public class Building : Unit.Unit
66
{
7-
public PlayerType playerType;
87
public Building buildingData;
98
public ParticleSystem[] buildEffects;
109

Red Strike/Assets/Scenes/GameScene.unity

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -255,63 +255,6 @@ PrefabInstance:
255255
m_AddedGameObjects: []
256256
m_AddedComponents: []
257257
m_SourcePrefab: {fileID: 100100000, guid: 85da885807e881b4a911c69742b4cab6, type: 3}
258-
--- !u!1001 &296709975
259-
PrefabInstance:
260-
m_ObjectHideFlags: 0
261-
serializedVersion: 2
262-
m_Modification:
263-
serializedVersion: 3
264-
m_TransformParent: {fileID: 0}
265-
m_Modifications:
266-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
267-
propertyPath: m_LocalPosition.x
268-
value: 0.5636215
269-
objectReference: {fileID: 0}
270-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
271-
propertyPath: m_LocalPosition.y
272-
value: -0.0000076293945
273-
objectReference: {fileID: 0}
274-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
275-
propertyPath: m_LocalPosition.z
276-
value: -62.487827
277-
objectReference: {fileID: 0}
278-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
279-
propertyPath: m_LocalRotation.w
280-
value: 1
281-
objectReference: {fileID: 0}
282-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
283-
propertyPath: m_LocalRotation.x
284-
value: 0
285-
objectReference: {fileID: 0}
286-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
287-
propertyPath: m_LocalRotation.y
288-
value: 0
289-
objectReference: {fileID: 0}
290-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
291-
propertyPath: m_LocalRotation.z
292-
value: 0
293-
objectReference: {fileID: 0}
294-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
295-
propertyPath: m_LocalEulerAnglesHint.x
296-
value: 0
297-
objectReference: {fileID: 0}
298-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
299-
propertyPath: m_LocalEulerAnglesHint.y
300-
value: 0
301-
objectReference: {fileID: 0}
302-
- target: {fileID: 4442516632743243454, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
303-
propertyPath: m_LocalEulerAnglesHint.z
304-
value: 0
305-
objectReference: {fileID: 0}
306-
- target: {fileID: 5287324194948881211, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
307-
propertyPath: m_Name
308-
value: OrnithopterA
309-
objectReference: {fileID: 0}
310-
m_RemovedComponents: []
311-
m_RemovedGameObjects: []
312-
m_AddedGameObjects: []
313-
m_AddedComponents: []
314-
m_SourcePrefab: {fileID: 100100000, guid: a35a82b670e35ac4aa3594152075595d, type: 3}
315258
--- !u!1 &330585543
316259
GameObject:
317260
m_ObjectHideFlags: 0
@@ -1284,4 +1227,3 @@ SceneRoots:
12841227
- {fileID: 496563313}
12851228
- {fileID: 127145441}
12861229
- {fileID: 1062271675}
1287-
- {fileID: 296709975}

Red Strike/Assets/Unit.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Red Strike/Assets/Unit/Unit.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using BuildingPlacement.Buildings;
2+
using UnityEngine;
3+
4+
namespace Unit
5+
{
6+
public class Unit : MonoBehaviour
7+
{
8+
[Header("Unit Info")]
9+
public int teamId;
10+
11+
public PlayerType playerType;
12+
}
13+
}

Red Strike/Assets/Unit/Unit.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Red Strike/Assets/VehicleSystem/Vehicles/Vehicle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace VehicleSystem.Vehicles
77
{
88
[RequireComponent(typeof(BoxCollider))]
99
[RequireComponent(typeof(VehicleUI))]
10-
public class Vehicle : MonoBehaviour
10+
public class Vehicle : Unit.Unit
1111
{
1212
[Header("Vehicle Data")]
1313
public VehicleSystem.Vehicle vehicleData;

Red Strike/Assets/plan.drawio.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plan.drawio

Lines changed: 239 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)