init: version 1
This commit is contained in:
94
Assets/Prefabs/Spawnpoint/RespawnZone.prefab
Normal file
94
Assets/Prefabs/Spawnpoint/RespawnZone.prefab
Normal file
@@ -0,0 +1,94 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &8526237357692327426
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3560405365753002508}
|
||||
- component: {fileID: 1628214146249607796}
|
||||
- component: {fileID: 3291358470973981756}
|
||||
m_Layer: 0
|
||||
m_Name: RespawnZone
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3560405365753002508
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8526237357692327426}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -3, z: 0}
|
||||
m_LocalScale: {x: 100, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &1628214146249607796
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8526237357692327426}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ForceReceiveLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ContactCaptureLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_CallbackLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_CompositeOperation: 0
|
||||
m_CompositeOrder: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0.48400003, z: 0, w: 0.48600003}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1.024, y: 1.024}
|
||||
newSize: {x: 1.024, y: 1.024}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 2
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &3291358470973981756
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8526237357692327426}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7375580a7f6e8451d89987abc46838b3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
spawnpoint: {fileID: 0}
|
||||
7
Assets/Prefabs/Spawnpoint/RespawnZone.prefab.meta
Normal file
7
Assets/Prefabs/Spawnpoint/RespawnZone.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0e0b86dce8ad2133a2ad50f8b02713d
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Prefabs/Spawnpoint/Scripts.meta
Normal file
8
Assets/Prefabs/Spawnpoint/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d40f38c1a45f72b78fea4eaa08b4468
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
Assets/Prefabs/Spawnpoint/Scripts/RespawnZone.cs
Normal file
21
Assets/Prefabs/Spawnpoint/Scripts/RespawnZone.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// RespawnPlane is a trigger zone that respawns the player or cube
|
||||
/// when they enter the zone.
|
||||
/// </summary>
|
||||
public class RespawnPlane : MonoBehaviour
|
||||
{
|
||||
[Header("Configuration")]
|
||||
public Spawnpoint spawnpoint;
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other) {
|
||||
if (other.gameObject.CompareTag("Player")) {
|
||||
spawnpoint.Respawn();
|
||||
}
|
||||
|
||||
if (other.gameObject.CompareTag("Cube")) {
|
||||
other.GetComponent<CubeController>().Respawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Prefabs/Spawnpoint/Scripts/RespawnZone.cs.meta
Normal file
2
Assets/Prefabs/Spawnpoint/Scripts/RespawnZone.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7375580a7f6e8451d89987abc46838b3
|
||||
44
Assets/Prefabs/Spawnpoint/Scripts/Spawnpoint.cs
Normal file
44
Assets/Prefabs/Spawnpoint/Scripts/Spawnpoint.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Spawnpoint marks the start location of the player and
|
||||
/// is responsible for respawning the player when needed.
|
||||
/// </summary>
|
||||
public class Spawnpoint : MonoBehaviour
|
||||
{
|
||||
[Header("Configuration")]
|
||||
public Vector2 offset = new (0f, 0.5f);
|
||||
public int mapIdx;
|
||||
|
||||
private GameObject _player;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_player = GameObject.FindWithTag("Player");
|
||||
Respawn();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!Input.GetKeyDown(KeyCode.R)) return;
|
||||
Respawn();
|
||||
}
|
||||
|
||||
public void Respawn()
|
||||
{
|
||||
_player.transform.position = new Vector3(
|
||||
transform.position.x + offset.x,
|
||||
transform.position.y + offset.y,
|
||||
_player.transform.position.z
|
||||
);
|
||||
_player.GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
||||
|
||||
GameManager gameManager = GameManager.Instance;
|
||||
if (gameManager.currentMapIdx != mapIdx)
|
||||
{
|
||||
gameManager.currentMapIdx = mapIdx;
|
||||
gameManager.SwitchMap(mapIdx);
|
||||
}
|
||||
gameManager.onRespawn.Invoke();
|
||||
}
|
||||
}
|
||||
2
Assets/Prefabs/Spawnpoint/Scripts/Spawnpoint.cs.meta
Normal file
2
Assets/Prefabs/Spawnpoint/Scripts/Spawnpoint.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b02938f59b4be2cc0a4f04d24007bb2a
|
||||
103
Assets/Prefabs/Spawnpoint/Spawnpoint.prefab
Normal file
103
Assets/Prefabs/Spawnpoint/Spawnpoint.prefab
Normal file
@@ -0,0 +1,103 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3067766962208458182
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7458693846344304161}
|
||||
- component: {fileID: 3656851013564034683}
|
||||
- component: {fileID: 5739676784955454971}
|
||||
m_Layer: 0
|
||||
m_Name: Spawnpoint
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7458693846344304161
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3067766962208458182}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.15, z: 0.05}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3656851013564034683
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3067766962208458182}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
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: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 70eb69b4da8832bf796bd76cef0770db, 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_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &5739676784955454971
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3067766962208458182}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b02938f59b4be2cc0a4f04d24007bb2a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
offset: {x: 0, y: 0.5}
|
||||
7
Assets/Prefabs/Spawnpoint/Spawnpoint.prefab.meta
Normal file
7
Assets/Prefabs/Spawnpoint/Spawnpoint.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1840cee6e441ce890b733edbe5c66abc
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Prefabs/Spawnpoint/Sprites.meta
Normal file
8
Assets/Prefabs/Spawnpoint/Sprites.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc3f92fedcfecc0ad8e31eb7baf00733
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Prefabs/Spawnpoint/Sprites/Spawnpoint.png
Normal file
BIN
Assets/Prefabs/Spawnpoint/Sprites/Spawnpoint.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
156
Assets/Prefabs/Spawnpoint/Sprites/Spawnpoint.png.meta
Normal file
156
Assets/Prefabs/Spawnpoint/Sprites/Spawnpoint.png.meta
Normal file
@@ -0,0 +1,156 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70eb69b4da8832bf796bd76cef0770db
|
||||
TextureImporter:
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
213: 2102268837733502258
|
||||
second: Spawnpoint_0
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 700
|
||||
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
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: Spawnpoint_0
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 8
|
||||
y: 373
|
||||
width: 1016
|
||||
height: 201
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 23d8a7f9e52cc2d10800000000000000
|
||||
internalID: 2102268837733502258
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable:
|
||||
Spawnpoint_0: 2102268837733502258
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Prefabs/Spawnpoint/Sprites/Spawnpoint.png~
Normal file
BIN
Assets/Prefabs/Spawnpoint/Sprites/Spawnpoint.png~
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Reference in New Issue
Block a user