Implement destructible wall interaction
This commit is contained in:
parent
a80f36e33f
commit
263c53245e
13 changed files with 197 additions and 134 deletions
|
@ -59,7 +59,7 @@ AnimatorStateMachine:
|
|||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102162894460579672}
|
||||
m_Position: {x: 200, y: 0, z: 0}
|
||||
m_Position: {x: 240, y: 48, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 434 B |
|
@ -1,6 +1,6 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &5959564480851182330
|
||||
--- !u!1 &1538214466168189615
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -8,38 +8,36 @@ GameObject:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5959564480851182334}
|
||||
- component: {fileID: 5959564480851182333}
|
||||
- component: {fileID: 5959564480851182332}
|
||||
- component: {fileID: 5959564480851182331}
|
||||
m_Layer: 8
|
||||
m_Name: bman_wall
|
||||
- component: {fileID: 3243993883904879596}
|
||||
- component: {fileID: 3212428174306319952}
|
||||
m_Layer: 0
|
||||
m_Name: exitDoorPrefab
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5959564480851182334
|
||||
--- !u!4 &3243993883904879596
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5959564480851182330}
|
||||
m_GameObject: {fileID: 1538214466168189615}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 5, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 10.299996, y: -4.6040254, z: -0.13553935}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &5959564480851182333
|
||||
--- !u!212 &3212428174306319952
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5959564480851182330}
|
||||
m_GameObject: {fileID: 1538214466168189615}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
|
@ -69,62 +67,15 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 9
|
||||
m_Sprite: {fileID: 21300000, guid: 96d3693302b284c92ba9c394bb4f72c1, type: 3}
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: ac1b266a61f9d43feb33de3a91647f99, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_Size: {x: 0.32, y: 0.32}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!50 &5959564480851182332
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5959564480851182330}
|
||||
m_BodyType: 2
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 0
|
||||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
--- !u!61 &5959564480851182331
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5959564480851182330}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.5, y: 0.5}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 1, y: 1}
|
||||
newSize: {x: 1, y: 1}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd25aabed7c6c491eb405f1e5c5f4d99
|
||||
guid: 519235375d069406f909265766078ad0
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
BIN
Assets/DevMocks/old_door.png
Normal file
BIN
Assets/DevMocks/old_door.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 948 B |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96d3693302b284c92ba9c394bb4f72c1
|
||||
guid: ac1b266a61f9d43feb33de3a91647f99
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
|
@ -97,7 +97,7 @@ TextureImporter:
|
|||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 860cb4d89fb584a81bab705ec5b1d21f
|
||||
spriteID: fa0375da4ccc24a1a804016419fbf262
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
8
Assets/Prefabs/Managers.meta
Normal file
8
Assets/Prefabs/Managers.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 56431c4abf09947ed9b3f37ac715caca
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
65
Assets/Prefabs/Managers/GameManager.prefab
Normal file
65
Assets/Prefabs/Managers/GameManager.prefab
Normal file
|
@ -0,0 +1,65 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &158905820630581597
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 158905820630581587}
|
||||
- component: {fileID: 158905820630581586}
|
||||
- component: {fileID: 158905820630581596}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &158905820630581587
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158905820630581597}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 7.2735596, y: -6.5702896, z: -10.295408}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &158905820630581586
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158905820630581597}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 697f5ae5656c74dcd8d7f5d619adb0ac, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &158905820630581596
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158905820630581597}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 308dfc6b26c3b422faf1717231fc888b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
boardHolder: {fileID: 0}
|
||||
startPosition: {fileID: 0}
|
||||
indestructibleWallPrefab: {fileID: 5996206011854593075, guid: 84b92ac1e96d940bda97d1b1125887d7,
|
||||
type: 3}
|
||||
destructibleWallPrefabs:
|
||||
- {fileID: 4177940729222266681, guid: da559e681f8d34d58bb5f3457045664a, type: 3}
|
||||
- {fileID: 8729402555587492036, guid: 7e54504f1e1de4334be2e6a115b838c2, type: 3}
|
7
Assets/Prefabs/Managers/GameManager.prefab.meta
Normal file
7
Assets/Prefabs/Managers/GameManager.prefab.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdaa7451ab31b477b930076bbc888bab
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -93,6 +93,10 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: b30e7124fcdf4e1f92fc7dd42d8c7298, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
explosionPrefab: {fileID: 2086996798441195857, guid: 13213ac562d960e4e8c33d53d40a516c,
|
||||
type: 3}
|
||||
exitDoorPrefab: {fileID: 1538214466168189615, guid: 519235375d069406f909265766078ad0,
|
||||
type: 3}
|
||||
--- !u!1 &5688352134163068791
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -172,3 +172,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: b30e7124fcdf4e1f92fc7dd42d8c7298, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
explosionPrefab: {fileID: 2086996798441195857, guid: 13213ac562d960e4e8c33d53d40a516c,
|
||||
type: 3}
|
||||
exitDoorPrefab: {fileID: 1538214466168189615, guid: 519235375d069406f909265766078ad0,
|
||||
type: 3}
|
||||
|
|
|
@ -8206,69 +8206,6 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &840487110
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 840487112}
|
||||
- component: {fileID: 840487113}
|
||||
- component: {fileID: 840487111}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &840487111
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840487110}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 308dfc6b26c3b422faf1717231fc888b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
boardHolder: {fileID: 585332173}
|
||||
startPosition: {fileID: 185746015}
|
||||
indestructibleWallPrefab: {fileID: 5996206011854593075, guid: 84b92ac1e96d940bda97d1b1125887d7,
|
||||
type: 3}
|
||||
destructibleWallPrefabs:
|
||||
- {fileID: 4177940729222266681, guid: da559e681f8d34d58bb5f3457045664a, type: 3}
|
||||
- {fileID: 8729402555587492036, guid: 7e54504f1e1de4334be2e6a115b838c2, type: 3}
|
||||
--- !u!4 &840487112
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840487110}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 7.2735596, y: -6.5702896, z: -10.295408}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &840487113
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840487110}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 697f5ae5656c74dcd8d7f5d619adb0ac, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1135949884
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8408,6 +8345,85 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c9b7903151183144dbf30c9b2ab371b2, type: 3}
|
||||
--- !u!1001 &158905819792232859
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 158905820630581597, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: GameManager
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 7.2735596
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -6.5702896
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -10.295408
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 158905820630581596, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: boardHolder
|
||||
value:
|
||||
objectReference: {fileID: 585332173}
|
||||
- target: {fileID: 158905820630581596, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: startPosition
|
||||
value:
|
||||
objectReference: {fileID: 185746015}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fdaa7451ab31b477b930076bbc888bab, type: 3}
|
||||
--- !u!1001 &6843575829779162303
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace src.Wall
|
|||
{
|
||||
private bool _spawnExit;
|
||||
private bool _spawnUpgrade;
|
||||
public GameObject explosionPrefab;
|
||||
public GameObject exitDoorPrefab;
|
||||
|
||||
public void SpawnsExit()
|
||||
{
|
||||
|
@ -22,22 +24,28 @@ namespace src.Wall
|
|||
public float XCoordinate => transform.position.x;
|
||||
public float YCoordinate => transform.position.y;
|
||||
|
||||
public void OnDestroy()
|
||||
private void BeforeDestroy()
|
||||
{
|
||||
var currentPosition = transform.position;
|
||||
Destroy(GetComponent<SpriteRenderer>());
|
||||
Instantiate(explosionPrefab, currentPosition, Quaternion.identity);
|
||||
if (_spawnExit)
|
||||
{
|
||||
// TODO Spawn an exit
|
||||
Debug.Log($"Destructible spawned exit {transform.position}");
|
||||
Instantiate(exitDoorPrefab, currentPosition, Quaternion.identity);
|
||||
}
|
||||
else if (_spawnUpgrade)
|
||||
{
|
||||
// TODO Spawn an upgrade, use composition to UpgradeManager
|
||||
// to get random / desired upgrade
|
||||
Debug.Log($"Destructible spawned upgrade {transform.position}");
|
||||
// TODO: Get and instantiate upgrade from manager
|
||||
}
|
||||
}
|
||||
|
||||
public void onExplosion()
|
||||
{
|
||||
Debug.Log("Destructible wall hitted by explosion");
|
||||
Debug.Log($"Destructible wall hit by explosion {transform.position}");
|
||||
BeforeDestroy();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue