攻击范围显示

This commit is contained in:
GL 2024-12-19 11:48:31 +08:00
parent 1707005c71
commit c778e5f8d1
8 changed files with 440 additions and 14 deletions

View File

@ -31,7 +31,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1086919302922474760
BoxCollider2D:
@ -73,6 +73,91 @@ MonoBehaviour:
m_EditorClassIdentifier:
role: {fileID: 8433650274028726420}
panelPrefab: {fileID: 8782491854383104488, guid: 61ffa7d22a51b1e48a3495af66e30de0, type: 3}
attackRange: {fileID: 7939695578342722628}
--- !u!1 &7939695578342722628
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3572175332158307839}
- component: {fileID: 4735534361623519927}
m_Layer: 0
m_Name: attackRange
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3572175332158307839
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7939695578342722628}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.023, y: 0, z: 0}
m_LocalScale: {x: 0.5590777, y: 0.5590777, z: 0.5590777}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &4735534361623519927
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7939695578342722628}
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: 0.9413085, b: 1, 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 &8433650274046349753
GameObject:
m_ObjectHideFlags: 0
@ -105,7 +190,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8433650274046349755
SpriteRenderer:
@ -219,7 +304,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8433650274814453344}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1, y: 0, z: 0}
m_LocalPosition: {x: 1.024, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -298,6 +383,7 @@ Transform:
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 8433650274814453345}
- {fileID: 3572175332158307839}
- {fileID: 8433650274046349754}
- {fileID: 322815736230801319}
m_Father: {fileID: 0}
@ -337,6 +423,7 @@ MonoBehaviour:
HpTextPrefab: {fileID: 0}
_Canvas: {fileID: 0}
spriteRenderers: {fileID: 0}
HurtDirectin: 0
gold: 10
physicalArmor: 10
magicArmor: 5

View File

@ -31,7 +31,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &6834015089598953761
BoxCollider2D:
@ -73,6 +73,91 @@ MonoBehaviour:
m_EditorClassIdentifier:
role: {fileID: 8433650274028726420}
panelPrefab: {fileID: 8782491854383104488, guid: 61ffa7d22a51b1e48a3495af66e30de0, type: 3}
attackRange: {fileID: 3418438549176293054}
--- !u!1 &3418438549176293054
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1283993893448812918}
- component: {fileID: 202225011326617106}
m_Layer: 0
m_Name: attackRange
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1283993893448812918
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3418438549176293054}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.6889223, y: 1.6889223, z: 1.6889223}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &202225011326617106
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3418438549176293054}
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: 0.9413085, b: 1, 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 &6651975224276639987
GameObject:
m_ObjectHideFlags: 0
@ -102,7 +187,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8433650274046349753
GameObject:
@ -136,7 +221,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8433650274046349755
SpriteRenderer:
@ -328,6 +413,7 @@ Transform:
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 8433650274814453345}
- {fileID: 1283993893448812918}
- {fileID: 8433650274046349754}
- {fileID: 2248967341581213919}
- {fileID: 5621354293604444993}
@ -368,6 +454,7 @@ MonoBehaviour:
HpTextPrefab: {fileID: 0}
_Canvas: {fileID: 0}
spriteRenderers: {fileID: 0}
HurtDirectin: 0
gold: 10
physicalArmor: 10
magicArmor: 5

View File

@ -1,5 +1,89 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &681042887138380540
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6145025051653687837}
- component: {fileID: 2211402838936384874}
m_Layer: 0
m_Name: attackRange
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6145025051653687837
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 681042887138380540}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.6822745, y: 1.6822745, z: 1.6822745}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2211402838936384874
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 681042887138380540}
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: 0.9413085, b: 1, 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 &5542306764898442777
GameObject:
m_ObjectHideFlags: 0
@ -31,7 +115,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &4442126797615120306
BoxCollider2D:
@ -73,6 +157,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
role: {fileID: 8433650274028726420}
panelPrefab: {fileID: 8782491854383104488, guid: 61ffa7d22a51b1e48a3495af66e30de0, type: 3}
attackRange: {fileID: 681042887138380540}
--- !u!1 &6070656209494785206
GameObject:
m_ObjectHideFlags: 0
@ -102,7 +187,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8433650274046349753
GameObject:
@ -136,7 +221,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8433650274046349755
SpriteRenderer:
@ -328,6 +413,7 @@ Transform:
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 8433650274814453345}
- {fileID: 6145025051653687837}
- {fileID: 8433650274046349754}
- {fileID: 2780405381636526920}
- {fileID: 2562350995381512747}
@ -368,6 +454,7 @@ MonoBehaviour:
HpTextPrefab: {fileID: 0}
_Canvas: {fileID: 0}
spriteRenderers: {fileID: 0}
HurtDirectin: 0
gold: 10
physicalArmor: 10
magicArmor: 5

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: dcb3a731cfcc70c4ab418922d45ec4a4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

@ -1 +1 @@
Subproject commit 8fde270423daa41bf2968599462aafe4bac70722
Subproject commit f9085935d5427ccc6ac969d9721c841354f63e43

View File

@ -1,18 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class CharacterClick : MonoBehaviour
{
public Role role;
public Character MyCharacter=null;
[Header("点击出现的详情")] public GameObject panelPrefab;
[Header("µã»÷³öÏֵĹ¥»÷·¶Î§")] public GameObject attackRange;
private Vector3 OrigScale;
private bool isShowAttackRange=true;
public WaveData MyWaveData=null;
void Start()
{
OrigScale = attackRange.transform.localScale;
IdForInfo(transform.GetComponent<enemy>().enemyId);
}
private void OnMouseDown()
@ -28,6 +32,7 @@ public class CharacterClick : MonoBehaviour
if (hit.collider != null && hit.collider.gameObject == gameObject)
{
ShowAttackRange();
Debug.Log("点击了父节点");
// 在这里处理点击事件
GameObject instantiatedPanel= GameObject.Instantiate(panelPrefab, GameObject.Find("Canvas").transform);
@ -38,10 +43,12 @@ public class CharacterClick : MonoBehaviour
{
//string eveText,string name,string def,string speed,string shanghai,string info,int hp,int maxHp
panelRect.GetComponent<charainfoPanel>().UpDateShow("1", "Enemy_002","0","3","1","测试文档一",role.hp,100f);
}
else
{
panelRect.GetComponent<charainfoPanel>().UpDateShow("1", MyCharacter.Name, MyCharacter.Info, MyCharacter.MaxAttack + "~" + MyCharacter.MinAttack, MyCharacter.AttackRange, MyCharacter.AttackCD);
}
@ -49,8 +56,29 @@ public class CharacterClick : MonoBehaviour
}
}
public void ShowAttackRange()
{
if (attackRange!=null&&isShowAttackRange!=true)
{
attackRange.transform.DOScale(OrigScale, 0.3f).SetEase(Ease.InOutBack);
isShowAttackRange = true;
}
else if (attackRange != null && isShowAttackRange)
{
attackRange.transform.DOScale(Vector3.zero, 0.3f).SetEase(Ease.InOutBack);
isShowAttackRange = false;
}
}
public void HideAttackRange()
{
if (attackRange != null )
{
attackRange.transform.DOScale(Vector3.zero, 0.3f).SetEase(Ease.InOutBack);
isShowAttackRange = false;
}
}
void IdForInfo(string id)
{
List<Character> mY = MengyaoInfo.Instance.m_Mengyao;

View File

@ -76,9 +76,11 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
// 拖拽结束
public void OnEndDrag(PointerEventData eventData)
{
mY.GetComponentInChildren<CharacterClick>().HideAttackRange();
if (mY.GetComponent<cardPlace>().isInTrigger)
{
mY.transform.position = mY.GetComponent<cardPlace>().tower.transform.position;
mY.transform.position = mY.GetComponent<cardPlace>().tower.transform.position;
this.enabled = false;
cardBox.instance.ChangeInPlaceNumber(1);
mask.SetActive(true);