Merge pull request #84 from dnutiu/player-input-handler
Player input handler
This commit is contained in:
commit
01bddcc821
43 changed files with 379 additions and 374 deletions
|
@ -1,47 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1896072655702505677
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1896072655702505676}
|
||||
- component: {fileID: 5279176810039195611}
|
||||
m_Layer: 0
|
||||
m_Name: BombSpawner
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1896072655702505676
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1896072655702505677}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 7.8192964, y: -2.0062397, z: 8.0234375}
|
||||
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 &5279176810039195611
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1896072655702505677}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cd3bf3610d18aa14e805185b5e3f2d4b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
bombPrefab: {fileID: 5909392949477884267, guid: 28467e0d65b5d3844bf1862ac0c49ad9,
|
||||
type: 3}
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c9b7903151183144dbf30c9b2ab371b2
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf3e6294c377ca84d82651fe870a56dc
|
||||
guid: 142c20937b0ba4d1b9a77c8504dda487
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
|
@ -11,6 +11,7 @@ GameObject:
|
|||
- component: {fileID: 2219719956326328737}
|
||||
- component: {fileID: 2976769454423190410}
|
||||
- component: {fileID: 5317321277803550577}
|
||||
- component: {fileID: 5518668270798060090}
|
||||
m_Layer: 0
|
||||
m_Name: Explosion
|
||||
m_TagString: Explosion
|
||||
|
@ -71,6 +72,18 @@ BoxCollider2D:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &5518668270798060090
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2086996798441195857}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 00b7acc459217644283ce8202cadcded, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &5120645164323341697
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
|
@ -1,6 +1,6 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2377911311221568072
|
||||
--- !u!1 &1566036887972620463
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -8,38 +8,36 @@ GameObject:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7980903176349258245}
|
||||
- component: {fileID: 6699440875015304414}
|
||||
- component: {fileID: 7875732231624854186}
|
||||
- component: {fileID: 5909025813549437813}
|
||||
- component: {fileID: 8259350758463922881}
|
||||
- component: {fileID: 3408177363536354565}
|
||||
m_Layer: 0
|
||||
m_Name: BombUpgrade
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7980903176349258245
|
||||
--- !u!4 &8259350758463922881
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2377911311221568072}
|
||||
m_GameObject: {fileID: 1566036887972620463}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_Father: {fileID: 7980903176349258245}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &6699440875015304414
|
||||
--- !u!212 &3408177363536354565
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2377911311221568072}
|
||||
m_GameObject: {fileID: 1566036887972620463}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
|
@ -81,6 +79,39 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &2377911311221568072
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7980903176349258245}
|
||||
- component: {fileID: 7875732231624854186}
|
||||
- component: {fileID: 5909025813549437813}
|
||||
m_Layer: 0
|
||||
m_Name: BombUpgrade
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7980903176349258245
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2377911311221568072}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 8259350758463922881}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &7875732231624854186
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
|
@ -1,6 +1,6 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7385886653159515755
|
||||
--- !u!1 &687830553201031435
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -8,38 +8,36 @@ GameObject:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 685382037628668327}
|
||||
- component: {fileID: 7037551310800415105}
|
||||
- component: {fileID: 7958292204112110464}
|
||||
- component: {fileID: 5334633105760309190}
|
||||
- component: {fileID: 7203846401108240184}
|
||||
- component: {fileID: 734903871276958427}
|
||||
m_Layer: 0
|
||||
m_Name: FlameUpgrade
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &685382037628668327
|
||||
--- !u!4 &7203846401108240184
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7385886653159515755}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_GameObject: {fileID: 687830553201031435}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0.5, y: 0.5, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_Father: {fileID: 685382037628668327}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &7037551310800415105
|
||||
--- !u!212 &734903871276958427
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7385886653159515755}
|
||||
m_GameObject: {fileID: 687830553201031435}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
|
@ -81,6 +79,39 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &7385886653159515755
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 685382037628668327}
|
||||
- component: {fileID: 7958292204112110464}
|
||||
- component: {fileID: 5334633105760309190}
|
||||
m_Layer: 0
|
||||
m_Name: FlameUpgrade
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &685382037628668327
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7385886653159515755}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 7203846401108240184}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &7958292204112110464
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
|
@ -1,6 +1,6 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4467162782262204990
|
||||
--- !u!1 &1820949686450855695
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -8,38 +8,36 @@ GameObject:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5103883358052461890}
|
||||
- component: {fileID: 3057588250431493961}
|
||||
- component: {fileID: 234472779121130071}
|
||||
- component: {fileID: 5391029322786980951}
|
||||
- component: {fileID: 5028610574346420729}
|
||||
- component: {fileID: 7106954491075610430}
|
||||
m_Layer: 0
|
||||
m_Name: GoldenBombUpgrade
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5103883358052461890
|
||||
--- !u!4 &5028610574346420729
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4467162782262204990}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 226.39688, y: 753.2948, z: -16.29858}
|
||||
m_GameObject: {fileID: 1820949686450855695}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0.5, y: 0.5, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_Father: {fileID: 5103883358052461890}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3057588250431493961
|
||||
--- !u!212 &7106954491075610430
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4467162782262204990}
|
||||
m_GameObject: {fileID: 1820949686450855695}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
|
@ -81,6 +79,39 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &4467162782262204990
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5103883358052461890}
|
||||
- component: {fileID: 234472779121130071}
|
||||
- component: {fileID: 5391029322786980951}
|
||||
m_Layer: 0
|
||||
m_Name: GoldenBombUpgrade
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5103883358052461890
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4467162782262204990}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 226.39688, y: 753.2948, z: -16.29858}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 5028610574346420729}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &234472779121130071
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
|
@ -9,7 +9,6 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5958400204756161002}
|
||||
- component: {fileID: 7382262205660184478}
|
||||
- component: {fileID: 2747432428292150867}
|
||||
- component: {fileID: 6291791717356696744}
|
||||
m_Layer: 0
|
||||
|
@ -29,18 +28,88 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 3765005714787864007}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &7382262205660184478
|
||||
SpriteRenderer:
|
||||
--- !u!61 &2747432428292150867
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4242909486338491383}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
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
|
||||
--- !u!114 &6291791717356696744
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4242909486338491383}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0b8c723aa8c7476789cbee67fcadfbef, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &8860579196177115379
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3765005714787864007}
|
||||
- component: {fileID: 2705328157713901762}
|
||||
m_Layer: 0
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3765005714787864007
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8860579196177115379}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5958400204756161002}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &2705328157713901762
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8860579196177115379}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
|
@ -81,41 +150,3 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!61 &2747432428292150867
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4242909486338491383}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
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
|
||||
--- !u!114 &6291791717356696744
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4242909486338491383}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0b8c723aa8c7476789cbee67fcadfbef, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
|
@ -145,6 +145,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e3cc05deb3d6e44128ad7bc8610cedac, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
godMode: 0
|
||||
movementSpeed: 4
|
||||
--- !u!50 &6843575828445418653
|
||||
Rigidbody2D:
|
||||
|
|
|
@ -136,75 +136,6 @@ Transform:
|
|||
type: 3}
|
||||
m_PrefabInstance: {fileID: 6843575829779162303}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &2013742123
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1896072655702505677, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: BombSpawner
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1896072655702505676, guid: c9b7903151183144dbf30c9b2ab371b2,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c9b7903151183144dbf30c9b2ab371b2, type: 3}
|
||||
--- !u!1001 &158905819792232859
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -212,6 +143,14 @@ PrefabInstance:
|
|||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 0}
|
||||
propertyPath: boardHolder
|
||||
value:
|
||||
objectReference: {fileID: 585332173}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startPosition
|
||||
value:
|
||||
objectReference: {fileID: 185746015}
|
||||
- target: {fileID: 158905820630581597, guid: fdaa7451ab31b477b930076bbc888bab,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
|
@ -272,14 +211,6 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: boardHolder
|
||||
value:
|
||||
objectReference: {fileID: 585332173}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startPosition
|
||||
value:
|
||||
objectReference: {fileID: 185746015}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fdaa7451ab31b477b930076bbc888bab, type: 3}
|
||||
--- !u!1001 &485484359436847253
|
||||
|
@ -401,7 +332,7 @@ PrefabInstance:
|
|||
- target: {fileID: 2219516564235934920, guid: 4ca131020414f4b1597dac2e1d292d7f,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 8
|
||||
value: 7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2219516564235934920, guid: 4ca131020414f4b1597dac2e1d292d7f,
|
||||
type: 3}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
using System;
|
||||
using src.Base;
|
||||
using src.Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace src.Ammo
|
||||
{
|
||||
public class BombsSpawner : GameplayComponent
|
||||
{
|
||||
public GameObject bombPrefab;
|
||||
|
||||
private BombsUtilManager _bombsUtil;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_bombsUtil = BombsUtilManager.instance;
|
||||
}
|
||||
|
||||
public void PlaceBomb(Transform location)
|
||||
{
|
||||
var position1 = location.position;
|
||||
var absX = Mathf.RoundToInt(position1.x);
|
||||
var absY = Mathf.RoundToInt(position1.y);
|
||||
var position = new Vector2(absX, absY);
|
||||
if (_bombsUtil.CanPlaceBomb(position))
|
||||
{
|
||||
Instantiate(bombPrefab, position, Quaternion.identity);
|
||||
_bombsUtil.PlaceBomb(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cd3bf3610d18aa14e805185b5e3f2d4b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -65,7 +65,7 @@ namespace src.Base
|
|||
Collider2D.enabled = false;
|
||||
_isDead = true;
|
||||
Animator.SetTrigger(AnimExplode);
|
||||
Destroy(gameObject, 1);
|
||||
Destroy(gameObject, 0.7f);
|
||||
}
|
||||
|
||||
public void OnCollisionEnter2D(Collision2D col)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using src.Interfaces;
|
||||
using src.Managers;
|
||||
using src.Player;
|
||||
using src.Upgrade;
|
||||
using UnityEngine;
|
||||
|
||||
namespace src.Base
|
||||
|
@ -8,6 +10,7 @@ namespace src.Base
|
|||
{
|
||||
protected GameManager gameManager;
|
||||
private UpgradeManager _upgradeManager;
|
||||
protected PlayerController _playerToUpgrade;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
@ -23,6 +26,7 @@ namespace src.Base
|
|||
public void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag("Player")) return;
|
||||
_playerToUpgrade = other.GetComponent<PlayerController>();
|
||||
PerformUpgrade();
|
||||
_upgradeManager.ClaimUpgrade(gameObject);
|
||||
Destroy(gameObject);
|
||||
|
|
|
@ -4,7 +4,7 @@ using src.Base;
|
|||
using src.Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace src.Ammo
|
||||
namespace src.Bomb
|
||||
{
|
||||
public class BombCameraShake : GameplayComponent
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace src.Ammo
|
|||
private IEnumerator _startCameraShake()
|
||||
{
|
||||
SetCameraNoise(amplitudeGain, frequencyGain);
|
||||
yield return new WaitForSeconds(_bombsUtilManager.ExplosionDuration);
|
||||
yield return new WaitForSeconds(_bombsUtilManager.explosionDuration);
|
||||
SetCameraNoise(0, 0);
|
||||
}
|
||||
|
|
@ -4,29 +4,28 @@ using src.Helpers;
|
|||
using src.Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace src.Ammo
|
||||
namespace src.Bomb
|
||||
{
|
||||
public class BombController : GameplayComponent, IExplosable
|
||||
{
|
||||
public GameObject explosionPrefab;
|
||||
|
||||
private BombCameraShake _cameraShake;
|
||||
private readonly BombsUtilManager _bombsUtil = BombsUtilManager.instance;
|
||||
private BombCameraShake _cameraShake;
|
||||
private SpriteRenderer _spriteRenderer;
|
||||
private bool _exploded;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
_cameraShake = GameObject.Find("VCAM1").GetComponent<BombCameraShake>();
|
||||
Invoke(nameof(Explode), _bombsUtil.Timer);
|
||||
_spriteRenderer = GetComponentInChildren<SpriteRenderer>();
|
||||
Invoke(nameof(Explode), _bombsUtil.timer);
|
||||
}
|
||||
|
||||
void Explode()
|
||||
private void Explode()
|
||||
{
|
||||
Instantiate(explosionPrefab, transform.position, Quaternion.identity);
|
||||
|
||||
GetComponentInChildren<SpriteRenderer>().enabled = false;
|
||||
Instantiate(PrefabAtlas.BombExplosion, transform.position, Quaternion.identity);
|
||||
|
||||
_spriteRenderer.enabled = false;
|
||||
_cameraShake.StartCameraShakeCoro();
|
||||
StartCoroutine(CreateExplosions(Vector3.down));
|
||||
StartCoroutine(CreateExplosions(Vector3.left));
|
||||
|
@ -42,19 +41,18 @@ namespace src.Ammo
|
|||
private IEnumerator CreateExplosions(Vector3 direction)
|
||||
{
|
||||
var currentPosition = transform.position;
|
||||
for (var i = 1; i < _bombsUtil.Power; i++)
|
||||
for (var i = 1; i < _bombsUtil.power; i++)
|
||||
{
|
||||
var hit = Physics2D.Raycast(new Vector2(currentPosition.x + 0.5f,
|
||||
currentPosition.y + 0.5f), direction, i, 1 << 8);
|
||||
|
||||
if (!hit.collider)
|
||||
{
|
||||
Instantiate(explosionPrefab, transform.position + i * direction,
|
||||
explosionPrefab.transform.rotation);
|
||||
Instantiate(PrefabAtlas.BombExplosion, transform.position + i * direction,
|
||||
PrefabAtlas.BombExplosion.transform.rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Hit something");
|
||||
var key = hit.collider.GetComponent<IExplosable>();
|
||||
key?.OnExplosion();
|
||||
break;
|
||||
|
@ -79,8 +77,8 @@ namespace src.Ammo
|
|||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
_bombsUtil.RemoveBomb(transform.position);
|
||||
{
|
||||
_bombsUtil.UnregisterBomb(transform.position);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
using src.Base;
|
||||
using src.Managers;
|
||||
|
||||
namespace src.Ammo
|
||||
namespace src.Bomb
|
||||
{
|
||||
public class Explosion : GameplayComponent
|
||||
public class BombExplosion : GameplayComponent
|
||||
{
|
||||
private readonly BombsUtilManager _bombUtil = BombsUtilManager.instance;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Destroy(gameObject, _bombUtil.ExplosionDuration);
|
||||
Destroy(gameObject, _bombUtil.explosionDuration);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,13 +18,19 @@ namespace src.Helpers
|
|||
|
||||
/* Upgrades */
|
||||
public static readonly GameObject SpeedIncreaseUpgrade =
|
||||
Resources.Load<GameObject>("Ammo/SpeedUpgrade");
|
||||
Resources.Load<GameObject>("Items/SpeedUpgrade");
|
||||
public static readonly GameObject BombsIncreaseUpgrade =
|
||||
Resources.Load<GameObject>("Ammo/BombUpgrade");
|
||||
Resources.Load<GameObject>("Items/BombUpgrade");
|
||||
public static readonly GameObject FlamesIncreaseUpgrade =
|
||||
Resources.Load<GameObject>("Ammo/FlameUpgrade");
|
||||
Resources.Load<GameObject>("Items/FlameUpgrade");
|
||||
public static readonly GameObject GoldenBombUpgrade =
|
||||
Resources.Load<GameObject>("GoldenBombUpgrade/FlameUpgrade");
|
||||
Resources.Load<GameObject>("Items/GoldenBombUpgrade");
|
||||
|
||||
/* Items */
|
||||
public static readonly GameObject Bomb =
|
||||
Resources.Load<GameObject>("Items/Bomb");
|
||||
public static readonly GameObject BombExplosion =
|
||||
Resources.Load<GameObject>("Items/BombExplosion");
|
||||
|
||||
/* Enemies */
|
||||
public static readonly GameObject GreenEnemy = Resources.Load<GameObject>("Enemies/SnowEnemyRandom");
|
||||
|
|
|
@ -6,22 +6,18 @@ namespace src.Managers
|
|||
{
|
||||
public sealed class BombsUtilManager : GameplayComponent
|
||||
{
|
||||
private readonly HashSet<Vector3> _usedPosition = new HashSet<Vector3>();
|
||||
public static BombsUtilManager instance;
|
||||
|
||||
public int power = 3;
|
||||
public int allowedBombs = 2;
|
||||
public int placedBombs = 0;
|
||||
public float timer = 3.0f;
|
||||
public float explosionDuration = 0.55f;
|
||||
|
||||
|
||||
private readonly HashSet<Vector3> _usedPosition = new HashSet<Vector3>();
|
||||
private const int MaxPower = 7;
|
||||
private const int MaxAllowedBombs = 10;
|
||||
|
||||
public int Power { get; private set; } = 3;
|
||||
|
||||
public int AllowedBombs { get; private set; } = 2;
|
||||
|
||||
public int PlacedBombs { get; private set; } = 0;
|
||||
|
||||
public float Timer { get; } = 3.0f;
|
||||
|
||||
public float ExplosionDuration { get; } = 0.55f;
|
||||
|
||||
public static BombsUtilManager instance;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
|
@ -37,41 +33,37 @@ namespace src.Managers
|
|||
|
||||
public void IncreasePower()
|
||||
{
|
||||
if (Power <= MaxPower)
|
||||
if (power <= MaxPower)
|
||||
{
|
||||
Power++;
|
||||
power++;
|
||||
}
|
||||
}
|
||||
|
||||
public void IncreaseAllowedBombs()
|
||||
{
|
||||
if (AllowedBombs <= MaxAllowedBombs)
|
||||
if (allowedBombs <= MaxAllowedBombs)
|
||||
{
|
||||
AllowedBombs++;
|
||||
allowedBombs++;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaceBomb(Vector3 position)
|
||||
public void RegisterBomb(Vector3 position)
|
||||
{
|
||||
if (CanPlaceBomb(position))
|
||||
{
|
||||
PlacedBombs++;
|
||||
_usedPosition.Add(position);
|
||||
}
|
||||
if (!CanPlaceBomb(position)) return;
|
||||
placedBombs++;
|
||||
_usedPosition.Add(position);
|
||||
}
|
||||
|
||||
public void RemoveBomb(Vector3 position)
|
||||
public void UnregisterBomb(Vector3 position)
|
||||
{
|
||||
if (_usedPosition.Contains(position))
|
||||
{
|
||||
PlacedBombs--;
|
||||
_usedPosition.Remove(position);
|
||||
}
|
||||
if (!_usedPosition.Contains(position)) return;
|
||||
placedBombs--;
|
||||
_usedPosition.Remove(position);
|
||||
}
|
||||
|
||||
public bool CanPlaceBomb(Vector3 position)
|
||||
{
|
||||
return (!_usedPosition.Contains(position) && (PlacedBombs < AllowedBombs));
|
||||
return !_usedPosition.Contains(position) && placedBombs < allowedBombs;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,7 +37,6 @@ namespace src.Managers
|
|||
_gameStateManager = gameObject.AddComponent<GameStateManager>();
|
||||
_levelManager = gameObject.AddComponent<LevelManager>();
|
||||
_upgradeManager = gameObject.AddComponent<UpgradeManager>();
|
||||
gameObject.AddComponent<PlayerUpgrade>();
|
||||
|
||||
// Load external components
|
||||
_playerController = GameObject.Find("Player").GetComponent<PlayerController>();
|
||||
|
|
|
@ -1,39 +1,50 @@
|
|||
using src.Ammo;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using src.Base;
|
||||
using src.Helpers;
|
||||
using src.Managers;
|
||||
using UnityEngine;
|
||||
using UnityStandardAssets.CrossPlatformInput;
|
||||
|
||||
namespace src.Player
|
||||
{
|
||||
public class PlayerController : GameplayComponent, IExplosable
|
||||
{
|
||||
public bool godMode;
|
||||
public float movementSpeed = 4f;
|
||||
|
||||
/* Components */
|
||||
private GameStateManager _gameStateManager;
|
||||
private Rigidbody2D _rigidbody2d;
|
||||
private Collider2D _collider2D;
|
||||
private Transform _respawnPosition;
|
||||
private BombsSpawner _bombsSpawner;
|
||||
private BombsUtilManager _bombsUtil;
|
||||
private Animator _animator;
|
||||
private PlayerUpgrade _playerUpgrade;
|
||||
|
||||
/* Variables */
|
||||
private bool _isDead;
|
||||
|
||||
/* Animator Variables*/
|
||||
private static readonly int AnimHorizontal = Animator.StringToHash("AnimHorizontal");
|
||||
private static readonly int AnimVertical = Animator.StringToHash("AnimVertical");
|
||||
private static readonly int AnimDeath = Animator.StringToHash("AnimDeath");
|
||||
|
||||
|
||||
public bool godMode;
|
||||
public float movementSpeed = 4f;
|
||||
private bool _isDead;
|
||||
protected void Awake()
|
||||
{
|
||||
_playerUpgrade = gameObject.AddComponent<PlayerUpgrade>();
|
||||
}
|
||||
|
||||
protected void Start()
|
||||
{
|
||||
_gameStateManager = GameStateManager.instance;
|
||||
_playerUpgrade = PlayerUpgrade.instance;
|
||||
|
||||
_bombsUtil = BombsUtilManager.instance;
|
||||
|
||||
_rigidbody2d = GetComponent<Rigidbody2D>();
|
||||
_collider2D = GetComponent<Collider2D>();
|
||||
_animator = GetComponentInChildren<Animator>();
|
||||
_respawnPosition = GameObject.Find("RespawnPosition").transform;
|
||||
_bombsSpawner = GameObject.Find("BombSpawner").GetComponent<BombsSpawner>();
|
||||
|
||||
movementSpeed = _playerUpgrade.GetMovementSpeed();
|
||||
_playerUpgrade.PlayerSpeed += OnSpeedUpgrade;
|
||||
|
@ -53,15 +64,50 @@ namespace src.Player
|
|||
private void Update()
|
||||
{
|
||||
if (_gameStateManager.IsGamePaused || _gameStateManager.IsPlayerMovementForbidden || _isDead) {return;}
|
||||
HandleBombInput();
|
||||
HandleItemsInput();
|
||||
}
|
||||
|
||||
private void HandleMovementInput()
|
||||
{
|
||||
#if UNITY_STANDALONE || UNITY_WEBGL || UNITY_EDITOR
|
||||
HandleKeyboardMovement();
|
||||
#elif UNITY_IOS || UNITY_ANDROID
|
||||
HandleTouchMovement();
|
||||
#elif UNITY_PS4 || UNITY_XBOXONE
|
||||
HandlerControllerMovement();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void HandleItemsInput()
|
||||
{
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
PlaceBomb();
|
||||
}
|
||||
#elif UNITY_IOS || UNITY_ANDROID
|
||||
if (CrossPlatformInputManager.GetButton("PlaceBomb"))
|
||||
{
|
||||
PlaceBomb();
|
||||
}
|
||||
#elif UNITY_PS4 || UNITY_XBOXONE
|
||||
// Console bomb placement is not supported yet.
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_STANDALONE || UNITY_WEBGL || UNITY_EDITOR
|
||||
private void HandleKeyboardMovement()
|
||||
{
|
||||
var horizontal = Input.GetAxisRaw("Horizontal");
|
||||
var vertical = Input.GetAxisRaw("Vertical");
|
||||
#elif UNITY_IOS || UNITY_ANDROID
|
||||
var movementVector = new Vector2(horizontal, vertical);
|
||||
MovePosition(movementVector);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
private void HandleTouchMovement()
|
||||
{
|
||||
var horizontal = 0;
|
||||
var vertical = 0;
|
||||
if (CrossPlatformInputManager.GetButton("MoveUp"))
|
||||
|
@ -80,50 +126,60 @@ namespace src.Player
|
|||
{
|
||||
horizontal = -1;
|
||||
}
|
||||
#elif UNITY_PS4 || UNITY_XBOXONE
|
||||
// // Console movement is not supported yet.
|
||||
var movementVector = new Vector2(horizontal, vertical);
|
||||
MovePosition(movementVector);
|
||||
}
|
||||
#endif
|
||||
|
||||
var movementVector = new Vector2(horizontal, vertical).NormalizeToCross();
|
||||
|
||||
#if UNITY_PS4 || UNITY_XBOXONE
|
||||
private void HandlerControllerMovement()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void MovePosition(Vector2 movementVector)
|
||||
{
|
||||
movementVector = movementVector.NormalizeToCross();
|
||||
_animator.SetFloat(AnimHorizontal, movementVector.x);
|
||||
_animator.SetFloat(AnimVertical, movementVector.y);
|
||||
|
||||
|
||||
_rigidbody2d.MovePosition(_rigidbody2d.position + movementSpeed * Time.deltaTime * movementVector);
|
||||
}
|
||||
|
||||
private void PlaceBomb()
|
||||
{
|
||||
_bombsSpawner.PlaceBomb(transform);
|
||||
var position = transform.position;
|
||||
var absX = Mathf.RoundToInt(position.x);
|
||||
var absY = Mathf.RoundToInt(position.y);
|
||||
var newPosition = new Vector2(absX, absY);
|
||||
if (!_bombsUtil.CanPlaceBomb(newPosition)) return;
|
||||
|
||||
Instantiate(PrefabAtlas.Bomb, newPosition, Quaternion.identity);
|
||||
_bombsUtil.RegisterBomb(newPosition);
|
||||
}
|
||||
|
||||
private void HandleBombInput()
|
||||
{
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
PlaceBomb();
|
||||
}
|
||||
#elif UNITY_IOS || UNITY_ANDROID
|
||||
if (CrossPlatformInputManager.GetButton("PlaceBomb"))
|
||||
{
|
||||
PlaceBomb();
|
||||
}
|
||||
#elif UNITY_PS4 || UNITY_XBOXONE
|
||||
// Console bomb placement is not supported yet.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public void Respawn()
|
||||
{
|
||||
DebugHelper.LogInfo("Player is respawning!");
|
||||
DebugHelper.LogInfo("Player is re-spawning!");
|
||||
transform.SetPositionAndRotation(_respawnPosition.position, Quaternion.identity);
|
||||
_animator.Play("IdleDown");
|
||||
}
|
||||
|
||||
private void Die()
|
||||
{
|
||||
if (godMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_isDead = true;
|
||||
_collider2D.enabled = false;
|
||||
_animator.SetBool(AnimDeath, true);
|
||||
Destroy(gameObject, 0.7f);
|
||||
}
|
||||
|
||||
public void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
/* Turn off bomb trigger making it so you can't pass through. */
|
||||
if (other.CompareTag("Bomb"))
|
||||
{
|
||||
other.isTrigger = false;
|
||||
|
@ -142,18 +198,6 @@ namespace src.Player
|
|||
}
|
||||
}
|
||||
|
||||
private void Die()
|
||||
{
|
||||
if (godMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_isDead = true;
|
||||
_collider2D.enabled = false;
|
||||
_animator.SetBool(AnimDeath, true);
|
||||
Destroy(gameObject, 0.7f);
|
||||
}
|
||||
|
||||
public void OnExplosion()
|
||||
{
|
||||
DebugHelper.LogInfo("Player hit by explosion");
|
||||
|
|
|
@ -4,24 +4,14 @@ namespace src.Player
|
|||
{
|
||||
public class PlayerUpgrade : GameplayComponent
|
||||
{
|
||||
/* Events & Delegates */
|
||||
public delegate void IncreaseSpeedDelegate(float speed);
|
||||
public static PlayerUpgrade instance;
|
||||
public event IncreaseSpeedDelegate PlayerSpeed;
|
||||
|
||||
/* Variables */
|
||||
public const float MaxPlayerSpeed = 8f;
|
||||
private float _movementSpeed = 4f;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
else if (instance != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetMovementSpeed()
|
||||
{
|
||||
return _movementSpeed;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace src.Upgrade
|
|||
{
|
||||
public override void PerformUpgrade()
|
||||
{
|
||||
var player = PlayerUpgrade.instance;
|
||||
var player = _playerToUpgrade.GetComponent<PlayerUpgrade>();
|
||||
player.IncreaseSpeed(.5f);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue