28 changed files with 1391 additions and 17 deletions
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 661fd2bb49fc63847bd149bbde597faf |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 8530888d5a27b2741a53af50312ea8fe |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,171 @@ |
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &1496019408761085200 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5563030652977735299} |
|||
m_Layer: 0 |
|||
m_Name: GameObject |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &5563030652977735299 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1496019408761085200} |
|||
serializedVersion: 2 |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: 0, y: -0.945, z: 0} |
|||
m_LocalScale: {x: 1.1111112, y: 1.1111112, z: 1.1111112} |
|||
m_ConstrainProportionsScale: 0 |
|||
m_Children: [] |
|||
m_Father: {fileID: 6047049870113643063} |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &2458175114420723768 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 6047049870113643063} |
|||
- component: {fileID: 4354208083307919355} |
|||
- component: {fileID: 8645409521225535772} |
|||
m_Layer: 0 |
|||
m_Name: tree |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &6047049870113643063 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2458175114420723768} |
|||
serializedVersion: 2 |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 3.592, y: 1, z: -1.2736247} |
|||
m_LocalScale: {x: 0.9, y: 0.9, z: 0.9} |
|||
m_ConstrainProportionsScale: 1 |
|||
m_Children: |
|||
- {fileID: 5563030652977735299} |
|||
m_Father: {fileID: 0} |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!212 &4354208083307919355 |
|||
SpriteRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2458175114420723768} |
|||
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: f9ca4d2a420a8f14b8ff292551fc0001, type: 3} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_FlipX: 0 |
|||
m_FlipY: 0 |
|||
m_DrawMode: 0 |
|||
m_Size: {x: 1.923, y: 1.879} |
|||
m_AdaptiveModeThreshold: 0.5 |
|||
m_SpriteTileMode: 0 |
|||
m_WasSpriteAssigned: 1 |
|||
m_MaskInteraction: 0 |
|||
m_SpriteSortPoint: 0 |
|||
--- !u!114 &8645409521225535772 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2458175114420723768} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: b93e606dce1c400408bd059eaaa399b2, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
templateEnemyState: {fileID: 11400000, guid: b991b3f0500bd0c439d1a956c497c4cb, type: 2} |
|||
EnemyState: {fileID: 0} |
|||
positionX: 0 |
|||
positionY: 0 |
|||
pasth: [] |
|||
oppositePasth: [] |
|||
moveType: 0 |
|||
rangePool: [] |
|||
aoeRangePool: [] |
|||
stateText: |
|||
jumpHeight: 0 |
|||
posCount: 0 |
|||
jumpSpeed: 0 |
|||
speedCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: [] |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
enemyType: 1 |
|||
enemyScript: 0 |
|||
lineAim: {fileID: 0} |
|||
canLineAppre: 0 |
|||
disableAttack: {fileID: 0} |
|||
enemyUIBar: {fileID: 8570734685845233804, guid: 825ad890badfb4c4c9829a5507a78704, |
|||
type: 3} |
|||
followPoint: {fileID: 5563030652977735299} |
|||
bone: {fileID: 0} |
|||
bone_Re: {fileID: 0} |
|||
lasteHp: 0 |
|||
anim: {fileID: 0} |
|||
meleeAttackSpeed: 0 |
|||
meleeAttackSpeedCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: [] |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
canMove: 0 |
|||
planAction: 0 |
|||
@ -0,0 +1,7 @@ |
|||
fileFormatVersion: 2 |
|||
guid: f3c59a4c3b3c54a4c952f50e44940dfc |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
|
After Width: | Height: | Size: 1.7 MiB |
@ -0,0 +1,127 @@ |
|||
fileFormatVersion: 2 |
|||
guid: a98c5224244c43241a646abc1427d491 |
|||
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 |
|||
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: 0 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 1000 |
|||
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 |
|||
swizzle: 50462976 |
|||
cookieLightType: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
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: 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: Server |
|||
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: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 178e0d528cfe03d4f81caddb6d109dbb |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,612 @@ |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
using UnityEngine.EventSystems; |
|||
using UnityEngine.InputSystem; |
|||
using System; |
|||
using Unity.VisualScripting; |
|||
using System.Data; |
|||
|
|||
public class TempPlaceEffect: MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler |
|||
{ |
|||
|
|||
[Header("拖拽参数")] |
|||
public Transform originalParent; |
|||
public Vector3 originalpoint; |
|||
|
|||
//更换父级前的排序位置
|
|||
public int originalIndexInChild; |
|||
|
|||
public EventSystem eventSystem; |
|||
public bool canUse = true;//决定卡牌是否可以释放
|
|||
bool choosed;//标识卡牌是否被选中
|
|||
|
|||
[Header("贝塞尔曲线瞄准")] |
|||
public GameObject ainPanle; |
|||
|
|||
[Header("影响格参数")] |
|||
public MapUnity currentNode;//瞄准的格子
|
|||
|
|||
[Header("卡牌拖拽状态")] |
|||
public CardDragState dragState = CardDragState.noDrag; |
|||
public enum CardDragState |
|||
{ |
|||
onBeginDrag, |
|||
onDrag, |
|||
onEndDrag, |
|||
noDrag |
|||
} |
|||
PointerEventData eventData; |
|||
List<RaycastResult> result = new List<RaycastResult>(); |
|||
|
|||
public bool ready;//是否已到达可释放位置
|
|||
|
|||
[Header("卡牌属性")] |
|||
public List<MapUnity> castingPool;//卡牌打出范围
|
|||
|
|||
private CardEntity cardEntity; |
|||
|
|||
[Header("射线图层剔除")] |
|||
public LayerMask layerMask; |
|||
|
|||
[Header("鼠标检测脚本")] |
|||
public CardOnMouseEnter cardOnMouseEnter; |
|||
|
|||
void Start() |
|||
{ |
|||
originalParent = gameObject.transform.parent; |
|||
dragState = CardDragState.noDrag; |
|||
eventSystem = GameObject.FindObjectOfType<EventSystem>(); |
|||
eventData = new PointerEventData(eventSystem); |
|||
|
|||
cardOnMouseEnter = GetComponent<CardOnMouseEnter>(); |
|||
|
|||
eventSystem = GameObject.FindObjectOfType<EventSystem>(); |
|||
cardEntity = GetComponent<CardEntity>(); |
|||
|
|||
cardEntity.createCard("2001", 0, true); |
|||
} |
|||
|
|||
|
|||
private void Update() |
|||
{ |
|||
handleRightClickCancel(); |
|||
|
|||
|
|||
if (dragState != CardDragState.noDrag && dragState != CardDragState.onDrag) |
|||
{ |
|||
//UI射线检测
|
|||
eventData.position = Mouse.current.position.value; |
|||
|
|||
eventSystem.RaycastAll(eventData, result); |
|||
if (result.Count > 0) |
|||
{ |
|||
Debug.Log(result[0].gameObject.name); |
|||
} |
|||
} |
|||
|
|||
if (GameManager.Instance.onDraw == false && TurnMaster.Instance.servantAction != TurnMaster.ServantAction.useSkill) |
|||
{ |
|||
switch (dragState) |
|||
{ |
|||
case CardDragState.onBeginDrag: |
|||
GameManager.Instance.onDrag = true; |
|||
SettlementManager.Instance.expectSettle(cardEntity.cardOriginalData);//预计伤害计算
|
|||
if (choosed == false) |
|||
{ |
|||
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.useCard; |
|||
CardChoose(eventData); |
|||
dragState = CardDragState.onDrag; |
|||
} |
|||
break; |
|||
case CardDragState.onDrag: |
|||
CardFollow(); |
|||
if (Mouse.current.leftButton.wasReleasedThisFrame && ready) |
|||
{ |
|||
dragState = CardDragState.onEndDrag; |
|||
} |
|||
break; |
|||
case CardDragState.onEndDrag: |
|||
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.none; |
|||
CardUse(); |
|||
break; |
|||
case CardDragState.noDrag: |
|||
if (Mouse.current.leftButton.wasReleasedThisFrame && GameManager.Instance.onDrag == false && TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.none) |
|||
{ |
|||
eventData.position = Mouse.current.position.value; |
|||
|
|||
eventSystem.RaycastAll(eventData, result); |
|||
if (result.Count > 0) |
|||
{ |
|||
// Debug.Log(result[0].gameObject.name);
|
|||
if (result[0].gameObject == this.gameObject) |
|||
{ |
|||
dragState = CardDragState.onBeginDrag; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
//卡片动作
|
|||
//开始选中
|
|||
public void CardChoose(PointerEventData eventData) |
|||
{ |
|||
banActionCardCheck(); |
|||
disArmCheck(); |
|||
costCheck(); |
|||
disCardCheck(); |
|||
if (!cardEntity.canUse) |
|||
{ |
|||
resetComponentPosition(); |
|||
return; |
|||
} |
|||
choosed = true; |
|||
//选中音效
|
|||
AudioManager.Instance.ChooseCardVoicePlayer(true); |
|||
|
|||
GetComponent<CanvasGroup>().blocksRaycasts = false; |
|||
originalpoint = this.transform.localPosition; |
|||
|
|||
transform.SetParent(transform.parent.parent); |
|||
transform.localPosition = cardOnMouseEnter.originPoint; |
|||
|
|||
GetComponent<RectTransform>().localScale = cardOnMouseEnter.targetScale; |
|||
|
|||
//根据卡牌数据决定是否调用曲线
|
|||
if (cardEntity.cardOriginalData.CastingRange != 0) |
|||
{ |
|||
//释放范围为0则不需要调用曲线
|
|||
ainPanle.SetActive(true); |
|||
} |
|||
else |
|||
{ |
|||
ainPanle.SetActive(false); |
|||
} |
|||
} |
|||
|
|||
//拖拽中
|
|||
public void CardFollow() |
|||
{ |
|||
if (!cardEntity.canUse) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
dyeing(); |
|||
|
|||
eventData.position = Mouse.current.position.value; |
|||
|
|||
eventSystem.RaycastAll(eventData, result); |
|||
// Debug.Log(result[0].gameObject.name);
|
|||
if (result.Count > 0) |
|||
{ |
|||
if (result[0].gameObject.name == "TotalPanel") |
|||
{ |
|||
if (ready == false) |
|||
{ |
|||
ready = true; |
|||
} |
|||
transform.localPosition = cardOnMouseEnter.originPoint;// + new Vector3(0, 30, 0);
|
|||
// transform.localScale = new Vector3(1, 1, 1);
|
|||
if (cardEntity.cardOriginalData.CastingRange != 0) |
|||
{ |
|||
ainPanleWork(eventData); |
|||
} |
|||
else |
|||
{ |
|||
noAinPanleWork(eventData); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (ready == true) |
|||
{ |
|||
resetComponentPosition(); |
|||
} |
|||
else |
|||
{ |
|||
// Debug.Log(transform.position);
|
|||
// Debug.Log(eventData.position);
|
|||
// transform.position = eventData.position;
|
|||
Vector3 eventDataWorld = CardActiveSort.Instance.ScreenPointToWorldPoint(eventData.position, 4f); |
|||
transform.position = eventDataWorld; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
//卡牌释放
|
|||
public void CardUse() |
|||
{ |
|||
EnemyManager.Instance.HideExpHP_Observer(); |
|||
GameManager.Instance.onDrag = false; |
|||
//目标释放选择
|
|||
/*if (!cardTargetCheck()) |
|||
{ |
|||
canUse = false; |
|||
Debug.Log("目标不符合"); |
|||
//resetComponentPosition();
|
|||
}*/ |
|||
|
|||
if (canUse) |
|||
{ |
|||
CardActiveSort.Instance.ReflashCardPoint(); |
|||
StartCoroutine(OnDragIEnumerator(eventData)); |
|||
} |
|||
else |
|||
{ |
|||
canUse = true; |
|||
resetComponentPosition(); |
|||
} |
|||
|
|||
dragState = CardDragState.onDrag; |
|||
} |
|||
|
|||
//检查卡牌的费用是否可以释放
|
|||
private void costCheck() |
|||
{ |
|||
Debug.Log("当前费用:" + TurnMaster.Instance.currentCost); |
|||
Debug.Log("总费用:" + Usermanager.Instance.totalCost); |
|||
int trueCost = cardEntity.cardOriginalData.Cost; |
|||
if (MapUnityManager.Instance.isPlayerOn(Name.NodeColor.Black)) |
|||
{ |
|||
trueCost++; |
|||
} |
|||
if (GameManager.Instance.playerState.currentCost - trueCost < 0) |
|||
{ |
|||
Debug.Log("费用不足"); |
|||
TipManager.Instance.SendTip("费用不足"); |
|||
cardEntity.canUse = false; |
|||
} |
|||
|
|||
} |
|||
|
|||
private void stepCostCheck(bool canAdv) |
|||
{ |
|||
/*if (canAdv) |
|||
{ |
|||
if (cardEntity.cardOriginalData.AdvantageFunctionVal.ContainsKey(CardFunction.costStep)) |
|||
{ |
|||
if (GameManager.Instance.playerState.currentStepRange< int.Parse(cardEntity.cardOriginalData.AdvantageFunctionVal[CardFunction.costStep])) |
|||
{ |
|||
Debug.Log("步数不足"); |
|||
cardEntity.canUse = false; |
|||
} |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (cardEntity.cardOriginalData.FunctionVal.ContainsKey(CardFunction.costStep)) |
|||
{ |
|||
if (GameManager.Instance.playerState.currentStepRange < int.Parse(cardEntity.cardOriginalData.FunctionVal[CardFunction.costStep])) |
|||
{ |
|||
Debug.Log("步数不足"); |
|||
cardEntity.canUse = false; |
|||
} |
|||
} |
|||
}*/ |
|||
} |
|||
|
|||
private void disArmCheck() |
|||
{ |
|||
/*if (Usermanager.playerAbnormalCondition.ContainsKey(AbnormalCondition.disarm)&&cardEntity.cardOriginalData.CarType.Equals(CardType.attack)) |
|||
{ |
|||
Debug.Log("被缴械了"); |
|||
cardEntity.canUse = false; |
|||
}*/ |
|||
} |
|||
|
|||
private void disCardCheck() |
|||
{ |
|||
Dictionary<string, string> trueFunctionVal = new Dictionary<string, string>(); |
|||
//trueFunctionVal.AddRange(cardEntity.cardOriginalData.FunctionVal);
|
|||
int drawCardNum = 0; |
|||
foreach (KeyValuePair<string, string> kvp in trueFunctionVal) |
|||
{ |
|||
switch (kvp.Key) |
|||
{ |
|||
case CardFunction.drawCard: |
|||
if (Usermanager.playerAbnormalCondition.ContainsKey(AbnormalCondition.banDrawCard)) |
|||
{ |
|||
|
|||
} |
|||
else |
|||
{ |
|||
drawCardNum += int.Parse(kvp.Value); |
|||
} |
|||
break; |
|||
|
|||
} |
|||
} |
|||
foreach (KeyValuePair<string, string> kvp in trueFunctionVal) |
|||
{ |
|||
switch (kvp.Key) |
|||
{ |
|||
case CardFunction.discard: |
|||
if (TurnMaster.Instance.handCard.cardEntityList.Count - int.Parse(kvp.Value) - 1 + drawCardNum < 0) |
|||
{ |
|||
Debug.Log("没有足够的牌可以弃牌"); |
|||
cardEntity.canUse = false; |
|||
} |
|||
break; |
|||
|
|||
} |
|||
} |
|||
} |
|||
private void banActionCardCheck() |
|||
{ |
|||
if (TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.banAction) |
|||
{ |
|||
cardEntity.canUse = false; |
|||
} |
|||
else |
|||
{ |
|||
cardEntity.canUse = true; |
|||
} |
|||
if (TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.move) |
|||
{ |
|||
cardEntity.canUse = false; |
|||
} |
|||
else if (TurnMaster.Instance.playerAction != TurnMaster.PlayerAction.banAction) |
|||
{ |
|||
cardEntity.canUse = true; |
|||
} |
|||
|
|||
} |
|||
private void resetComponentPosition() |
|||
{ |
|||
//取消音效
|
|||
AudioManager.Instance.ChooseCardVoicePlayer(false); |
|||
//遍历范围预览池消除影响色
|
|||
foreach (MapUnity mapUnity in MapUnityManager.Instance.castPool) |
|||
{ |
|||
mapUnity.influenced = false; |
|||
} |
|||
MapUnityManager.Instance.castPool.Clear(); |
|||
//遍历影响池变色
|
|||
foreach (MapUnity mapUnity in cardEntity.influencePreviewPool) |
|||
{ |
|||
mapUnity.influenced = false; |
|||
} |
|||
cardEntity.influencePreviewPool.Clear(); |
|||
|
|||
ready = false; |
|||
GameManager.Instance.onDrag = false; |
|||
dragState = CardDragState.noDrag; |
|||
|
|||
if (TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.useCard) |
|||
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.none; |
|||
|
|||
choosed = false; |
|||
canUse = true;//取消释放
|
|||
ainPanle.SetActive(false); |
|||
//其他位置都归位
|
|||
transform.SetParent(originalParent); |
|||
//归位孩子顺序
|
|||
transform.SetSiblingIndex(cardOnMouseEnter.oringinIndex); |
|||
|
|||
GetComponent<CanvasGroup>().blocksRaycasts = true; |
|||
transform.localScale = new Vector3(1f, 1f, 1f); |
|||
|
|||
CardActiveSort.Instance.ReflashCardPoint(); |
|||
|
|||
//隐藏怪物虚血
|
|||
EnemyManager.Instance.HideExpHP_Observer(); |
|||
|
|||
return; |
|||
} |
|||
|
|||
//右键取消释放
|
|||
private void handleRightClickCancel() |
|||
{ |
|||
|
|||
if (choosed && Mouse.current.rightButton.wasPressedThisFrame) |
|||
{ |
|||
resetComponentPosition(); |
|||
} |
|||
} |
|||
|
|||
public void OnBeginDrag(PointerEventData eventData) |
|||
{ |
|||
if (GameManager.Instance.onDrag == false && TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.none && TurnMaster.Instance.servantAction != TurnMaster.ServantAction.useSkill) |
|||
dragState = CardDragState.onBeginDrag; |
|||
} |
|||
|
|||
private void ainPanleWork(PointerEventData eventData) |
|||
{ |
|||
//射线检测瞄准的地图节点,判断是否可放置和改变放置影响区
|
|||
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value); |
|||
Debug.Log(Mouse.current.position.value); |
|||
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, layerMask.value)) |
|||
{ |
|||
//Debug.Log(raycastHit.collider.gameObject.name);
|
|||
//检测到跟上次瞄准地方不同,更新
|
|||
if (currentNode == null || raycastHit.collider.transform.gameObject != currentNode.gameObject) |
|||
{ |
|||
foreach (MapUnity mapUnity in cardEntity.influencePreviewPool) |
|||
{ |
|||
mapUnity.influenced = false; |
|||
} |
|||
cardEntity.influencePreviewPool.Clear(); |
|||
currentNode = raycastHit.collider.transform.GetComponent<MapUnity>(); |
|||
|
|||
//重新调用范围预览
|
|||
//GameManager.Instance.player.StepPreviewInfluencedNode(cardEntity.cardOriginalData.CastingRange);
|
|||
int castRange = cardEntity.cardOriginalData.CastingRange; |
|||
if (MapUnityManager.Instance.isPlayerOn(Name.NodeColor.Green)) |
|||
{ |
|||
castRange++; |
|||
} |
|||
setCastingRangePreview(castRange); |
|||
//预览影响范围
|
|||
if (currentNode.influenced) |
|||
{ |
|||
//根据卡牌属性改变影响池
|
|||
Vector3 face = currentNode.transform.position - GameManager.Instance.playerOn.transform.position; |
|||
float euler = Vector3.SignedAngle(-GameManager.Instance.playerOn.transform.forward, face, GameManager.Instance.playerOn.transform.up) + 180; |
|||
Debug.Log("euler是" + euler); |
|||
getNodeTools.setEffectRangePreview(cardEntity.cardOriginalData.EffectRange, euler, currentNode, cardEntity); |
|||
//setEffectRangePreview(cardEntity.cardOriginalData.EffectRange, euler, currentNode);
|
|||
//influencePreviewPool.Add(currentNode);
|
|||
|
|||
|
|||
} |
|||
|
|||
//更新效果作用范围内怪物虚血
|
|||
EnemyManager.Instance.ShowExpHp_Observer(cardEntity.influencePreviewPool); |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
private void setCastingRangePreview(int castRange) |
|||
{ |
|||
foreach (MapUnity mapUnity in MapUnityManager.Instance.castPool) |
|||
{ |
|||
mapUnity.influenced = false; |
|||
} |
|||
MapUnityManager.Instance.castPool.Clear(); |
|||
MapUnityManager.Instance.getCastPool(cardEntity.cardOriginalData.EffectRange, castRange); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
private void getInfluencePreviePoll(MapUnity currentNode, string effecctRange) |
|||
{ |
|||
switch (effecctRange) |
|||
{ |
|||
case EffectRange.range1: |
|||
break; |
|||
|
|||
} |
|||
} |
|||
|
|||
private void noAinPanleWork(PointerEventData eventData) |
|||
{ |
|||
|
|||
/*Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value); |
|||
if (eventData.pointerCurrentRaycast.gameObject != null) |
|||
{ |
|||
if (Physics.Raycast(ray, out RaycastHit raycastHit)) |
|||
{ |
|||
currentNode = raycastHit.collider.transform.GetComponent<MapUnity>(); |
|||
cardEntity.influencePreviewPool.Add(currentNode); |
|||
} |
|||
}*/ |
|||
getNodeTools.setEffectRangePreview(cardEntity.cardOriginalData.EffectRange, 30.0f, currentNode, cardEntity); |
|||
} |
|||
|
|||
public void OnDrag(PointerEventData eventData) |
|||
{ |
|||
|
|||
} |
|||
|
|||
private void dyeing() |
|||
{ |
|||
//遍历影响池变色
|
|||
foreach (MapUnity mapUnity in cardEntity.influencePreviewPool) |
|||
{ |
|||
mapUnity.PlayerInfluenced(cardEntity.influencePreviewPool); |
|||
mapUnity.playerMark.meshRenderer.material = mapUnity.castPreRange; |
|||
} |
|||
} |
|||
|
|||
|
|||
public void OnEndDrag(PointerEventData eventData) |
|||
{ |
|||
|
|||
} |
|||
|
|||
private IEnumerator OnDragIEnumerator(PointerEventData eventData) |
|||
{ |
|||
if (!cardEntity.canUse) |
|||
{ |
|||
yield break; |
|||
} |
|||
choosed = false; |
|||
if (canUse) |
|||
{ |
|||
if (eventData.pointerCurrentRaycast.gameObject != null) |
|||
{ |
|||
resetComponentPosition(); |
|||
} |
|||
if (ainPanle.activeSelf) |
|||
{ |
|||
ainPanle.SetActive(false);//关闭贝塞尔曲线
|
|||
} |
|||
|
|||
//先判断该卡牌的类型是否是需要范围
|
|||
if (cardEntity.cardOriginalData.CastingRange != 0) |
|||
{ |
|||
if (currentNode != null && currentNode.influenced) |
|||
{ |
|||
//卡牌释放效果
|
|||
yield return StartCoroutine(cardEntity.settle(0, currentNode)); |
|||
} |
|||
else |
|||
{ |
|||
resetComponentPosition(); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
//卡牌释放效果
|
|||
yield return StartCoroutine(cardEntity.settle(0, GameManager.Instance.playerOn)); |
|||
|
|||
} |
|||
yield break; |
|||
} |
|||
else |
|||
{ |
|||
canUse = true; |
|||
} |
|||
} |
|||
|
|||
private bool cardTargetCheck() |
|||
{ |
|||
bool targetRight = false; |
|||
switch (cardEntity.cardOriginalData.CardTarget) |
|||
{ |
|||
case Name.Target.enemy: |
|||
foreach (MapUnity mapUnity in cardEntity.influencePreviewPool) |
|||
{ |
|||
if (mapUnity.enemyNode != null && mapUnity.enemyNode.enemyType == EnemyNode.EnemyType.enemy) |
|||
{ |
|||
targetRight = true; break; |
|||
} |
|||
} |
|||
break; |
|||
case Name.Target.enemyAndBuilding: |
|||
foreach (MapUnity mapUnity in cardEntity.influencePreviewPool) |
|||
{ |
|||
if (mapUnity.enemyNode != null) |
|||
{ |
|||
targetRight = true; break; |
|||
} |
|||
} |
|||
break; |
|||
case Name.Target.ally: |
|||
targetRight = true; |
|||
break; |
|||
} |
|||
Debug.Log("targetRight是" + targetRight); |
|||
return targetRight; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: b1a0228ae98882d43974484e55dca280 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 94e65eea5776642479a5d8a43b0bfbe6 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,37 @@ |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Rendering; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
public class ExpHpFlash : MonoBehaviour |
|||
{ |
|||
public Image image; |
|||
public Color white; |
|||
public Color black; |
|||
public Color originColor; |
|||
public float speed; |
|||
float time; |
|||
bool dir; |
|||
void Update() |
|||
{ |
|||
if(dir) |
|||
{ |
|||
time += Time.deltaTime * speed; |
|||
} |
|||
else |
|||
{ |
|||
time -= Time.deltaTime * speed; |
|||
} |
|||
if(time >=1) |
|||
{ |
|||
dir = false; |
|||
} |
|||
if(time <=0) |
|||
{ |
|||
dir = true; |
|||
} |
|||
|
|||
image.color = Vector4.Lerp(black, white, time); |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: d937092a4e1cd4f43a6d5b3f650624b0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
|
Loading…
Reference in new issue