diff --git a/meng_yao/Assets/Prefabs/charatar/laohu.prefab b/meng_yao/Assets/Prefabs/charatar/laohu.prefab index 287e5fa0..9495237f 100644 --- a/meng_yao/Assets/Prefabs/charatar/laohu.prefab +++ b/meng_yao/Assets/Prefabs/charatar/laohu.prefab @@ -1,5 +1,89 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &718560901193514161 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6922097194266949505} + - component: {fileID: 7065953252221226447} + m_Layer: 0 + m_Name: attackRange (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &6922097194266949505 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718560901193514161} + 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: 0} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8433650275485930555} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7065953252221226447 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718560901193514161} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: dcb3a731cfcc70c4ab418922d45ec4a4, type: 3} + m_Color: {r: 0, g: 1, b: 0.0597775, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &2622601509586677983 GameObject: m_ObjectHideFlags: 0 @@ -375,7 +459,7 @@ MonoBehaviour: BulletNumber: 1 attackCollider: {fileID: 0} attackColliderBox: {fileID: 7445357650989261112} - attackRangeSprite: {fileID: 4735534361623519927} + attackRangeSprite: {fileID: 7065953252221226447} AttackStayTime: 2 Target: {fileID: 0} characterClick: {fileID: 8940501394638592702} @@ -447,6 +531,7 @@ Transform: - {fileID: 8433650274046349754} - {fileID: 322815736230801319} - {fileID: 7894364588234692947} + - {fileID: 6922097194266949505} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -479,6 +564,7 @@ MonoBehaviour: Name: "\u706B\u840C\u5996-01" camp: 0 hp: 100 + maxHp: 100 dieIndex: -1 Hpfiil: {fileID: 0} HpfiilYello: {fileID: 0} diff --git a/meng_yao/Assets/script/A_Fight/CharacterClick.cs b/meng_yao/Assets/script/A_Fight/CharacterClick.cs index f4a6395f..4335edb9 100644 --- a/meng_yao/Assets/script/A_Fight/CharacterClick.cs +++ b/meng_yao/Assets/script/A_Fight/CharacterClick.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using DG.Tweening; using UnityEngine.EventSystems; +using System.Threading.Tasks; public class CharacterClick : MonoBehaviour { @@ -87,7 +88,9 @@ public class CharacterClick : MonoBehaviour instantiatedPanel = GameObject.Instantiate(panelPrefab, GameObject.Find("Canvas").transform); UIContorl.instance.NowShowInfo = instantiatedPanel.GetComponent(); UIContorl.instance.NowAttackRange = attackRange; + ShowAttackRange(UIContorl.instance.NowAttackRange); + instantiatedPanel.GetComponent().closeBtn.onClick.AddListener(() => { Destroy(instantiatedPanel.GetComponent()._closePanel); @@ -115,15 +118,12 @@ public class CharacterClick : MonoBehaviour //HideAttackRange(); } } - public void ShowAttackRange(GameObject attackRange) + public async void ShowAttackRange(GameObject attackRange) { if (attackRange!=null) - { - attackRange.transform.DOScale(new Vector2(OrSizeX, OrSizeY), 0.3f).SetEase(Ease.InOutBack); - - } - - + { + attackRange.transform.DOScale(new Vector2(OrSizeX, OrSizeY), 0.3f).SetEase(Ease.InOutBack); + } }