diff --git a/xiaofang/Assets/Prefabs/PlayerPrefabs/boy.fbx b/xiaofang/Assets/Prefabs/PlayerPrefabs/boy.fbx new file mode 100644 index 00000000..c67df202 Binary files /dev/null and b/xiaofang/Assets/Prefabs/PlayerPrefabs/boy.fbx differ diff --git a/xiaofang/Assets/Prefabs/PlayerPrefabs/boy.fbx.meta b/xiaofang/Assets/Prefabs/PlayerPrefabs/boy.fbx.meta new file mode 100644 index 00000000..e1959184 --- /dev/null +++ b/xiaofang/Assets/Prefabs/PlayerPrefabs/boy.fbx.meta @@ -0,0 +1,107 @@ +fileFormatVersion: 2 +guid: 1a7a55d241f8b6341a53f0698f686bf3 +ModelImporter: + serializedVersion: 21300 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + removeConstantScaleCurves: 1 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + nodeNameCollisionStrategy: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + optimizeBones: 1 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + strictVertexDataChecks: 0 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + remapMaterialsIfMaterialImportModeIsNone: 0 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 58e44436..ad396efb 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -421,7 +421,7 @@ public class test : MonoBehaviour - Debug.Log(userJoinResponse.IncidentPosition); + //Debug.Log(userJoinResponse.IncidentPosition); Debug.Log(userJoinResponse); if(userJoinResponse.MessageType == 1)//用户上线 { @@ -446,11 +446,10 @@ public class test : MonoBehaviour if(userJoinResponse.MessageType == 6)//任务 { TaskInfoResponse taskInfoResponse = userJoinResponse.TaskResponse; - if (long.Parse(taskInfoResponse.ToUserId) == userJoinResponse.UserId)//当这个任务是这个玩家的时显示任务 + if (long.Parse(taskInfoResponse.ToUserId) == userJoinResponse.UserId)//当这个任务是当前玩家的时显示任务 { TaskPanel.instance.SetInfo(int.Parse(taskInfoResponse.TaskId)); } - } break; diff --git a/xiaofang/Assets/Scenes/Tmap 1.unity b/xiaofang/Assets/Scenes/Tmap 1.unity index e211f028..9a359447 100644 --- a/xiaofang/Assets/Scenes/Tmap 1.unity +++ b/xiaofang/Assets/Scenes/Tmap 1.unity @@ -1444,7 +1444,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2929252283123773938, guid: aaa2c939c0359ac4dbce3f49e8b90252, type: 3} propertyPath: m_RootOrder - value: 7 + value: 8 objectReference: {fileID: 0} - target: {fileID: 2929252283123773938, guid: aaa2c939c0359ac4dbce3f49e8b90252, type: 3} propertyPath: m_AnchorMax.x @@ -1701,7 +1701,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1489606417511801867, guid: 6025bf38a7ada134281ba43ad08c154b, type: 3} propertyPath: m_RootOrder - value: 6 + value: 7 objectReference: {fileID: 0} - target: {fileID: 1489606417511801867, guid: 6025bf38a7ada134281ba43ad08c154b, type: 3} propertyPath: m_AnchorMax.x @@ -1917,6 +1917,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 4210062203274906, guid: f83b67b7106d46a4089e1d7e2e7ad86d, type: 3} m_PrefabInstance: {fileID: 246032604} m_PrefabAsset: {fileID: 0} +--- !u!1 &247468502 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + m_PrefabInstance: {fileID: 2015577397} + m_PrefabAsset: {fileID: 0} --- !u!1001 &285549842 PrefabInstance: m_ObjectHideFlags: 0 @@ -2843,6 +2848,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1948499802} + - {fileID: 2015577398} m_Father: {fileID: 0} m_RootOrder: 26 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -4002,7 +4008,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1039624185} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -6785,7 +6791,7 @@ RectTransform: - {fileID: 1613245406} - {fileID: 670223749} m_Father: {fileID: 1039624185} - m_RootOrder: 8 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -7710,6 +7716,96 @@ Transform: m_CorrespondingSourceObject: {fileID: 473456, guid: e2d25fa2888decf4e9d8ca9afd8fb7dc, type: 3} m_PrefabInstance: {fileID: 954859396} m_PrefabAsset: {fileID: 0} +--- !u!1 &983774415 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 983774416} + - component: {fileID: 983774419} + - component: {fileID: 983774418} + - component: {fileID: 983774417} + m_Layer: 5 + m_Name: ScreenRed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &983774416 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983774415} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1039624185} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &983774417 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983774415} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b7a13aa85436e3a43a8f10019d0c1316, type: 3} + m_Name: + m_EditorClassIdentifier: + redColor: {r: 1, g: 0, b: 0, a: 0} +--- !u!114 &983774418 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983774415} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &983774419 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983774415} + m_CullTransparentMesh: 1 --- !u!1 &984064305 GameObject: m_ObjectHideFlags: 0 @@ -8142,6 +8238,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1490008724} + - {fileID: 983774416} - {fileID: 891617942} - {fileID: 2025302171} - {fileID: 447047638} @@ -16485,7 +16582,7 @@ RectTransform: - {fileID: 1301153374} - {fileID: 689167531} m_Father: {fileID: 1039624185} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -19989,7 +20086,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1039624185} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -21393,6 +21490,10 @@ PrefabInstance: propertyPath: m_Name value: newPlayer objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5866666021909216657, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} propertyPath: m_Controller value: @@ -22008,6 +22109,93 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 69a55f19217e42746bdaf0c10a7cbc80, type: 3} +--- !u!1001 &2015577397 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 382802812} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_Name + value: boy + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} +--- !u!4 &2015577398 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} + m_PrefabInstance: {fileID: 2015577397} + m_PrefabAsset: {fileID: 0} +--- !u!95 &2015577399 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 247468502} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 --- !u!1001 &2025302170 PrefabInstance: m_ObjectHideFlags: 0 @@ -22025,7 +22213,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 410985242629440748, guid: 9263a339010a182478c1a809e3f8ddf1, type: 3} propertyPath: m_RootOrder - value: 2 + value: 3 objectReference: {fileID: 0} - target: {fileID: 410985242629440748, guid: 9263a339010a182478c1a809e3f8ddf1, type: 3} propertyPath: m_AnchorMax.x @@ -22978,7 +23166,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 410985242629440748, guid: 9263a339010a182478c1a809e3f8ddf1, type: 3} propertyPath: m_RootOrder - value: 1 + value: 2 objectReference: {fileID: 0} - target: {fileID: 410985242629440748, guid: 9263a339010a182478c1a809e3f8ddf1, type: 3} propertyPath: m_AnchorMax.x diff --git a/xiaofang/Assets/Script/hylScripts/PlayerState.cs b/xiaofang/Assets/Script/hylScripts/PlayerState.cs index 3e5f5483..1400cafb 100644 --- a/xiaofang/Assets/Script/hylScripts/PlayerState.cs +++ b/xiaofang/Assets/Script/hylScripts/PlayerState.cs @@ -1,10 +1,13 @@ using System.Collections; using System.Collections.Generic; +using System.Threading.Tasks; using UnityEngine; public class PlayerState : MonoBehaviour { + + [Header("玩家总血量")] public float totalHp = 100; [Header("玩家当前血量")] @@ -31,6 +34,8 @@ public class PlayerState : MonoBehaviour { currentHp -= hurt; Debug.Log(currentHp); + //这里加上屏幕闪红 + ScreenRed.instance.ShowRed(); } if(currentHp <= 0) { @@ -38,6 +43,7 @@ public class PlayerState : MonoBehaviour } } + } diff --git a/xiaofang/Assets/Script/hylScripts/ScreenRed.cs b/xiaofang/Assets/Script/hylScripts/ScreenRed.cs new file mode 100644 index 00000000..d85074ce --- /dev/null +++ b/xiaofang/Assets/Script/hylScripts/ScreenRed.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.UI; + +public class ScreenRed : MonoBehaviour +{ + public static ScreenRed instance; + + private Image red; + public Color redColor; + private Color defaultColor; + + // Start is called before the first frame update + void Start() + { + instance = this; + red = GameObject.Find("Canvas/ScreenRed").GetComponent(); + defaultColor = red.color; + } + + // Update is called once per frame + void Update() + { + + } + + public async void ShowRed() + { + await ScreenIsRedingAsync(); + } + + private async Task ScreenIsRedingAsync() + { + red.color = Color.Lerp(defaultColor, redColor, 0.5f); + await Task.Delay(300); // 等待300毫秒 + red.color = defaultColor; + } +} diff --git a/xiaofang/Assets/Script/hylScripts/ScreenRed.cs.meta b/xiaofang/Assets/Script/hylScripts/ScreenRed.cs.meta new file mode 100644 index 00000000..403dfcce --- /dev/null +++ b/xiaofang/Assets/Script/hylScripts/ScreenRed.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7a13aa85436e3a43a8f10019d0c1316 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: