diff options
61 files changed, 1089 insertions, 148 deletions
diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker.meta b/WorldlineKeepers/Assets/Bundle/characters/berserker.meta new file mode 100644 index 0000000..3ea8f58 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 914d1bcc1819da542bff4ece042c70c0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/berserker.json b/WorldlineKeepers/Assets/Bundle/characters/berserker/berserker.json new file mode 100644 index 0000000..20f5fb4 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/berserker.json @@ -0,0 +1,10 @@ +{ + "uid" : "berserker", + "name_key" : "CHARACTER_BERSERKER", + "level_stats" : "level_stats.csv", + "behaviour":"BerserkerBehaviour", + "builder" : "BerserkerBuilder", + "extra_data": { + "test" : "asdasd" + } +}
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/berserker.json.meta b/WorldlineKeepers/Assets/Bundle/characters/berserker/berserker.json.meta new file mode 100644 index 0000000..13665cd --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/berserker.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e14e1c0976065a8449c3fda1ef0e597b +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/level_stats.csv b/WorldlineKeepers/Assets/Bundle/characters/berserker/level_stats.csv new file mode 100644 index 0000000..c2134ce --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/level_stats.csv @@ -0,0 +1,2 @@ +stats 1 2 3 4 5 6 7 8 +max_level diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/level_stats.csv.meta b/WorldlineKeepers/Assets/Bundle/characters/berserker/level_stats.csv.meta new file mode 100644 index 0000000..142b0ec --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/level_stats.csv.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4e909e4e0fa443445b379f32a4f30ae8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites.meta b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites.meta new file mode 100644 index 0000000..c2e8888 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bbe8467143681e14fa10b90600a95b4c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker-Sheet.png b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker-Sheet.png Binary files differnew file mode 100644 index 0000000..cab325e --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker-Sheet.png diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker-Sheet.png.meta b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker-Sheet.png.meta new file mode 100644 index 0000000..513482d --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker-Sheet.png.meta @@ -0,0 +1,222 @@ +fileFormatVersion: 2 +guid: fcb020324b5b1724a9806d9f96796187 +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 + ignoreMasterTextureLimit: 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 + - serializedVersion: 3 + buildTarget: Server + 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: + - serializedVersion: 2 + name: berserker-Sheet_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 40 + height: 40 + alignment: 7 + pivot: {x: 0.5, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 4279728043f08a240808194242e8aa58 + internalID: -1193909948 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: berserker-Sheet_1 + rect: + serializedVersion: 2 + x: 40 + y: 0 + width: 40 + height: 40 + alignment: 7 + pivot: {x: 0.5, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: d4c5fe065385164498e4f4e0e2b146b5 + internalID: 1225653071 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: berserker-Sheet_2 + rect: + serializedVersion: 2 + x: 80 + y: 0 + width: 40 + height: 40 + alignment: 7 + pivot: {x: 0.5, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 54aff87eb2dd57443873b44a0fd8cca3 + internalID: 1091254877 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: berserker-Sheet_3 + rect: + serializedVersion: 2 + x: 120 + y: 0 + width: 40 + height: 40 + alignment: 7 + pivot: {x: 0.5, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 4c326e90275c4ca448220847872ecf4a + internalID: -1523841862 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + berserker-Sheet_3: -1523841862 + berserker-Sheet_0: -1193909948 + berserker-Sheet_1: 1225653071 + berserker-Sheet_2: 1091254877 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker.aseprite b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker.aseprite Binary files differnew file mode 100644 index 0000000..73b39ea --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker.aseprite diff --git a/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker.aseprite.meta b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker.aseprite.meta new file mode 100644 index 0000000..27a8c5f --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/characters/berserker/sprites/berserker.aseprite.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 95f6e7e9b2f2be1429b64f1e37124fc0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/characters/ronin/ronin.json b/WorldlineKeepers/Assets/Bundle/characters/ronin/ronin.json index c8afbb1..20f5fb4 100644 --- a/WorldlineKeepers/Assets/Bundle/characters/ronin/ronin.json +++ b/WorldlineKeepers/Assets/Bundle/characters/ronin/ronin.json @@ -1,13 +1,10 @@ { - "uid" : "ronin", - "name_key" : "CHARACTER_RONIN", - "stats" : { - "max_level" : "100", - "level" : "1", - "health" : "100", - "max_health" : "10000000", - "exp" : "0" - }, - "behaviour":"RoninBehaviour", - "extra_data":"" + "uid" : "berserker", + "name_key" : "CHARACTER_BERSERKER", + "level_stats" : "level_stats.csv", + "behaviour":"BerserkerBehaviour", + "builder" : "BerserkerBuilder", + "extra_data": { + "test" : "asdasd" + } }
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Bundle/metadata/default_stats.csv b/WorldlineKeepers/Assets/Bundle/metadata/default_stats.csv index 63ae5c9..c049c69 100644 --- a/WorldlineKeepers/Assets/Bundle/metadata/default_stats.csv +++ b/WorldlineKeepers/Assets/Bundle/metadata/default_stats.csv @@ -1,13 +1,15 @@ -uid,name_key,type,extra_data -#默认的角色属性,可以扩展,,, -"#type: int, string, float, bool, char, Vector2, Vector3, Vector4, Color",,, -level,LEVEL,int, -max_level,MAX_LEVEL,int, -health,HEALTH,int, -max_health,MAX_HEALTH,int, -exp,EXP,int, -max_exp,MAX_EXP,int, -health_recover,HEALTH_RECOVER,int, -move_speed,MOVE_SPEED,int, -damage,DAMAGE,int, -attack_speed,ATTACK_SPEED,int, +uid,name_key,type,behaviour,extra_data +#默认的角色属性,可以扩展,,,, +"#type: int, string, float, bool, char, Vector2, Vector3, Vector4, Color",,,, +level,LEVEL,int,, +max_level,MAX_LEVEL,int,, +health,HEALTH,int,, +max_health,MAX_HEALTH,int,, +exp,EXP,int,, +max_exp,MAX_EXP,int,, +health_recover,HEALTH_RECOVER,int,, +move_speed,MOVE_SPEED,int,, +damage,DAMAGE,int,, +attack_speed,ATTACK_SPEED,int,, +#单次开箱掉落个数,,,, +drop_per_chest,,int,, diff --git a/WorldlineKeepers/Assets/Scenes/Test.unity b/WorldlineKeepers/Assets/Scenes/Test.unity index e955672..0c1e493 100644 --- a/WorldlineKeepers/Assets/Scenes/Test.unity +++ b/WorldlineKeepers/Assets/Scenes/Test.unity @@ -7975,11 +7975,10 @@ GameObject: m_Component: - component: {fileID: 1195387724} - component: {fileID: 1195387723} - - component: {fileID: 1195387722} - component: {fileID: 1195387725} - - component: {fileID: 1195387726} - component: {fileID: 1195387727} - component: {fileID: 1195387728} + - component: {fileID: 1195387729} m_Layer: 0 m_Name: samurai_0 m_TagString: Untagged @@ -7987,26 +7986,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!95 &1195387722 -Animator: - serializedVersion: 4 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1195387721} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: 335121b87a4f32f49a3b8f68096e9758, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_StabilizeFeet: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 --- !u!212 &1195387723 SpriteRenderer: m_ObjectHideFlags: 0 @@ -8091,22 +8070,6 @@ MonoBehaviour: m_Speed: 3 m_Blade: {fileID: 2722328784031211685, guid: 64b392d0acb4cb44c9907207b451bb4c, type: 3} m_GroundBreak: {fileID: 570215259797550039, guid: 57b232593206cca4099ab1fb5ec80e04, type: 3} ---- !u!58 &1195387726 -CircleCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1195387721} - m_Enabled: 0 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0.26039362} - serializedVersion: 2 - m_Radius: 0.37971735 --- !u!114 &1195387727 MonoBehaviour: m_ObjectHideFlags: 0 @@ -8137,6 +8100,26 @@ MonoBehaviour: m_Type: 2 m_Offset: {x: 0, y: 0.49} m_Size: {x: 1, y: 1} +--- !u!114 &1195387729 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1195387721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 167a1a5c7e017484d92699dc23a2b5c0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SpriteAnimation: + sprites: + - {fileID: -1193909948, guid: fcb020324b5b1724a9806d9f96796187, type: 3} + - {fileID: 1225653071, guid: fcb020324b5b1724a9806d9f96796187, type: 3} + - {fileID: 1091254877, guid: fcb020324b5b1724a9806d9f96796187, type: 3} + - {fileID: -1523841862, guid: fcb020324b5b1724a9806d9f96796187, type: 3} + duration: 0.5 + m_AutoPlay: 0 --- !u!1 &1196247968 GameObject: m_ObjectHideFlags: 0 diff --git a/WorldlineKeepers/Assets/Scripts/Buffs/Behaviours.meta b/WorldlineKeepers/Assets/Scripts/Buffs/Behaviours.meta new file mode 100644 index 0000000..f71f04d --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Buffs/Behaviours.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7451d6093f9cc26489367b95fcb1cdb1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Buffs/Buff.cs b/WorldlineKeepers/Assets/Scripts/Buffs/Buff.cs index 1c6ae5a..7c8d7ef 100644 --- a/WorldlineKeepers/Assets/Scripts/Buffs/Buff.cs +++ b/WorldlineKeepers/Assets/Scripts/Buffs/Buff.cs @@ -12,7 +12,7 @@ public abstract class Buff // 元数据 public BuffMetadata metadata; - // buff效果器 + // buff逻辑 public BuffBehaviour effector; public string uid diff --git a/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs index 0a0559f..4e20202 100644 --- a/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs +++ b/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs @@ -2,31 +2,74 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class BuffBehaviour -{ - private CharacterBase m_Character; - - /// <summary> - /// buff鐢熸垚鏃跺 - /// </summary> - public virtual void OnCreate() - { +//https://zhuanlan.zhihu.com/p/150812545 +//https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Abilities_Data_Driven/zh - } +namespace WK +{ /// <summary> - /// 鏇存柊 + /// Buff鐢熷懡鍛ㄦ湡 + /// 瀹炰緥鍖 -> 鍔犲叆鍒楄〃鍓 -> 鍔犲叆鍒楄〃鍚 -> 鏇存柊 -> 绉诲嚭鍒楄〃鍓 -> 绉诲嚭鍒楄〃鍚 + /// 姣忎竴姝ラ兘浼氬悜褰撳墠瀵硅薄浣滅敤鍩熷唴骞挎挱娑堟伅 /// </summary> - public virtual void OnUpdate() + public abstract class BuffBehaviour { + /// <summary> + /// buff瀹炰緥鍖栨椂 + /// </summary> + public virtual void OnCreate() + { - } + } - /// <summary> - /// 瑙掕壊姝讳骸 - /// </summary> - public virtual void OnCharacterDeath() - { - } + /// <summary> + /// 鑾峰緱杩欎釜buff锛堝姞鍏ュ垪琛ㄥ墠锛 + /// </summary> + public virtual void OnBeforeAttach() + { + } + + /// <summary> + /// 鍔犲叆鍒楄〃鍚庯紝婵娲昏繖涓猙uff + /// </summary> + public virtual void OnAfterAttach() + { + + } + + /// <summary> + /// 绗竴娆pdate鍓 + /// </summary> + public virtual void OnStart() + { + + } + + /// <summary> + /// 浠庡垪琛ㄧЩ鍑哄墠 + /// </summary> + public virtual void OnBeforeDeattach() + { + + } + + /// <summary> + /// 绉婚櫎杩欎釜buff锛堢Щ鍑哄垪琛ㄥ悗锛 + /// </summary> + public virtual void OnAfterDeattach() + { + + } + + /// <summary> + /// 姣忓抚閫昏緫鏇存柊锛堝鏋滈渶瑕佺殑璇濓級 + /// </summary> + public virtual void OnUpdate() + { + + } + + } } diff --git a/WorldlineKeepers/Assets/Scripts/Items/Behaviours.meta b/WorldlineKeepers/Assets/Scripts/Items/Behaviours.meta new file mode 100644 index 0000000..b6151d7 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Items/Behaviours.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3692bca7626d0b24eaf9fd9822f92440 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Items/ItemDaggerBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemDaggerBehaviour.cs index 1e0dfe6..1e0dfe6 100644 --- a/WorldlineKeepers/Assets/Scripts/Items/ItemDaggerBehaviour.cs +++ b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemDaggerBehaviour.cs diff --git a/WorldlineKeepers/Assets/Scripts/Items/ItemDaggerBehaviour.cs.meta b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemDaggerBehaviour.cs.meta index 409141f..409141f 100644 --- a/WorldlineKeepers/Assets/Scripts/Items/ItemDaggerBehaviour.cs.meta +++ b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemDaggerBehaviour.cs.meta diff --git a/WorldlineKeepers/Assets/Scripts/Items/ItemHellbellBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemHellbellBehaviour.cs index 1008eed..1008eed 100644 --- a/WorldlineKeepers/Assets/Scripts/Items/ItemHellbellBehaviour.cs +++ b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemHellbellBehaviour.cs diff --git a/WorldlineKeepers/Assets/Scripts/Items/ItemHellbellBehaviour.cs.meta b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemHellbellBehaviour.cs.meta index 341e7c0..341e7c0 100644 --- a/WorldlineKeepers/Assets/Scripts/Items/ItemHellbellBehaviour.cs.meta +++ b/WorldlineKeepers/Assets/Scripts/Items/Behaviours/ItemHellbellBehaviour.cs.meta diff --git a/WorldlineKeepers/Assets/Scripts/Items/ItemBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Items/ItemBehaviour.cs index 520946a..9d7ce10 100644 --- a/WorldlineKeepers/Assets/Scripts/Items/ItemBehaviour.cs +++ b/WorldlineKeepers/Assets/Scripts/Items/ItemBehaviour.cs @@ -22,6 +22,12 @@ namespace WK.Items { } + + public virtual void OnUpdate() + { + + } + } } diff --git a/WorldlineKeepers/Assets/Scripts/Modifier/Modifier.cs b/WorldlineKeepers/Assets/Scripts/Modifier/Modifier.cs new file mode 100644 index 0000000..54e5140 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Modifier/Modifier.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Modifier +{ + + + +} diff --git a/WorldlineKeepers/Assets/Scripts/Modifier/Modifier.cs.meta b/WorldlineKeepers/Assets/Scripts/Modifier/Modifier.cs.meta new file mode 100644 index 0000000..450a2c2 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Modifier/Modifier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77177e3292fb84d4cb05d7e54c6d4b6f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Rendering/GraphicsManager.cs b/WorldlineKeepers/Assets/Scripts/Rendering/GraphicsManager.cs new file mode 100644 index 0000000..0503c7d --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Rendering/GraphicsManager.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK.Rendering +{ + + public class GraphicsManager : Singleton<GraphicsManager> + { + + public List<Shader> m_Shaders; + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Rendering/GraphicsManager.cs.meta b/WorldlineKeepers/Assets/Scripts/Rendering/GraphicsManager.cs.meta new file mode 100644 index 0000000..d98f33f --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Rendering/GraphicsManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c770205e561842a4cab48846601a1776 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimation.cs b/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimation.cs index f2b7e98..a6c6a6d 100644 --- a/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimation.cs +++ b/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimation.cs @@ -5,7 +5,7 @@ using UnityEngine; namespace WK.Rendering { - + [Serializable] public class SpriteAnimation { public List<Sprite> sprites; diff --git a/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimationController.cs b/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimationController.cs index 315cf91..63ba394 100644 --- a/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimationController.cs +++ b/WorldlineKeepers/Assets/Scripts/Rendering/SpriteAnimationController.cs @@ -13,20 +13,49 @@ namespace WK.Rendering #endregion #region 鍏叡瀛楁 - + public bool playing + { + get + { + return m_IsPlaying; + } + set + { + m_IsPlaying = value; + } + } #endregion #region 绉佹湁瀛楁 - + private SpriteRenderer m_SpriteRenderer; + private bool m_IsPlaying; #endregion private void Awake() { - // 绉佹湁瀛楁璧嬪 + m_SpriteRenderer = GetComponent<SpriteRenderer>(); - // 鍏叡瀛楁璧嬪 + StartCoroutine(CoPlayAnimation(m_SpriteAnimation.duration)); - // 鍒濆鍖 + m_IsPlaying = true; + } + + IEnumerator CoPlayAnimation(float duration = 1f) + { + int index = 0; + while (true) + { + if (!playing) + { + yield return null; + continue; + } + + m_SpriteRenderer.sprite = m_SpriteAnimation.sprites[index]; + yield return new WaitForSeconds(m_SpriteAnimation.duration / m_SpriteAnimation.sprites.Count); + index++; + index %= m_SpriteAnimation.sprites.Count; + } } } diff --git a/WorldlineKeepers/Assets/Scripts/Stats/CharacterStatsBase.cs b/WorldlineKeepers/Assets/Scripts/Stats/CharacterStatsBase.cs index 8dbb161..49c6933 100644 --- a/WorldlineKeepers/Assets/Scripts/Stats/CharacterStatsBase.cs +++ b/WorldlineKeepers/Assets/Scripts/Stats/CharacterStatsBase.cs @@ -61,6 +61,11 @@ namespace WK } } + //public T Access<T>() + //{ + // return null; + //} + } } diff --git a/WorldlineKeepers/Assets/Scripts/Tests/TestEvent.cs b/WorldlineKeepers/Assets/Scripts/Tests/TestEvent.cs index c6e9bba..54df05b 100644 --- a/WorldlineKeepers/Assets/Scripts/Tests/TestEvent.cs +++ b/WorldlineKeepers/Assets/Scripts/Tests/TestEvent.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using UnityEngine; using WK; -public class TestEvent : MonoBehaviour +public class TestEvent : MonoBehaviour, INotification { #region 搴忓垪鍖 @@ -28,13 +28,15 @@ public class TestEvent : MonoBehaviour private void OnEnable() { - GlobalEventManager.Instance.Register("Health.BurnKill", OnEventCheck); - GlobalEventManager.Instance.Notify("Health.BurnKill"); + //GlobalEventManager.Instance.Register("Health.BurnKill", OnEventCheck); + //GlobalEventManager.Instance.Notify("Health.BurnKill"); + this.AddObserver("Health", OnEventCheck); + this.PostNotification("Health", "asdasd"); } private void OnEventCheck(params object[] p) { - Debug.Log("msg"); + Debug.Log("msg" + p[0]); } } diff --git a/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs b/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs new file mode 100644 index 0000000..b9a9454 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs @@ -0,0 +1,44 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + /// <summary> + /// 全局标志管理 + /// </summary> + public class FlagManager : Singleton<FlagManager> + { + public Dictionary<string, bool> m_Flags; + + public void AddFlag(string flag, bool value = false) + { + if(!HasFlag(flag)) + { + m_Flags.Add(flag, value); + } + } + + public bool HasFlag(string flag) + { + return m_Flags.ContainsKey(flag); + } + + public bool IsFlag(string flag) + { + if(m_Flags.ContainsKey(flag)) return false; + return m_Flags[flag]; + } + + public void RemoveFlag(string flag) + { + if(HasFlag(flag)) + { + m_Flags.Remove(flag); + } + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs.meta new file mode 100644 index 0000000..1738634 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2451904bd85094c40a69d59807d51c5e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/GlobalEventManager.cs b/WorldlineKeepers/Assets/Scripts/Tools/GlobalEventManager.cs index 47f3990..c9cde83 100644 --- a/WorldlineKeepers/Assets/Scripts/Tools/GlobalEventManager.cs +++ b/WorldlineKeepers/Assets/Scripts/Tools/GlobalEventManager.cs @@ -6,7 +6,7 @@ using UnityEngine.UIElements; namespace WK { /// <summary> - /// 全局事件 + /// 不指定发送者的全局事件 /// </summary> public class GlobalEventManager : Singleton<GlobalEventManager> { diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Notification.meta b/WorldlineKeepers/Assets/Scripts/Tools/Notification.meta new file mode 100644 index 0000000..b20b283 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 12f4a3b409f294746a9546c44272660c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/NotificationCenter.cs b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationCenter.cs index b3f299a..bb4e08e 100644 --- a/WorldlineKeepers/Assets/Scripts/Tools/NotificationCenter.cs +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationCenter.cs @@ -5,24 +5,23 @@ using UnityEngine; namespace WK { - public class NotificationCenter + public class NotificationCenter : Singleton<NotificationCenter> { - private Dictionary<string, Dictionary<object, List<Action<object, object>>>> _table = new Dictionary<string, Dictionary<object, List<Action<object, object>>>>(); + public delegate void NotificatonHandler(params object[] args); - private HashSet<List<Action<object, object>>> _invoking = new HashSet<List<Action<object, object>>>(); + private Dictionary<string/*eventName*/, Dictionary<object/*publisher*/, List<NotificatonHandler>>> m_EventListeners = new Dictionary<string, Dictionary<object, List<NotificatonHandler>>>(); - public static readonly NotificationCenter instance = new NotificationCenter(); + /// <summary> + /// 当前在调用中的回调 + /// </summary> + private HashSet<List<NotificatonHandler>> m_CurInvokingCallbacks = new HashSet<List<NotificatonHandler>>(); - private NotificationCenter() + public void AddObserver(string notificationName, NotificatonHandler handler) { + AddObserver(null, notificationName, handler); } - public void AddObserver(Action<object, object> handler, string notificationName) - { - AddObserver(handler, notificationName, null); - } - - public void AddObserver(Action<object, object> handler, string notificationName, object sender) + public void AddObserver(object sender, string notificationName, NotificatonHandler handler) { if (handler == null) { @@ -34,30 +33,30 @@ namespace WK Debug.LogError("Can't observe an unnamed notification"); return; } - if (!_table.ContainsKey(notificationName)) + if (!m_EventListeners.ContainsKey(notificationName)) { - _table.Add(notificationName, new Dictionary<object, List<Action<object, object>>>()); + m_EventListeners.Add(notificationName, new Dictionary<object, List<NotificatonHandler>>()); } - Dictionary<object, List<Action<object, object>>> dictionary = _table[notificationName]; + Dictionary<object, List<NotificatonHandler>> dictionary = m_EventListeners[notificationName]; object key = ((sender != null) ? sender : this); if (!dictionary.ContainsKey(key)) { - dictionary.Add(key, new List<Action<object, object>>()); + dictionary.Add(key, new List<NotificatonHandler>()); } - List<Action<object, object>> list = dictionary[key]; - if (_invoking.Contains(list)) + List<NotificatonHandler> list = dictionary[key]; + if (m_CurInvokingCallbacks.Contains(list)) { - list = (dictionary[key] = new List<Action<object, object>>(list)); + list = (dictionary[key] = new List<NotificatonHandler>(list)); } list.Add(handler); } - public void RemoveObserver(Action<object, object> handler, string notificationName) + public void RemoveObserver(string notificationName, NotificatonHandler handler) { - RemoveObserver(handler, notificationName, null); + RemoveObserver(null, notificationName, handler); } - public void RemoveObserver(Action<object, object> handler, string notificationName, object sender) + public void RemoveObserver(object sender, string notificationName, NotificatonHandler handler) { if (handler == null) { @@ -69,23 +68,23 @@ namespace WK } else { - if (!_table.ContainsKey(notificationName)) + if (!m_EventListeners.ContainsKey(notificationName)) { return; } - Dictionary<object, List<Action<object, object>>> dictionary = _table[notificationName]; + Dictionary<object, List<NotificatonHandler>> dictionary = m_EventListeners[notificationName]; object key = ((sender != null) ? sender : this); if (!dictionary.ContainsKey(key)) { return; } - List<Action<object, object>> list = dictionary[key]; + List<NotificatonHandler> list = dictionary[key]; int num = list.IndexOf(handler); if (num != -1) { - if (_invoking.Contains(list)) + if (m_CurInvokingCallbacks.Contains(list)) { - list = (dictionary[key] = new List<Action<object, object>>(list)); + list = (dictionary[key] = new List<NotificatonHandler>(list)); } list.RemoveAt(num); } @@ -94,12 +93,12 @@ namespace WK public void Clean() { - string[] array = new string[_table.Keys.Count]; - _table.Keys.CopyTo(array, 0); + string[] array = new string[m_EventListeners.Keys.Count]; + m_EventListeners.Keys.CopyTo(array, 0); for (int num = array.Length - 1; num >= 0; num--) { string key = array[num]; - Dictionary<object, List<Action<object, object>>> dictionary = _table[key]; + Dictionary<object, List<NotificatonHandler>> dictionary = m_EventListeners[key]; object[] array2 = new object[dictionary.Keys.Count]; dictionary.Keys.CopyTo(array2, 0); for (int num2 = array2.Length - 1; num2 >= 0; num2--) @@ -112,7 +111,7 @@ namespace WK } if (dictionary.Count == 0) { - _table.Remove(key); + m_EventListeners.Remove(key); } } } @@ -122,12 +121,12 @@ namespace WK PostNotification(notificationName, null); } - public void PostNotification(string notificationName, object sender) + public void PostNotification(object sender, string notificationName) { - PostNotification(notificationName, sender, null); + PostNotification(sender, notificationName, null); } - public void PostNotification(string notificationName, object sender, object e) + public void PostNotification(object sender, string notificationName, params object[] p) { if (string.IsNullOrEmpty(notificationName)) { @@ -135,33 +134,34 @@ namespace WK } else { - if (!_table.ContainsKey(notificationName)) + if (!m_EventListeners.ContainsKey(notificationName)) { return; } - Dictionary<object, List<Action<object, object>>> dictionary = _table[notificationName]; + Dictionary<object, List<NotificatonHandler>> dictionary = m_EventListeners[notificationName]; if (sender != null && dictionary.ContainsKey(sender)) { - List<Action<object, object>> list = dictionary[sender]; - _invoking.Add(list); + List<NotificatonHandler> list = dictionary[sender]; + m_CurInvokingCallbacks.Add(list); for (int i = 0; i < list.Count; i++) { - list[i](sender, e); + list[i](p); } - _invoking.Remove(list); + m_CurInvokingCallbacks.Remove(list); } if (dictionary.ContainsKey(this)) { - List<Action<object, object>> list2 = dictionary[this]; - _invoking.Add(list2); + List<NotificatonHandler> list2 = dictionary[this]; + m_CurInvokingCallbacks.Add(list2); for (int j = 0; j < list2.Count; j++) { - list2[j](sender, e); + list2[j](p); } - _invoking.Remove(list2); + m_CurInvokingCallbacks.Remove(list2); } } } + } } diff --git a/WorldlineKeepers/Assets/Scripts/Tools/NotificationCenter.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationCenter.cs.meta index 13d54ee..13d54ee 100644 --- a/WorldlineKeepers/Assets/Scripts/Tools/NotificationCenter.cs.meta +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationCenter.cs.meta diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs new file mode 100644 index 0000000..8313f7b --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs @@ -0,0 +1,17 @@ +using System; + +namespace WK +{ + + public interface INotification + { + } + + public static class NotificationExtensions + { + public static void AddObserver(this INotification _this, string msg, NotificationCenter.NotificatonHandler handler) { NotificationCenter.Instance.AddObserver(_this, msg, handler); } + public static void RemoveObserver(this INotification _this, string msg, NotificationCenter.NotificatonHandler handler) { NotificationCenter.Instance.RemoveObserver(_this, msg, handler); } + public static void PostNotification(this INotification _this, string msg, params object[] p) { NotificationCenter.Instance.PostNotification(_this, msg, p); } + + } +} diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs.meta new file mode 100644 index 0000000..a805d3a --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 75fb0f8661eca5c4faf394f140fcae88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Notification/ScopedNotification.cs b/WorldlineKeepers/Assets/Scripts/Tools/Notification/ScopedNotification.cs new file mode 100644 index 0000000..0002f14 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/ScopedNotification.cs @@ -0,0 +1,89 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class ScopedNotification + { + public delegate void NotificatonHandler(params object[] args); + + private Dictionary<string, List<NotificatonHandler>> m_EventListeners = new Dictionary<string, List<NotificatonHandler>>(); + + public void AddObserver(string eventName, NotificatonHandler handler) + { + if (handler == null) + { + return; + } + + if (string.IsNullOrEmpty(eventName)) + { + return; + } + + List<NotificatonHandler> handlers; + if (!m_EventListeners.ContainsKey(eventName)) + { + m_EventListeners.Add(eventName, new List<NotificatonHandler>()); + } + + handlers = m_EventListeners[eventName]; + handlers.Add(handler); + } + + public void RemoveObserver(string eventName, NotificatonHandler handler) + { + if(handler == null) { return; } + + if(string.IsNullOrEmpty(eventName)) { return; } + + if (!m_EventListeners.ContainsKey(eventName)) + return; + + List<NotificatonHandler> handlers = m_EventListeners[eventName]; + if(handlers.Contains(handler)) + handlers.Remove(handler); + } + + public void RemoveEvent(string eventName) + { + if (string.IsNullOrEmpty(eventName)) { return; } + if(m_EventListeners.ContainsKey(eventName)) + { + m_EventListeners.Remove(eventName); + } + } + + public void Clean() + { + m_EventListeners.Clear(); + } + + public void PostNotification(string eventName, params object[] args) + { + if (string.IsNullOrEmpty(eventName)) { return; } + + if (!m_EventListeners.ContainsKey(eventName)) + return; + + List<NotificatonHandler> handlers = m_EventListeners[eventName]; + for(int i = 0; i < handlers.Count; i++) + { + var handler = handlers[i]; + if(handler != null) + { + handler(args); + } + } + } + + public void PostNotification(string eventName) + { + PostNotification(eventName, null); + } + + } + +}
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Notification/ScopedNotification.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/Notification/ScopedNotification.cs.meta new file mode 100644 index 0000000..4ec5672 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/ScopedNotification.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 66ddfe88aa791154ea0663b56917da4a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem.meta b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem.meta new file mode 100644 index 0000000..a6922dc --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 035c400d50feb2747bb551b48ff42f8f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/ActiveTrigger.cs b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/ActiveTrigger.cs new file mode 100644 index 0000000..1a4e988 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/ActiveTrigger.cs @@ -0,0 +1,19 @@ +using Newtonsoft.Json.Serialization; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + /// <summary> + /// 定期轮训条件的主动式触发器。不安全 + /// </summary> + public class ActiveTrigger + { + + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/ActiveTrigger.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/ActiveTrigger.cs.meta new file mode 100644 index 0000000..1fa37dc --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/ActiveTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e06c17e867b36f4bb0b6796ed74b89b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/Trigger.cs b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/Trigger.cs new file mode 100644 index 0000000..ed69284 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/Trigger.cs @@ -0,0 +1,110 @@ +using System.Collections.Generic; +using System.Diagnostics.Tracing; + +namespace WK +{ + + /// <summary> + /// 事件发生后检测条件的被动触发器 + /// </summary> + public class Trigger + { + public class ConditionBase + { + public virtual bool Evaluate(params object[] args) { return false; } + + public static ConditionBase Always = new ConditionAlways(); + public static ConditionBase AlwaysNot = new ConditionAlwaysNot(); + } + + public class ConditionAlways : ConditionBase + { + public override bool Evaluate(params object[] args) + { + return true; + } + } + + public class ConditionAlwaysNot : ConditionBase + { + public override bool Evaluate(params object[] args) + { + return false; + } + } + + public class ConditionAnd : ConditionBase + { + private ConditionBase m_Left; + private ConditionBase m_Right; + public ConditionAnd(ConditionBase left, ConditionBase right) + { + m_Left = left; + m_Right = right; + } + public override bool Evaluate(params object[] args) + { + return m_Left.Evaluate(args) && m_Right.Evaluate(args); + } + } + + public class ConditionOr : ConditionBase + { + private ConditionBase m_Left; + private ConditionBase m_Right; + public ConditionOr(ConditionBase left, ConditionBase right) + { + m_Left = left; + m_Right = right; + } + public override bool Evaluate(params object[] args) + { + return m_Left.Evaluate(args) || m_Right.Evaluate(args); + } + } + + public delegate void Action(params object[] args); + + // 触发事件 + private string m_Event; + // 触发条件 + private ConditionBase m_Condition; + // 触发操作 + private List<Action> m_Actions = new List<Action>(); + + public void SetEvent(string eventType) + { + if (m_Event != string.Empty || m_Event != null) + { + GlobalEventManager.Instance.UnRegister(m_Event, OnEvent); + } + m_Event = eventType; + GlobalEventManager.Instance.Register(eventType, OnEvent); + } + + public void AddAction(Action action) + { + m_Actions.Add(action); + } + + public void SetCondition(ConditionBase condition) + { + m_Condition = condition; + } + + public void OnEvent(params object[] args) + { + if (m_Condition == null) + return; + if (m_Condition.Evaluate()) + { + foreach (Action action in m_Actions) + { + action.Invoke(args); + } + } + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/Trigger.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/Trigger.cs.meta new file mode 100644 index 0000000..c5f1c19 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/TriggerSystem/Trigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3ee81c4dceea3346b4c5e7b1d371e92 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker.meta b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker.meta new file mode 100644 index 0000000..86a6143 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65b7da83d18b0a045a33527f5d446de7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBehaviour.cs new file mode 100644 index 0000000..bdb18a2 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBehaviour.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class BerserkerBehaviour : CharacterBehaviour + { + + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBehaviour.cs.meta b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBehaviour.cs.meta new file mode 100644 index 0000000..2718863 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 28a1e81c0e2cc314085ee6e5fc2528ed +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBuilder.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBuilder.cs new file mode 100644 index 0000000..9601783 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBuilder.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class BerserkerBuilder : CharacterBuilder + { + + protected override PlayerController BuildPhaseController() + { + return base.BuildPhaseController(); + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBuilder.cs.meta b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBuilder.cs.meta new file mode 100644 index 0000000..270e5a5 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Berserker/BerserkerBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e49b90c4b84cbc54bb4ad7d14925e5db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBehaviour.cs index 7674523..f056056 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBehaviour.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBehaviour.cs @@ -11,7 +11,7 @@ namespace WK public abstract class CharacterBehaviour { private PlayerController m_Controller; - public PlayerController controller { get { return m_Controller; } } + protected PlayerController controller { get { return m_Controller; } } public CharacterInfo info { get { return m_Controller.info; } } @@ -19,14 +19,19 @@ namespace WK { } - public virtual void OnGlobalUpdate() + public virtual void OnPreUpdate() { } - public virtual void OnStageUpdate() + public virtual void OnUpdate() { } + public virtual void OnPostUpdate() + { + + } + } }
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBuilder.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBuilder.cs new file mode 100644 index 0000000..c51d565 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBuilder.cs @@ -0,0 +1,41 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using WK.Data; + +namespace WK +{ + + public class CharacterBuilder + { + protected GameObject m_Root; + protected CharacterMetadata m_Metadata; + + public GameObject Build(CharacterMetadata metadata) + { + m_Metadata = metadata; + + m_Root = BuildPhaseRootGameObject(); + + return m_Root; + } + + protected virtual GameObject BuildPhaseRootGameObject() + { + GameObject go = new GameObject(); + return go; + } + + protected virtual PlayerController BuildPhaseController() + { + return null; + } + + protected virtual void BuildPhaseSpriteRenderer() + { + + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBuilder.cs.meta b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBuilder.cs.meta new file mode 100644 index 0000000..a859554 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4e33239fb24da54cb24d06bd2c5cc51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs index 62dd830..63bf35f 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs @@ -118,7 +118,7 @@ namespace WK } /// <summary> - /// 角色当前状态 + /// 角色当前状态,包括: 属性数值、buff、perk /// </summary> public class CharacterInfo { @@ -132,6 +132,11 @@ namespace WK public CharacterPerksCollection perks { get { return m_Perks; } } public CharacterPerksCollection m_Perks; + public void OnUpdate() + { + + } + } } diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterMetadata.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterMetadata.cs index 81b80c0..c8409da 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterMetadata.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterMetadata.cs @@ -8,16 +8,19 @@ namespace WK.Data public class CharacterMetadata { - public string uid; public string name_key; - public Dictionary<string, string> stats; + public string stats; public string behaviour; - public string extra_data; + public string builder; + + public string level_stats; + + public Dictionary<string, string> extra_data; } } diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula.meta b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula.meta new file mode 100644 index 0000000..ffeee0a --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9d6564032bf7864fbf3b2ef87aafa6d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula/DraculaBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula/DraculaBehaviour.cs new file mode 100644 index 0000000..0789b9a --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula/DraculaBehaviour.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DraculaBehaviour +{ + + + +} diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula/DraculaBehaviour.cs.meta b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula/DraculaBehaviour.cs.meta new file mode 100644 index 0000000..2ebde89 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Dracula/DraculaBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c1fd60947162c742a3ed5448c72b76b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs index 2f19fb3..5ca87e6 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs @@ -5,10 +5,13 @@ using UnityEngine; namespace WK { - public class PlayerController + /// <summary> + /// 玩家角色根节点 + /// </summary> + public sealed class PlayerController : INotification { /// <summary> - /// 角色所有当前数值 + /// 角色所有当前数值集合 /// </summary> private CharacterInfo m_CharacterInfo; public CharacterInfo info { get { return m_CharacterInfo; } } @@ -19,6 +22,32 @@ namespace WK private CharacterBehaviour m_CharacterBehaviour; public CharacterBehaviour behaviour { get { return m_CharacterBehaviour; } } + /// <summary> + /// gameobject根节点 + /// </summary> + private GameObject m_GameObject; + public GameObject gameObject { get { return m_GameObject;} } + + public void OnCreate() + { + } + + /// <summary> + /// 逻辑更新 + /// </summary> + public void OnUpdate() + { + // preupdate + behaviour.OnPreUpdate(); + + // update + info.OnUpdate(); + behaviour.OnUpdate(); + + // post update + behaviour.OnPostUpdate(); + } + } }
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs index 966c3d0..6e877b3 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UIElements; +using WK.Rendering; namespace MH { @@ -121,7 +122,7 @@ namespace MH m_Moving = false; } - GetComponent<Animator>().speed = m_Moving ? 1 : 0; + GetComponent<SpriteAnimationController>().playing = m_Moving ? true : false; if(Input.GetMouseButtonUp(0)) { diff --git a/WorldlineKeepers/Assets/Scripts/Unit/UnitManager.cs b/WorldlineKeepers/Assets/Scripts/Unit/UnitManager.cs index 9ec97f3..9ecb088 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/UnitManager.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/UnitManager.cs @@ -5,10 +5,13 @@ using UnityEngine; namespace WK { - public class UnitManager + public class UnitManager : Singleton<UnitManager> { - + /// <summary> + /// 公共的标准角色构建流程 + /// </summary> + public readonly CharacterBuilder standardCharacterBuilder = new CharacterBuilder(); } |