almost fixing bombs
This commit is contained in:
parent
184e44f0e8
commit
3e77c9a8c6
22 changed files with 7727 additions and 1326 deletions
|
@ -43,7 +43,7 @@ TextureImporter:
|
|||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
alignment: 6
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 200
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
|
|
@ -98,7 +98,7 @@ TextureImporter:
|
|||
width: 128
|
||||
height: 128
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
@ -118,7 +118,7 @@ TextureImporter:
|
|||
width: 128
|
||||
height: 128
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
@ -134,11 +134,11 @@ TextureImporter:
|
|||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 256
|
||||
y: 253
|
||||
width: 128
|
||||
height: 128
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
height: 131
|
||||
alignment: 9
|
||||
pivot: {x: -0.005050569, y: 0.49665892}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
@ -158,7 +158,7 @@ TextureImporter:
|
|||
width: 128
|
||||
height: 128
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
@ -178,7 +178,7 @@ TextureImporter:
|
|||
width: 128
|
||||
height: 128
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
@ -198,7 +198,7 @@ TextureImporter:
|
|||
width: 128
|
||||
height: 128
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
|
|
@ -12,7 +12,7 @@ GameObject:
|
|||
- component: {fileID: 4177940729222266820}
|
||||
- component: {fileID: 4177940729222266823}
|
||||
- component: {fileID: 4177940729222266822}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: bman_destructible_wall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
|
|
@ -12,7 +12,7 @@ GameObject:
|
|||
- component: {fileID: 5959564480851182333}
|
||||
- component: {fileID: 5959564480851182332}
|
||||
- component: {fileID: 5959564480851182331}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: bman_wall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -69,7 +69,7 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_SortingOrder: 9
|
||||
m_Sprite: {fileID: 21300000, guid: 96d3693302b284c92ba9c394bb4f72c1, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
|
|
BIN
Assets/DevMocks/bomba denis.png
Normal file
BIN
Assets/DevMocks/bomba denis.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
99
Assets/DevMocks/bomba denis.png.meta
Normal file
99
Assets/DevMocks/bomba denis.png.meta
Normal file
|
@ -0,0 +1,99 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f437b359fb5b1914b87523070866dcc3
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 4
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 200
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: fc1da5a7a8010254fa6897e0c10c6339
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -12,9 +12,9 @@ GameObject:
|
|||
- component: {fileID: 1758273947879077417}
|
||||
- component: {fileID: 8277411166637495994}
|
||||
- component: {fileID: 1412018915745597861}
|
||||
m_Layer: 8
|
||||
m_Layer: 0
|
||||
m_Name: Bomb
|
||||
m_TagString: Untagged
|
||||
m_TagString: Bomb
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
|
@ -27,8 +27,8 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5909392949477884267}
|
||||
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_LocalPosition: {x: 0.0552, y: 0.0418, z: 0}
|
||||
m_LocalScale: {x: 1.0162, y: 0.7533, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 6508079771898401246}
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -70,8 +70,8 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 10
|
||||
m_Sprite: {fileID: 21300000, guid: 859c7170e1479c748860f3b811d14018, type: 3}
|
||||
m_SortingOrder: 9
|
||||
m_Sprite: {fileID: 21300000, guid: f437b359fb5b1914b87523070866dcc3, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
@ -81,7 +81,7 @@ SpriteRenderer:
|
|||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!114 &8277411166637495994
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -94,13 +94,8 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 6ab98bc57fd60074388e64d7af5de3df, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
timer: 5
|
||||
levelMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 256
|
||||
explosionPrefab: {fileID: 2086996798441195857, guid: 13213ac562d960e4e8c33d53d40a516c,
|
||||
type: 3}
|
||||
power: 3
|
||||
--- !u!50 &1412018915745597861
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
|
@ -109,7 +104,7 @@ Rigidbody2D:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5909392949477884267}
|
||||
m_BodyType: 0
|
||||
m_BodyType: 1
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
|
@ -121,7 +116,7 @@ Rigidbody2D:
|
|||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
m_Constraints: 4
|
||||
--- !u!1 &8683250532155440700
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -134,7 +129,7 @@ GameObject:
|
|||
- component: {fileID: 2175931883523803554}
|
||||
m_Layer: 8
|
||||
m_Name: 2DCollider
|
||||
m_TagString: Untagged
|
||||
m_TagString: Bomb
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
|
@ -148,7 +143,7 @@ Transform:
|
|||
m_GameObject: {fileID: 8683250532155440700}
|
||||
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_LocalScale: {x: 1, y: 1, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6884214445299032247}
|
||||
m_RootOrder: 0
|
||||
|
@ -166,7 +161,7 @@ BoxCollider2D:
|
|||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.009168625, y: 0}
|
||||
m_Offset: {x: 0.009168625, y: 0.045985222}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
|
@ -177,5 +172,5 @@ BoxCollider2D:
|
|||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1.1100235, y: 1}
|
||||
m_Size: {x: 1.1100235, y: 0.90802956}
|
||||
m_EdgeRadius: 0
|
||||
|
|
|
@ -11,9 +11,10 @@ GameObject:
|
|||
- component: {fileID: 2219719956326328737}
|
||||
- component: {fileID: 105666002419767893}
|
||||
- component: {fileID: 2976769454423190410}
|
||||
m_Layer: 8
|
||||
- component: {fileID: 5317321277803550577}
|
||||
m_Layer: 0
|
||||
m_Name: Explosion
|
||||
m_TagString: Untagged
|
||||
m_TagString: Explosion
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
|
@ -68,7 +69,7 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 10
|
||||
m_SortingOrder: 9
|
||||
m_Sprite: {fileID: 21300004, guid: 07d05f8fcd727b641baa0ccf95c8c770, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
|
@ -79,7 +80,7 @@ SpriteRenderer:
|
|||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!114 &2976769454423190410
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -92,3 +93,29 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 00b7acc459217644283ce8202cadcded, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!61 &5317321277803550577
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2086996798441195857}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.53872055, y: 0.5387204}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: -0.005050569, y: -0.0050504208}
|
||||
oldSize: {x: 1.0666667, y: 1.0666667}
|
||||
newSize: {x: 1.28, y: 1.28}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1.0666667, y: 1.0666667}
|
||||
m_EdgeRadius: 0
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -126,7 +126,7 @@ GameObject:
|
|||
- component: {fileID: 69346944}
|
||||
- component: {fileID: 69346946}
|
||||
- component: {fileID: 69346945}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: Tilemap
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -141,7 +141,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 69346940}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0.5, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 585332173}
|
||||
|
@ -8018,7 +8018,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 266944714}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -2.7893844}
|
||||
m_LocalPosition: {x: 0.51, y: 0.06, z: -2.7893844}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 97386695}
|
||||
|
@ -8156,7 +8156,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 519420028}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 10.241558, y: -4.0430503, z: -2.7893844}
|
||||
m_LocalPosition: {x: 7.777341, y: -4.0430503, z: -2.7893844}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -8357,6 +8357,7 @@ MonoBehaviour:
|
|||
respawnPosition: {fileID: 185746015}
|
||||
bombPrefab: {fileID: 5909392949477884267, guid: 28467e0d65b5d3844bf1862ac0c49ad9,
|
||||
type: 3}
|
||||
tilemap: {fileID: 69346943}
|
||||
--- !u!212 &1352658976
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8413,7 +8414,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1352658974}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 7.2106156}
|
||||
m_LocalPosition: {x: 0.51, y: 0.06, z: 7.2106156}
|
||||
m_LocalScale: {x: 1, y: 1, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BombController : MonoBehaviour
|
||||
public class BombController : MonoBehaviour, IExplosable
|
||||
{
|
||||
|
||||
public LayerMask levelMask;
|
||||
public GameObject explosionPrefab;
|
||||
|
||||
BombStatsUtil bombStatsUtil = BombStatsUtil.Instance;
|
||||
|
@ -21,72 +19,55 @@ public class BombController : MonoBehaviour
|
|||
{
|
||||
Instantiate(explosionPrefab, transform.position, Quaternion.identity);
|
||||
|
||||
GetComponent<SpriteRenderer>().enabled = false;
|
||||
transform.Find("2DCollider").gameObject.SetActive(false);
|
||||
|
||||
//StartCoroutine(CreateExplosions(Vector3.up));
|
||||
//StartCoroutine(CreateExplosions(Vector3.down));
|
||||
//StartCoroutine(CreateExplosions(Vector3.left));
|
||||
//StartCoroutine(CreateExplosions(Vector3.right));
|
||||
StartCoroutine(CreateExplosions(Vector3.down));
|
||||
StartCoroutine(CreateExplosions(Vector3.left));
|
||||
StartCoroutine(CreateExplosions(Vector3.up));
|
||||
StartCoroutine(CreateExplosions(Vector3.right));
|
||||
|
||||
CreateExplosions(Vector3.up);
|
||||
CreateExplosions(Vector3.down);
|
||||
CreateExplosions(Vector3.left);
|
||||
CreateExplosions(Vector3.right);
|
||||
|
||||
GetComponent<SpriteRenderer>().enabled = false;
|
||||
exploded = true;
|
||||
Destroy(gameObject, 0.3f);
|
||||
//GameObject bombObject = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
|
||||
//bombObject.GetComponent<Explosion>().Explode(transform.position);
|
||||
|
||||
//Destroy(gameObject, 0.3f);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
//private IEnumerator CreateExplosions(Vector3 direction)
|
||||
//{
|
||||
// for (int i = 1; i < bombStatsUtil.Power; i++)
|
||||
// {
|
||||
// RaycastHit2D hit = Physics2D.Raycast(transform.position + new Vector3(0, .5f, 0), direction, i, levelMask);
|
||||
|
||||
// if (!hit.collider)
|
||||
// {
|
||||
// Instantiate(explosionPrefab, transform.position + (i * direction), explosionPrefab.transform.rotation);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// yield return new WaitForSeconds(0.05f);
|
||||
|
||||
//}
|
||||
|
||||
private void CreateExplosions(Vector3 direction)
|
||||
private IEnumerator CreateExplosions(Vector3 direction)
|
||||
{
|
||||
for (int i = 1; i < bombStatsUtil.Power; i++)
|
||||
{
|
||||
RaycastHit2D hit = Physics2D.Raycast(transform.position + new Vector3(0, .5f, 0), direction, i, levelMask);
|
||||
|
||||
RaycastHit2D hit = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y), direction, i, 1 << 8);
|
||||
if (!hit.collider)
|
||||
{
|
||||
Instantiate(explosionPrefab, transform.position + (i * direction), explosionPrefab.transform.rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Collided with something");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.05f);
|
||||
|
||||
}
|
||||
|
||||
public void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!exploded && other.CompareTag("Explosion"))
|
||||
{
|
||||
onExplosion();
|
||||
}
|
||||
}
|
||||
|
||||
public void onExplosion()
|
||||
{
|
||||
//In caz ca o bomba loveste bomba, dam cancel la explozie sa nu explodeze twice si o explodam automagic
|
||||
CancelInvoke("Explode");
|
||||
Explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ using UnityEngine;
|
|||
|
||||
public class Explosion : MonoBehaviour
|
||||
{
|
||||
BombStatsUtil bombUtil = BombStatsUtil.Instance;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Destroy(gameObject, 1);
|
||||
Destroy(gameObject, bombUtil.ExplosionDuration);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
8
Assets/Scripts/src/Base/IExplosable.cs
Normal file
8
Assets/Scripts/src/Base/IExplosable.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public interface IExplosable
|
||||
{
|
||||
void onExplosion();
|
||||
}
|
11
Assets/Scripts/src/Base/IExplosable.cs.meta
Normal file
11
Assets/Scripts/src/Base/IExplosable.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1732dec3e9b48e545bba3c9910f6a1a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -3,7 +3,7 @@ using UnityEngine;
|
|||
|
||||
namespace src.Base
|
||||
{
|
||||
public abstract class PlayerBase : GameplayComponent
|
||||
public abstract class PlayerBase : GameplayComponent, IExplosable
|
||||
{
|
||||
public float movementSpeed = 4f;
|
||||
|
||||
|
@ -14,5 +14,18 @@ namespace src.Base
|
|||
{
|
||||
Rigidbody2d = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
public void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Explosion"))
|
||||
{
|
||||
onExplosion();
|
||||
}
|
||||
}
|
||||
|
||||
public void onExplosion()
|
||||
{
|
||||
Debug.Log("Player hit by explosion");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 55804228f3fc40ad8c5e0992ea925b1c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using src.Base;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
namespace src.Player
|
||||
{
|
||||
|
@ -8,9 +9,10 @@ namespace src.Player
|
|||
{
|
||||
public Transform respawnPosition;
|
||||
|
||||
|
||||
public GameObject bombPrefab;
|
||||
|
||||
public Tilemap tilemap;
|
||||
|
||||
protected new void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
@ -57,9 +59,10 @@ namespace src.Player
|
|||
|
||||
private void PlaceBomb()
|
||||
{
|
||||
Instantiate(bombPrefab, new Vector3(Mathf.RoundToInt(transform.position.x),
|
||||
bombPrefab.transform.position.y, 0f),
|
||||
bombPrefab.transform.rotation);
|
||||
Vector3Int cell = tilemap.WorldToCell(transform.position);
|
||||
Vector3 cellCenterPos = tilemap.GetCellCenterWorld(cell);
|
||||
|
||||
Instantiate(bombPrefab, cellCenterPos, Quaternion.identity);
|
||||
}
|
||||
|
||||
private void HandleBomb()
|
||||
|
@ -80,5 +83,14 @@ namespace src.Player
|
|||
{
|
||||
transform.position = respawnPosition.position;
|
||||
}
|
||||
|
||||
public void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Bomb"))
|
||||
{
|
||||
|
||||
other.isTrigger = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,11 +11,7 @@ public sealed class BombStatsUtil
|
|||
|
||||
public float Timer { get; } = 3.0f;
|
||||
|
||||
// Explicit static constructor to tell C# compiler
|
||||
// not to mark type as beforefieldinit
|
||||
static BombStatsUtil()
|
||||
{
|
||||
}
|
||||
public float ExplosionDuration { get; } = 0.55f;
|
||||
|
||||
private BombStatsUtil()
|
||||
{
|
||||
|
|
|
@ -39,11 +39,11 @@ Physics2DSettings:
|
|||
m_IslandSolverBodiesPerJob: 50
|
||||
m_IslandSolverContactsPerJob: 50
|
||||
m_AutoSimulation: 1
|
||||
m_QueriesHitTriggers: 1
|
||||
m_QueriesHitTriggers: 0
|
||||
m_QueriesStartInColliders: 0
|
||||
m_CallbacksOnDisable: 1
|
||||
m_ReuseCollisionCallbacks: 1
|
||||
m_AutoSyncTransforms: 0
|
||||
m_ReuseCollisionCallbacks: 0
|
||||
m_AutoSyncTransforms: 1
|
||||
m_AlwaysShowColliders: 0
|
||||
m_ShowColliderSleep: 1
|
||||
m_ShowColliderContacts: 0
|
||||
|
@ -53,4 +53,4 @@ Physics2DSettings:
|
|||
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
|
||||
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
|
||||
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
|
||||
m_LayerCollisionMatrix: fffbfffffffbfffffbfbfffffffffffffffbfffffffbffffffffffffffffffffffffffffffffffffc8fbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
m_LayerCollisionMatrix: fffbfffffffbfffffffbfffffffffffffffbfffffffbfffffffffffffffffffffffbffffffffffffc8faffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
|
|
|
@ -29,9 +29,16 @@ QualitySettings:
|
|||
vSyncCount: 0
|
||||
lodBias: 0.3
|
||||
maximumLODLevel: 0
|
||||
streamingMipmapsActive: 0
|
||||
streamingMipmapsAddAllCameras: 1
|
||||
streamingMipmapsMemoryBudget: 512
|
||||
streamingMipmapsRenderersPerFrame: 512
|
||||
streamingMipmapsMaxLevelReduction: 2
|
||||
streamingMipmapsMaxFileIORequests: 1024
|
||||
particleRaycastBudget: 4
|
||||
asyncUploadTimeSlice: 2
|
||||
asyncUploadBufferSize: 16
|
||||
asyncUploadPersistentBuffer: 1
|
||||
resolutionScalingFixedDPIFactor: 1
|
||||
excludedTargetPlatforms: []
|
||||
- serializedVersion: 2
|
||||
|
@ -57,9 +64,16 @@ QualitySettings:
|
|||
vSyncCount: 0
|
||||
lodBias: 0.4
|
||||
maximumLODLevel: 0
|
||||
streamingMipmapsActive: 0
|
||||
streamingMipmapsAddAllCameras: 1
|
||||
streamingMipmapsMemoryBudget: 512
|
||||
streamingMipmapsRenderersPerFrame: 512
|
||||
streamingMipmapsMaxLevelReduction: 2
|
||||
streamingMipmapsMaxFileIORequests: 1024
|
||||
particleRaycastBudget: 16
|
||||
asyncUploadTimeSlice: 2
|
||||
asyncUploadBufferSize: 16
|
||||
asyncUploadPersistentBuffer: 1
|
||||
resolutionScalingFixedDPIFactor: 1
|
||||
excludedTargetPlatforms: []
|
||||
- serializedVersion: 2
|
||||
|
@ -85,9 +99,16 @@ QualitySettings:
|
|||
vSyncCount: 1
|
||||
lodBias: 0.7
|
||||
maximumLODLevel: 0
|
||||
streamingMipmapsActive: 0
|
||||
streamingMipmapsAddAllCameras: 1
|
||||
streamingMipmapsMemoryBudget: 512
|
||||
streamingMipmapsRenderersPerFrame: 512
|
||||
streamingMipmapsMaxLevelReduction: 2
|
||||
streamingMipmapsMaxFileIORequests: 1024
|
||||
particleRaycastBudget: 64
|
||||
asyncUploadTimeSlice: 2
|
||||
asyncUploadBufferSize: 16
|
||||
asyncUploadPersistentBuffer: 1
|
||||
resolutionScalingFixedDPIFactor: 1
|
||||
excludedTargetPlatforms: []
|
||||
- serializedVersion: 2
|
||||
|
@ -113,9 +134,16 @@ QualitySettings:
|
|||
vSyncCount: 1
|
||||
lodBias: 1
|
||||
maximumLODLevel: 0
|
||||
streamingMipmapsActive: 0
|
||||
streamingMipmapsAddAllCameras: 1
|
||||
streamingMipmapsMemoryBudget: 512
|
||||
streamingMipmapsRenderersPerFrame: 512
|
||||
streamingMipmapsMaxLevelReduction: 2
|
||||
streamingMipmapsMaxFileIORequests: 1024
|
||||
particleRaycastBudget: 256
|
||||
asyncUploadTimeSlice: 2
|
||||
asyncUploadBufferSize: 16
|
||||
asyncUploadPersistentBuffer: 1
|
||||
resolutionScalingFixedDPIFactor: 1
|
||||
excludedTargetPlatforms: []
|
||||
- serializedVersion: 2
|
||||
|
@ -141,9 +169,16 @@ QualitySettings:
|
|||
vSyncCount: 1
|
||||
lodBias: 1.5
|
||||
maximumLODLevel: 0
|
||||
streamingMipmapsActive: 0
|
||||
streamingMipmapsAddAllCameras: 1
|
||||
streamingMipmapsMemoryBudget: 512
|
||||
streamingMipmapsRenderersPerFrame: 512
|
||||
streamingMipmapsMaxLevelReduction: 2
|
||||
streamingMipmapsMaxFileIORequests: 1024
|
||||
particleRaycastBudget: 1024
|
||||
asyncUploadTimeSlice: 2
|
||||
asyncUploadBufferSize: 16
|
||||
asyncUploadPersistentBuffer: 1
|
||||
resolutionScalingFixedDPIFactor: 1
|
||||
excludedTargetPlatforms: []
|
||||
- serializedVersion: 2
|
||||
|
@ -169,23 +204,16 @@ QualitySettings:
|
|||
vSyncCount: 1
|
||||
lodBias: 2
|
||||
maximumLODLevel: 0
|
||||
streamingMipmapsActive: 0
|
||||
streamingMipmapsAddAllCameras: 1
|
||||
streamingMipmapsMemoryBudget: 512
|
||||
streamingMipmapsRenderersPerFrame: 512
|
||||
streamingMipmapsMaxLevelReduction: 2
|
||||
streamingMipmapsMaxFileIORequests: 1024
|
||||
particleRaycastBudget: 4096
|
||||
asyncUploadTimeSlice: 2
|
||||
asyncUploadBufferSize: 16
|
||||
asyncUploadPersistentBuffer: 1
|
||||
resolutionScalingFixedDPIFactor: 1
|
||||
excludedTargetPlatforms: []
|
||||
m_PerPlatformDefaultQuality:
|
||||
Android: 2
|
||||
Nintendo 3DS: 5
|
||||
Nintendo Switch: 5
|
||||
PS4: 5
|
||||
PSM: 5
|
||||
PSP2: 2
|
||||
Standalone: 5
|
||||
Tizen: 2
|
||||
WebGL: 3
|
||||
WiiU: 5
|
||||
Windows Store Apps: 5
|
||||
XboxOne: 5
|
||||
iPhone: 2
|
||||
tvOS: 2
|
||||
m_PerPlatformDefaultQuality: {}
|
||||
|
|
|
@ -5,6 +5,7 @@ TagManager:
|
|||
serializedVersion: 2
|
||||
tags:
|
||||
- Explosion
|
||||
- Bomb
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
UnityConnectSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 1
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_TestMode: 0
|
||||
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
|
||||
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
|
||||
|
|
Loading…
Reference in a new issue