提交人物

This commit is contained in:
DESKTOP-DDTRVOR\asus 2024-12-22 20:56:03 +08:00
parent 84cecc83af
commit 34cb342fd2
21 changed files with 633 additions and 9 deletions

View File

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

View File

@ -0,0 +1,62 @@
tj_hero_1.png
size: 256, 256
filter: Linear, Linear
pma: true
mod_1/Down_syndrome_a_01
bounds: 96, 232, 24, 22
offsets: 0, 1, 24, 23
mod_1/Down_syndrome_a_02
bounds: 96, 122, 22, 21
offsets: 1, 0, 30, 21
mod_1/Down_syndrome_a_04
bounds: 188, 162, 66, 83
offsets: 1, 0, 68, 83
rotate: 180
mod_1/Down_syndrome_a_05
bounds: 2, 121, 57, 32
rotate: 90
mod_1/Down_syndrome_a_06
bounds: 181, 222, 25, 32
mod_1/Down_syndrome_a_07
bounds: 73, 112, 24, 31
offsets: 0, 1, 24, 32
mod_2/Down_syndrome_b_01
bounds: 2, 199, 17, 24
offsets: 0, 1, 17, 25
mod_2/Down_syndrome_b_02
bounds: 234, 228, 18, 26
offsets: 0, 0, 22, 26
mod_2/Down_syndrome_b_03
bounds: 107, 179, 92, 75
offsets: 0, 0, 96, 75
mod_2/Down_syndrome_b_04
bounds: 44, 144, 77, 57
offsets: 1, 0, 86, 61
rotate: 180
mod_2/Down_syndrome_b_05
bounds: 2, 184, 19, 13
offsets: 1, 3, 21, 17
mod_2/Down_syndrome_b_06
bounds: 202, 148, 18, 13
offsets: 1, 1, 20, 15
mod_2/Down_syndrome_b_07
bounds: 183, 121, 31, 14
mod_2/Down_syndrome_b_08
bounds: 118, 122, 31, 14
mod_3/Down_syndrome_c_01
bounds: 2, 177, 105, 77
mod_3/Down_syndrome_c_02
bounds: 214, 108, 55, 40
offsets: 0, 0, 55, 41
rotate: 270
mod_3/Down_syndrome_c_03
bounds: 130, 135, 79, 50
offsets: 0, 0, 80, 50
rotate: 180
mod_3/Down_syndrome_c_04
bounds: 36, 109, 36, 34
offsets: 0, 7, 36, 41
mod_3/Down_syndrome_c_05
bounds: 109, 148, 38, 38
offsets: 0, 8, 41, 46
rotate: 90

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5a0b745f2cddc2c468a7d0d72a68bc24
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: e0ca814bbf042854e96e49b63e1ccf14
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
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: 0
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: 0
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: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 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
ignorePlatformSupport: 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
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 41a49edcea4de4a4fbb5c565adeb4a1d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,19 @@
%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: 11500000, guid: a6b194f808b1af6499c93410e504af42, type: 3}
m_Name: tj_hero_1_Atlas
m_EditorClassIdentifier:
textureLoadingMode: 0
onDemandTextureLoader: {fileID: 0}
atlasFile: {fileID: 4900000, guid: 5a0b745f2cddc2c468a7d0d72a68bc24, type: 3}
materials:
- {fileID: 2100000, guid: 6725147e599ea0b4dbac880ae30c8621, type: 2}

View File

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

View File

@ -0,0 +1,47 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: tj_hero_1_Material
m_Shader: {fileID: 4800000, guid: 1e8a610c9e01c3648bac42585e5fc676, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _USE8NEIGHBOURHOOD_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: e0ca814bbf042854e96e49b63e1ccf14, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Cutoff: 0.1
- _OutlineMipLevel: 0
- _OutlineOpaqueAlpha: 1
- _OutlineReferenceTexWidth: 1024
- _OutlineSmoothness: 1
- _OutlineWidth: 3
- _StencilComp: 8
- _StencilRef: 1
- _StraightAlphaInput: 0
- _ThresholdEnd: 0.25
- _Use8Neighbourhood: 1
- _UseScreenSpaceOutlineWidth: 0
m_Colors:
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}
m_BuildTextureStacks: []

View File

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

View File

@ -0,0 +1,31 @@
%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: 11500000, guid: f1b3b4b945939a54ea0b23d3396115fb, type: 3}
m_Name: tj_hero_1_SkeletonData
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: fd32cc97b4fcd5c419eaaf1285b57499, type: 2}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: 41a49edcea4de4a4fbb5c565adeb4a1d, type: 3}
isUpgradingBlendModeMaterials: 0
blendModeMaterials:
requiresBlendModeMaterials: 0
applyAdditiveMaterial: 1
additiveMaterials: []
multiplyMaterials: []
screenMaterials: []
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []
defaultMix: 0.2
controller: {fileID: 0}

View File

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

View File

@ -19,7 +19,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!4 &7977988578914188099 --- !u!4 &7977988578914188099
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -32,7 +32,8 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 5, y: 5, z: 1} m_LocalScale: {x: 5, y: 5, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 1478377139574713313}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2859255379752948725 --- !u!212 &2859255379752948725
@ -42,7 +43,7 @@ SpriteRenderer:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5832841353692456753} m_GameObject: {fileID: 5832841353692456753}
m_Enabled: 1 m_Enabled: 0
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
@ -99,6 +100,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 08c739e0deb0ffc468a5e540d85493d6, type: 3} m_Script: {fileID: 11500000, guid: 08c739e0deb0ffc468a5e540d85493d6, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
spine: {fileID: 3155688350780693135}
_gameObjects: [] _gameObjects: []
--- !u!50 &4310192076672108997 --- !u!50 &4310192076672108997
Rigidbody2D: Rigidbody2D:
@ -172,3 +174,130 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1.32, y: 2.52} m_Size: {x: 1.32, y: 2.52}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!1 &7386679716242520326
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1478377139574713313}
- component: {fileID: 615415070507549536}
- component: {fileID: 5563626748660114664}
- component: {fileID: 3155688350780693135}
m_Layer: 0
m_Name: Spine GameObject (tj_hero_1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1478377139574713313
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7386679716242520326}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.0317, y: -1.1631, z: 0}
m_LocalScale: {x: 1.7999139, y: 1.7999139, z: 1.7999139}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7977988578914188099}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &615415070507549536
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7386679716242520326}
m_Mesh: {fileID: 0}
--- !u!23 &5563626748660114664
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7386679716242520326}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6725147e599ea0b4dbac880ae30c8621, 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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &3155688350780693135
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7386679716242520326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: 5a5ac7f7cd23e76469b09537210c3e51, type: 2}
initialSkinName: mod_1
fixPrefabOverrideViaMeshFilter: 2
initialFlipX: 0
initialFlipY: 0
updateWhenInvisible: 3
separatorSlotNames: []
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
fixDrawOrder: 0
addNormals: 0
calculateTangents: 0
maskInteraction: 0
maskMaterials:
materialsMaskDisabled: []
materialsInsideMask: []
materialsOutsideMask: []
disableRenderingOnOverride: 1
physicsPositionInheritanceFactor: {x: 1, y: 1}
physicsRotationInheritanceFactor: 1
physicsMovementRelativeTo: {fileID: 0}
updateTiming: 1
unscaledTime: 0
_animationName:
loop: 1
timeScale: 1

View File

@ -292,14 +292,15 @@ public class BattleManager : MonoBehaviour
var index = i; var index = i;
if (BattleEquipments[i].EquipmentLock) if (BattleEquipments[i].EquipmentLock)
{ {
PrefabPool.ins.LoadObj("Prefab/player/player", (GameObject obj) => PrefabPool.ins.LoadObj("Prefab/player/player",index, (GameObject obj,int idex) =>
{ {
obj.transform.parent = playerParent[index]; obj.transform.parent = playerParent[idex];
obj.transform.localPosition=Vector3.zero; obj.transform.localPosition=Vector3.zero;
playerItems[index] = new PlayerRunState(); playerItems[idex] = new PlayerRunState();
playerItems[index].player = obj.GetComponent<PlayerItem>(); playerItems[idex].player = obj.GetComponent<PlayerItem>();
playerItems[index].equipent = BattleEquipments[index]; playerItems[idex].equipent = BattleEquipments[idex];
playerItems[index].RestState(); playerItems[idex].RestState();
playerItems[idex].player.SetModel(idex+1);
}); });
} }

View File

@ -0,0 +1,24 @@
diff a/Blacksmith/Assets/Script/Battle/BattleManager.cs b/Blacksmith/Assets/Script/Battle/BattleManager.cs (rejected hunks)
@@ -295,15 +295,15 @@
var index = i;
if (BattleEquipments[i].EquipmentLock)
{
- PrefabPool.ins.LoadObj("Prefab/player/player", (GameObject obj) =>
+ PrefabPool.ins.LoadObj("Prefab/player/player",index, (GameObject obj,int idex) =>
{
- obj.transform.parent = playerParent[index];
+ obj.transform.parent = playerParent[idex];
obj.transform.localPosition=Vector3.zero;
- playerItems[index] = new PlayerRunState();
- playerItems[index].player = obj.GetComponent<PlayerItem>();
- playerItems[index].equipent = BattleEquipments[index];
- playerItems[index].RestState();
-
+ playerItems[idex] = new PlayerRunState();
+ playerItems[idex].player = obj.GetComponent<PlayerItem>();
+ playerItems[idex].equipent = BattleEquipments[idex];
+ playerItems[idex].RestState();
+ playerItems[idex].player.SetModel(idex+1);
});
}
}

View File

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

View File

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using cfg.BlacksmithData; using cfg.BlacksmithData;
using Spine.Unity;
using UnityEngine; using UnityEngine;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
using Vector3 = System.Numerics.Vector3; using Vector3 = System.Numerics.Vector3;
@ -11,12 +12,56 @@ using Vector3 = System.Numerics.Vector3;
/// </summary> /// </summary>
public class PlayerItem : MonoBehaviour public class PlayerItem : MonoBehaviour
{ {
[SerializeField] private SkeletonAnimation spine;
private BattleEquipment _battleEquipment; private BattleEquipment _battleEquipment;
[SerializeField] [SerializeField]
private List<GameObject> _gameObjects = new List<GameObject>(); private List<GameObject> _gameObjects = new List<GameObject>();
public playerAniType Type
{
get
{
return _type;
}
set
{
if (_type!=value)
{
_type = value;
switch (_type)
{
case playerAniType.play:
spine.state.SetAnimation(0, "attack_3", true);
break;
case playerAniType.wait:
spine.state.SetAnimation(0, "idle_3", true);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}
private playerAniType _type = playerAniType.wait;
public void SetModel(int i)
{
spine.Skeleton.SetSkin("mod_"+i);
spine.Skeleton.SetSlotsToSetupPose();
}
public void SetData(BattleEquipment battleData) public void SetData(BattleEquipment battleData)
{ {
switch (_type)
{
case playerAniType.play:
spine.state.SetAnimation(0, "attack_3", true);
break;
case playerAniType.wait:
spine.state.SetAnimation(0, "idle_3", true);
break;
default:
throw new ArgumentOutOfRangeException();
}
_battleEquipment = battleData; _battleEquipment = battleData;
if (_battleEquipment.Weapon!=null) if (_battleEquipment.Weapon!=null)
{ {
@ -61,3 +106,9 @@ public class PlayerItem : MonoBehaviour
} }
} }
public enum playerAniType
{
play,
wait
}

View File

@ -49,7 +49,26 @@ public class PrefabPool : MonoBehaviour
} }
}); });
} }
public void LoadObj(string key,int i,Action<GameObject,int> action)
{
//如果池中没有该游戏物体或者游戏物体的队列中已经没有剩余的游戏对象时。
//在这种情况下需要实例化一个新的物体,然后在判断是否需要在池中新加一个健值对还是直接放入队列中去
//然后把新生成的放入池中。
if (!objDic.ContainsKey(key)||objDic[key].Count==0) {
AssetBundleManager.ins.LoadAsset(key, (GameObject obj) =>
{
obj.name = key;
obj.SetActive(true);
action.Invoke(obj,i);
});
return;
}
var obj = objDic[key].Dequeue();
obj.SetActive(true);
action.Invoke(obj,i);
}
public void RecycleObj(GameObject obj) public void RecycleObj(GameObject obj)
{ {
//由于生成的预制体的name后面都会加上Clone所以我们需要将其去除 //由于生成的预制体的name后面都会加上Clone所以我们需要将其去除

View File

@ -0,0 +1,28 @@
diff a/Blacksmith/Assets/Script/PrefabPool.cs b/Blacksmith/Assets/Script/PrefabPool.cs (rejected hunks)
@@ -34,6 +34,26 @@
obj.SetActive(true);
action.Invoke(obj);
}
+ public void LoadObj(string key,int i,Action<GameObject,int> action)
+ {
+ //如果池中没有该游戏物体或者游戏物体的队列中已经没有剩余的游戏对象时。
+ //在这种情况下需要实例化一个新的物体,然后在判断是否需要在池中新加一个健值对还是直接放入队列中去
+ //然后把新生成的放入池中。
+
+ if (!objDic.ContainsKey(key)||objDic[key].Count==0) {
+ AssetBundleManager.ins.LoadAsset(key, (GameObject obj) =>
+ {
+ obj.name = key;
+ obj.SetActive(true);
+ action.Invoke(obj,i);
+ });
+ return;
+ }
+
+ var obj = objDic[key].Dequeue();
+ obj.SetActive(true);
+ action.Invoke(obj,i);
+ }
public void AddPond(string key,int num)
{

View File

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