任务:搭建基本的系统

1.搭建地藏测试场景
(1.放置单向平台
(2.限制摄像机范围
(3.设置相机跟踪
(4.放置图片素材

2.编写地藏boss逻辑
(1.继承自Enemy(内含基本的变量和事件)
(2.当玩家进入戒备范围,startContinue攻击功能

3.创建塞钱箱脚本
This commit is contained in:
Roman 2021-12-08 18:56:47 +08:00
parent 1619bedd77
commit 83f327571f
18 changed files with 3224 additions and 16 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bb3ae1879e9805b4cb5101b71e80cbd4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1123,7 +1123,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!61 &659041641
BoxCollider2D:
m_ObjectHideFlags: 0
@ -1463,7 +1463,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!61 &906466580
BoxCollider2D:
m_ObjectHideFlags: 0
@ -1610,6 +1610,7 @@ MonoBehaviour:
atkPositionOffset: 0.5
atkRange: 3
lightningAttack: {fileID: 5890479828300330397, guid: 7ed7629552eb2f146af80d04ebcb7691, type: 3}
distanceToPlayer: 0
--- !u!50 &906466585
Rigidbody2D:
serializedVersion: 4

93
Assets/Scripts/DiZang.cs Normal file
View File

@ -0,0 +1,93 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;
/// <summary>
/// 地藏Boss类继承于Enemy
/// </summary>
public class DiZang : Enemy
{
// _____ _ _ _
// | __ \ | | | (_)
// | |__) | _| |__ | |_ ___
// | ___/ | | | '_ \| | |/ __|
// | | | |_| | |_) | | | (__
// |_| \__,_|_.__/|_|_|\___|
/// <summary>
/// 攻击之间的间隔时间
/// </summary>
[Header("攻击之间的间隔时间")][FoldoutGroup("地藏")]
public float timeBetweenAttacks;
/// <summary>
/// 塞钱箱
/// </summary>
private MoneyBox moneyBox;
private delegate IEnumerator Action();
private enum PlayerState{,};
private MyPlayer player;
/// <summary>
/// 到底在上面还是下面生成爱欲品的玩家位置Y轴的界限
/// </summary>
[Header("到底在上面还是下面生成爱欲品的玩家位置Y轴的界限")]
public float aiYuPinBuildLimit;
private void Init(){
moneyBox = FindObjectOfType<MoneyBox>();
player = FindObjectOfType<MyPlayer>();
}
protected override void OnFindThePlayer(Transform target){
if(state == State.wander){
state = State.atk;
StartCoroutine("ATK");
}
}
void Start(){
Init();
}
private new IEnumerator ATK(){
//等待攻击间隔
yield return new WaitForSeconds(timeBetweenAttacks);
//决定行动
//如果有钱,则执行拿钱
if(moneyBox.hasMoney)StartCoroutine(TakeTheMoney());
else{
//否则,随机执行召唤或者敲钟
Action action =
((Random.Range(-1f,1f) > 0) ? (Action)RingTheBell : (Action)CallAiYuPin);
StartCoroutine(action());
}
}
/// <summary>
/// 召唤爱欲品的时候Call这个
/// </summary>
private IEnumerator CallAiYuPin(){
yield return new WaitForEndOfFrame();
//确定玩家在上半边还是下半边
PlayerState playerState =
((player.transform.position.y > aiYuPinBuildLimit) ? PlayerState.: PlayerState.);
}
/// <summary>
/// 敲钟的时候Call这个
/// </summary>
private IEnumerator RingTheBell(){
yield return new WaitForEndOfFrame();
Debug.Log("地藏正在敲钟");
}
/// <summary>
/// 拿钱的时候Call这个
/// </summary>
private IEnumerator TakeTheMoney(){
yield return new WaitForEndOfFrame();
Debug.Log("地藏正在拿钱");
}
}

View File

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

View File

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 塞钱箱类
/// </summary>
public class MoneyBox : MonoBehaviour
{
/// <summary>
/// 箱子里有钱吗?
/// </summary>
public bool hasMoney = false;
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: 45468251348e26f44b5c7755ea556758
TextureImporter:
internalIDToNameTable: []
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: 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: 125
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
- serializedVersion: 3
buildTarget: iPhone
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: Android
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: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -46,7 +46,7 @@ TextureImporter:
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spritePixelsToUnits: 250
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
@ -75,6 +75,42 @@ TextureImporter:
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
- serializedVersion: 3
buildTarget: iPhone
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: Android
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: []

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: e8adba42a6cfb3e46820742b142996cc
TextureImporter:
internalIDToNameTable: []
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: 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: 100
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
spriteSheet:
serializedVersion: 2
sprites: []
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: 22 KiB

View File

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 42cc7748065ae884da1c46ee1245dd05
TextureImporter:
internalIDToNameTable: []
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: 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: 100
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

8
Assets/材质.meta Normal file
View File

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

View File

@ -0,0 +1,11 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u5149\u6ED1"
friction: 0
bounciness: 0

View File

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

View File

@ -6,35 +6,35 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 22424703114646680c031c2e1530103918070d3e6c1b3f23392c107cb3ae6476b0a805e0ea2a33397926ea310b713236ff1a050ed20e07042e3bee071ff8311005cc17cb09860a12c20d05
flags: 0
RecentlyUsedScenePath-1:
value: 22424703114646680c031c2e1530103918070d3e6c1b3f23392c107cb3ae6476b0a805e0ea2a33397926ea310b713236ff1a050ed20e07042e3bee071ff8311005cc17cb3bdb0c19df5709c0c409c8
flags: 0
RecentlyUsedScenePath-2:
RecentlyUsedScenePath-1:
value: 224247031146466b011b0b2b1e3010231f051d242530691428241220adcf3031eca71fe7f42a3a3f2d0dfd73373d0431f745584bbb4b250f1800bd2f05eb021a13d00cc00988300ace0b0ac7c80a9ff6dbdfc0f3
flags: 0
RecentlyUsedScenePath-3:
RecentlyUsedScenePath-2:
value: 224247031146467f08030525192251045933371e3b2d233e1d3b1273c7f83535f2eb33faa81e10082e07ea32343f1537bc1f0702e212
flags: 0
RecentlyUsedScenePath-4:
RecentlyUsedScenePath-3:
value: 224247031146467f08030525192251045933371e3b2d233e1d3b1273c7f83535f2eb33faa81e10082e07ea3225300832f31e0004f834280a0207fe1d5fea1e1a05dc
flags: 0
RecentlyUsedScenePath-5:
RecentlyUsedScenePath-4:
value: 224247031146467f08030525192251045933371e3b2d233e1d3b1273c7f83535f2eb33faa81e10082e07ea3225300832f31e0004f8342b0f070ff30d14fb5e061fcc0cdc
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c4b150503563f22213229
flags: 0
RecentlyUsedScenePath-7:
RecentlyUsedScenePath-5:
value: 224247031146466b011b0b2b1e301034131a112d25292824620d3207f5e53136d2f539a9c2223e31290eea2f4b1a2e0be50f0c05c60a1e035f1bf30705e6
flags: 0
RecentlyUsedScenePath-8:
RecentlyUsedScenePath-6:
value: 224247031146466b011b0b2b1e301034131a112d25292824620d3207f5e53136d2f539a9c2223e31290eea2f4b1a2e0be50f0c05d7050306101af4011fc0321202cc1bd654dd1115df00
flags: 0
RecentlyUsedScenePath-9:
RecentlyUsedScenePath-7:
value: 224247031146466b011b0b2b1e301034131a112d25292824620d3207f5e53136d2f539a9c2223e31290eea2f4b1a2e0be50f0c05d7050306101af4011fc0311707c416c61fcc5109c51008d7
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c4b150503563f22213229
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b192c16162d1f3c2737281d1820f6ae2136ebf32f
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0