Skip to content

Commit

Permalink
Trigger Objects
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsZauberer committed Feb 27, 2021
1 parent bafd56e commit fc7454d
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Assets/Prefabs/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: a0137a8e7f3c1b44fa0ef27e53712f35, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
Expand Down Expand Up @@ -244,10 +244,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 165991d1e877cf846b402bdb1032deb0, type: 3}
m_Name:
m_EditorClassIdentifier:
dir: {x: 0, y: 0}
hook: {fileID: 5763763162042969811, guid: 4f82f4c1da74fbc4da7731dc62fb2165, type: 3}
obj: {fileID: 0}
shootingSpeed: 20
--- !u!1 &2708059942646119946
GameObject:
m_ObjectHideFlags: 0
Expand Down
201 changes: 198 additions & 3 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ Transform:
m_Children:
- {fileID: 768009922}
- {fileID: 561209658}
- {fileID: 685362898}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -742,7 +743,7 @@ TilemapRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_SortingOrder: 2
m_ChunkSize: {x: 32, y: 32, z: 32}
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
m_MaxChunkCount: 16
Expand Down Expand Up @@ -912,7 +913,7 @@ Tilemap:
- {fileID: 21300000, guid: 2f67cd62e85a95040b1ed8b66dae0788, type: 3}
- {fileID: 21300000, guid: 034b7cb01b25e784ba5e67ad3b2e9a3b, type: 3}
- {fileID: 21300000, guid: 8cfdb1cceb6f3474e8588f63865ae102, type: 3}
m_AnimationSpeed: 10
m_AnimationSpeed: 10.000001
m_AnimationTimeOffset: 0
m_IsLooping: 1
- first: {x: 15, y: -1, z: 0}
Expand All @@ -932,7 +933,7 @@ Tilemap:
- {fileID: 21300000, guid: 8cfdb1cceb6f3474e8588f63865ae102, type: 3}
- {fileID: 21300000, guid: eff992e636922ed4e9dfec05617cc378, type: 3}
- {fileID: 21300000, guid: 2f67cd62e85a95040b1ed8b66dae0788, type: 3}
m_AnimationSpeed: 10.000001
m_AnimationSpeed: 10
m_AnimationTimeOffset: 0
m_IsLooping: 1
- first: {x: 17, y: -1, z: 0}
Expand Down Expand Up @@ -1013,6 +1014,200 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!1 &685362897
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 685362898}
- component: {fileID: 685362901}
- component: {fileID: 685362900}
- component: {fileID: 685362899}
m_Layer: 0
m_Name: Targets
m_TagString: Targets
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &685362898
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 685362897}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.75, y: 0.75, z: 1}
m_Children: []
m_Father: {fileID: 352210819}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!19719996 &685362899
TilemapCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 685362897}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_MaximumTileChangeCount: 1000
m_ExtrusionFactor: 0.00001
--- !u!483693784 &685362900
TilemapRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 685362897}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_ChunkSize: {x: 32, y: 32, z: 32}
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
m_MaxChunkCount: 16
m_MaxFrameAge: 16
m_SortOrder: 0
m_Mode: 0
m_DetectChunkCullingBounds: 0
m_MaskInteraction: 0
--- !u!1839735485 &685362901
Tilemap:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 685362897}
m_Enabled: 1
m_Tiles:
- first: {x: -7, y: 8, z: 0}
second:
serializedVersion: 2
m_TileIndex: 0
m_TileSpriteIndex: 0
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
m_AllTileFlags: 1073741825
- first: {x: -6, y: 8, z: 0}
second:
serializedVersion: 2
m_TileIndex: 0
m_TileSpriteIndex: 0
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
m_AllTileFlags: 1073741825
- first: {x: -5, y: 8, z: 0}
second:
serializedVersion: 2
m_TileIndex: 0
m_TileSpriteIndex: 0
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
m_AllTileFlags: 1073741825
- first: {x: -4, y: 8, z: 0}
second:
serializedVersion: 2
m_TileIndex: 0
m_TileSpriteIndex: 0
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
m_AllTileFlags: 1073741825
m_AnimatedTiles: {}
m_TileAssetArray:
- m_RefCount: 4
m_Data: {fileID: 11400000, guid: ba019c28b192852459704222cf066a7c, type: 2}
m_TileSpriteArray:
- m_RefCount: 4
m_Data: {fileID: 21300000, guid: b2a43bc52aa05de49a5ac01cd668e102, type: 3}
m_TileMatrixArray:
- m_RefCount: 4
m_Data:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_TileColorArray:
- m_RefCount: 4
m_Data: {r: 1, g: 1, b: 1, a: 1}
m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Origin: {x: -7, y: 0, z: 0}
m_Size: {x: 7, y: 9, z: 1}
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
m_TileOrientation: 0
m_TileOrientationMatrix:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
--- !u!1 &768009921
GameObject:
m_ObjectHideFlags: 0
Expand Down
6 changes: 6 additions & 0 deletions Assets/Scripts/Objects/HookBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ void Update()
{
r.AddForce(dir*Time.fixedDeltaTime*shootingSpeed, ForceMode2D.Impulse);
}

private void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "Targets") {
Destroy(gameObject);
}
}
}
1 change: 1 addition & 0 deletions ProjectSettings/TagManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TagManager:
serializedVersion: 2
tags:
- Button
- Targets
layers:
- Default
- TransparentFX
Expand Down

0 comments on commit fc7454d

Please sign in to comment.