Added basic breakable object

This commit is contained in:
alilas2 2022-04-25 21:41:47 +02:00
parent c9e82d739b
commit 0fdbf17098
17 changed files with 1361 additions and 769 deletions

View File

@ -49,6 +49,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\Enemy.cs" /> <Compile Include="Assets\Scripts\Enemies&apos; Scprits\Enemy.cs" />
<Compile Include="Assets\Scripts\CamerFollow.cs" /> <Compile Include="Assets\Scripts\CamerFollow.cs" />
<Compile Include="Assets\breakable.cs" />
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\PatrolBat.cs" /> <Compile Include="Assets\Scripts\Enemies&apos; Scprits\PatrolBat.cs" />
<Compile Include="Assets\Controller.cs" /> <Compile Include="Assets\Controller.cs" />
<Compile Include="Assets\Scripts\Objects&apos; Scripts\Chest.cs" /> <Compile Include="Assets\Scripts\Objects&apos; Scripts\Chest.cs" />

View File

@ -1015,6 +1015,26 @@ Tilemap:
m_TileObjectToInstantiateIndex: 65535 m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0 dummyAlignment: 0
m_AllTileFlags: 1073741825 m_AllTileFlags: 1073741825
- first: {x: 28, y: -23, z: 0}
second:
serializedVersion: 2
m_TileIndex: 668
m_TileSpriteIndex: 668
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 1073741825
- first: {x: 32, y: -23, z: 0}
second:
serializedVersion: 2
m_TileIndex: 669
m_TileSpriteIndex: 668
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 1073741825
- first: {x: -1, y: -21, z: 0} - first: {x: -1, y: -21, z: 0}
second: second:
serializedVersion: 2 serializedVersion: 2
@ -8103,6 +8123,10 @@ Tilemap:
m_Data: {fileID: 11400000, guid: 232ee1fb8f5d8d74982762692f0558da, type: 2} m_Data: {fileID: 11400000, guid: 232ee1fb8f5d8d74982762692f0558da, type: 2}
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 11400000, guid: 0d78f66216d05bf45badd0e6ebac5642, type: 2} m_Data: {fileID: 11400000, guid: 0d78f66216d05bf45badd0e6ebac5642, type: 2}
- m_RefCount: 1
m_Data: {fileID: 11400000, guid: 7952b82853f2d514b959d9d22190cf46, type: 2}
- m_RefCount: 1
m_Data: {fileID: 11400000, guid: d5a6f98c3b770144f99d82460feccc92, type: 2}
m_TileSpriteArray: m_TileSpriteArray:
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 3348532550563196407, guid: 3a08fefc7df696140a7a44798f351457, type: 3} m_Data: {fileID: 3348532550563196407, guid: 3a08fefc7df696140a7a44798f351457, type: 3}
@ -9440,8 +9464,10 @@ Tilemap:
m_Data: {fileID: 3936996507482040932, guid: fa69deb4ddceb0445a9554c041267090, type: 3} m_Data: {fileID: 3936996507482040932, guid: fa69deb4ddceb0445a9554c041267090, type: 3}
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 8959118705387878318, guid: 25e473b59d2d7534e803be0a2825e0f7, type: 3} m_Data: {fileID: 8959118705387878318, guid: 25e473b59d2d7534e803be0a2825e0f7, type: 3}
- m_RefCount: 2
m_Data: {fileID: 21300000, guid: d49fe613a772fe84a869f678ed5bb8f3, type: 3}
m_TileMatrixArray: m_TileMatrixArray:
- m_RefCount: 668 - m_RefCount: 670
m_Data: m_Data:
e00: 1 e00: 1
e01: 0 e01: 0
@ -9460,7 +9486,7 @@ Tilemap:
e32: 0 e32: 0
e33: 1 e33: 1
m_TileColorArray: m_TileColorArray:
- m_RefCount: 668 - m_RefCount: 670
m_Data: {r: 1, g: 1, b: 1, a: 1} m_Data: {r: 1, g: 1, b: 1, a: 1}
m_TileObjectToInstantiateArray: [] m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1 m_AnimationFrameRate: 1
@ -9527,14 +9553,14 @@ TilemapRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_ChunkSize: {x: 32, y: 32, z: 32} m_ChunkSize: {x: 32, y: 32, z: 32}
m_ChunkCullingBounds: {x: 0, y: 0, z: 0} m_ChunkCullingBounds: {x: 0.5, y: 0.5, z: 0}
m_MaxChunkCount: 16 m_MaxChunkCount: 16
m_MaxFrameAge: 16 m_MaxFrameAge: 16
m_SortOrder: 0 m_SortOrder: 0
m_Mode: 0 m_Mode: 0
m_DetectChunkCullingBounds: 0 m_DetectChunkCullingBounds: 0
m_MaskInteraction: 0 m_MaskInteraction: 0
--- !u!114 &5446010215284625506 --- !u!114 &8220248115746659994
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}

View File

@ -0,0 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 13312, guid: 0000000000000000e000000000000000, type: 0}
m_Name: ROCK2
m_EditorClassIdentifier:
m_Sprite: {fileID: 21300000, guid: d49fe613a772fe84a869f678ed5bb8f3, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Transform:
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_InstancedGameObject: {fileID: 0}
m_Flags: 1
m_ColliderType: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7952b82853f2d514b959d9d22190cf46
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f91efc3db8124e4799a440c56b34652
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,37 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ROCK1
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 42da126ad585e5f4c977454305151df8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- PixelSnap: 0
- _EnableExternalAlpha: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f35194ee918dde445a4ebd3b93c011ee
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e8dda65697e46244193b5ad16b2d6cca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: 352b18285249a3f44a85026b80d75f52
TextureImporter:
internalIDToNameTable:
- first:
213: 6561149998582627035
second: ROCK2_0
externalObjects: {}
serializedVersion: 11
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
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 32
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: ROCK2_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: bda72974923ed0b50800000000000000
internalID: 6561149998582627035
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: 84161e428e03d944b818d9a5a5a20f45
TextureImporter:
internalIDToNameTable:
- first:
213: -2809657706712184468
second: ROCK3_0
externalObjects: {}
serializedVersion: 11
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
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 32
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: ROCK3_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: c694bf2b3371209d0800000000000000
internalID: -2809657706712184468
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: ecf31a6807f97e9488454a9c4584be91
TextureImporter:
internalIDToNameTable:
- first:
213: 2182001056168252113
second: ROCK4_0
externalObjects: {}
serializedVersion: 11
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
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 32
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: ROCK4_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 1d29f6c5666084e10800000000000000
internalID: 2182001056168252113
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

50
Assets/breakable.cs Normal file
View File

@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class breakable : MonoBehaviour
{
public Sprite[] sprites;
private int oldSprite;
private int newSprite;
private List<int> availableSprites = new List<int>();
void Start()
{
oldSprite = 0;
for(int i=0; i<3; i++)
{
availableSprites.Add(i);
}
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Player")
{
if (oldSprite == 0)
{
newSprite = availableSprites[1];
oldSprite = 1;
GetComponent<SpriteRenderer>().sprite = sprites[newSprite];
}
else if (oldSprite == 1)
{
newSprite = availableSprites[2];
oldSprite = 2;
GetComponent<SpriteRenderer>().sprite = sprites[newSprite];
}
else if (oldSprite == 2)
{
Destroy(gameObject);
}
GetComponent<SpriteRenderer>().sprite = sprites[newSprite];
}
}
}

11
Assets/breakable.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6525aab418780094b945c897f66e0cb4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: