Browse Source

随从指针和范围预览

pull/40/head
45 1 year ago
parent
commit
5b407eb84a
  1. 28
      ColorlessWorld-2024-4-2/Assets/Prefab/EnemyPrefab/SkullGuardian.prefab
  2. 92
      ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/MapUnity _2.prefab
  3. 174
      ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity
  4. 10
      ColorlessWorld-2024-4-2/Assets/Scripts/Bullet/BulletMove.cs
  5. 4
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardDrag.cs
  6. 10
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs
  7. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/EnemyManager.cs
  8. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/EnemyPlanFunction/EnemyAction.cs
  9. 1
      ColorlessWorld-2024-4-2/Assets/Scripts/GameManager.cs
  10. 24
      ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs
  11. 89
      ColorlessWorld-2024-4-2/Assets/Scripts/Servent/KindOfServent/ServantBottleCat.cs
  12. 102
      ColorlessWorld-2024-4-2/Assets/Scripts/Servent/Servant.cs
  13. 33
      ColorlessWorld-2024-4-2/Assets/Scripts/Servent/ServantSkill/ArrowInMap.cs
  14. 3
      ColorlessWorld-2024-4-2/Assets/Scripts/Servent/ServantSkill/ServantSkillNode.cs
  15. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/Servent/ServentStateManager.cs
  16. 33
      ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs

28
ColorlessWorld-2024-4-2/Assets/Prefab/EnemyPrefab/SkullGuardian.prefab

@ -166,7 +166,6 @@ GameObject:
- component: {fileID: 3428195215565293398}
- component: {fileID: 1337528727456485653}
- component: {fileID: 8412139385272254344}
- component: {fileID: 8195393732516912303}
m_Layer: 9
m_Name: SkullGuardian
m_TagString: Enemy
@ -262,33 +261,6 @@ MonoBehaviour:
m_Bits: 0
time: 0.2
moveSpeed: 4
--- !u!54 &8195393732516912303
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880325291853289959}
serializedVersion: 4
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 112
m_CollisionDetection: 0
--- !u!1 &2778471538238530486
GameObject:
m_ObjectHideFlags: 0

92
ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/MapUnity _2.prefab

@ -59,10 +59,12 @@ MonoBehaviour:
locationY: 0
compalte: 0
influenced: 0
infHighLight: 0
markInfluenced: 0
aoeInfluenced: 0
choossedMark: {fileID: 1211505881046303546}
hightLigtMark: {fileID: 1502226451502315807}
highLightMark: {fileID: 2876526258649879192}
enemyInfMark: {fileID: 1502226451502315807}
aoeMake: {fileID: 5001237128860500630}
red: {fileID: 2100000, guid: 876d1c111d915ca45b7304b41dcc1060, type: 2}
yellow: {fileID: 2100000, guid: cf59497cd92e036419cf5cfa2d1e4c79, type: 2}
@ -212,7 +214,7 @@ GameObject:
- component: {fileID: 8485410642332178147}
- component: {fileID: 6124836568472427169}
m_Layer: 0
m_Name: mark
m_Name: EnemyMark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -283,6 +285,89 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &2876526258649879192
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7892340080281178766}
- component: {fileID: 3449952772631546546}
- component: {fileID: 8361859619082391464}
m_Layer: 0
m_Name: infHighLight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &7892340080281178766
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2876526258649879192}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.258}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4579690416932963536}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3449952772631546546
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2876526258649879192}
m_Mesh: {fileID: -5468021829708598221, guid: ae332737a5755ee499c32f566d3a2913, type: 3}
--- !u!23 &8361859619082391464
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2876526258649879192}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7d9328d5c1fdb3a47bf6791baa1726d9, type: 2}
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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &5001237128860500630
GameObject:
m_ObjectHideFlags: 0
@ -294,7 +379,7 @@ GameObject:
- component: {fileID: 4883386901402821735}
- component: {fileID: 883082380404279443}
m_Layer: 0
m_Name: enemyMark
m_Name: AOEMark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -505,6 +590,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5510486009783351286}
- {fileID: 7892340080281178766}
- {fileID: 8900614378456229163}
- {fileID: 4883386901402821735}
m_Father: {fileID: 2384686249825617783}

174
ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity

@ -8291,7 +8291,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
servantState: {fileID: 11400000, guid: 28fb39120070fbe46b1d96b7004b7b1b, type: 2}
servant: {fileID: 1202010108}
--- !u!4 &515302569
Transform:
m_ObjectHideFlags: 0
@ -17411,7 +17410,6 @@ GameObject:
- component: {fileID: 1202010104}
- component: {fileID: 1202010108}
- component: {fileID: 1202010109}
- component: {fileID: 1202010110}
m_Layer: 7
m_Name: Servant
m_TagString: Servant
@ -17504,6 +17502,7 @@ Transform:
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 1148505999}
- {fileID: 1971171988}
- {fileID: 1533829698}
- {fileID: 106379630}
m_Father: {fileID: 0}
@ -17531,6 +17530,7 @@ MonoBehaviour:
movePath: []
anim: {fileID: 1148506001}
speed: 2
arrowInMap: {fileID: 1971171990}
stepIconCount: -1
StepIconFather: {fileID: 1259659850}
stepIconPrefab: {fileID: 5159667013927544512, guid: ca425697306c5a941b283345d04e8f26,
@ -17609,20 +17609,6 @@ MonoBehaviour:
textCurrentHPdValue: {fileID: 365654902}
textMaxHPValue: {fileID: 350066635}
textShieldValue: {fileID: 762310626}
--- !u!114 &1202010110
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1202010103}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7f89d6a95cea3849b3ea899f72d31c1, type: 3}
m_Name:
m_EditorClassIdentifier:
lineRenderer: {fileID: 0}
pointNum: 0
--- !u!1 &1206243802
GameObject:
m_ObjectHideFlags: 0
@ -19171,6 +19157,7 @@ MonoBehaviour:
HpBar: {fileID: 743691082}
playerHPinUpUI: {fileID: 1528011285}
servantOn: {fileID: 0}
servant: {fileID: 1202010108}
servantState: {fileID: 0}
playerBoundary: 3
enemyBoundary: 6
@ -28962,6 +28949,161 @@ MonoBehaviour:
type: 3}
usedCardList:
deleteCardList:
--- !u!1 &1971171987
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1971171988}
- component: {fileID: 1971171990}
- component: {fileID: 1971171989}
m_Layer: 7
m_Name: AimArrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1971171988
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1971171987}
serializedVersion: 2
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: 1202010107}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!120 &1971171989
LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1971171987}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6dae87f6dbe79e34fb7adcae048807dd, type: 2}
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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.15714298
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 1
m_Loop: 0
m_ApplyActiveColorSpace: 1
--- !u!114 &1971171990
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1971171987}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7f89d6a95cea3849b3ea899f72d31c1, type: 3}
m_Name:
m_EditorClassIdentifier:
lineRenderer: {fileID: 1971171989}
density: 2
speed: 0.003
aimLayerMask:
serializedVersion: 2
m_Bits: 64
--- !u!1 &1974423746
GameObject:
m_ObjectHideFlags: 0

10
ColorlessWorld-2024-4-2/Assets/Scripts/Bullet/BulletMove.cs

@ -32,15 +32,5 @@ public class BulletMove : MonoBehaviour
Destroy(this.gameObject);
}
}
private void OnTriggerEnter(Collider other)
{
if (other.transform.tag == "Enemy")
{
// Destroy(this.gameObject);
}
}
private void OnCollisionEnter(Collision collision)
{
}
}

4
ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardDrag.cs

@ -85,7 +85,7 @@ public class CardDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag
}
}
if (GameManager.Instance.onDraw ==false )
if (GameManager.Instance.onDraw ==false &&TurnMaster .Instance .servantAction != TurnMaster.ServantAction.useSkill )
{
switch (dragState)
{
@ -423,7 +423,7 @@ public class CardDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag
public void OnBeginDrag(PointerEventData eventData)
{
if(GameManager.Instance.onDrag == false && TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.none)
if(GameManager.Instance.onDrag == false && TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.none&& TurnMaster.Instance.servantAction != TurnMaster.ServantAction.useSkill)
dragState = CardDragState.onBeginDrag;
}

10
ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs

@ -188,12 +188,12 @@ public class TurnMaster : Singleton<TurnMaster>
}
public void CloseSkillUI()
{
ServentStateManager.Instance.servant .SkillUI.SetActive(false);
GameManager.Instance.servant .SkillUI.SetActive(false);
}
//Ëæ´Ó¼¼ÄÜÀäÈ´
public void SettleCoolDownSkill()
{
List<Servant.ServantSkill> skillList = ServentStateManager.Instance.servant.skillList;
List<Servant.ServantSkill> skillList =GameManager.Instance.servant.skillList;
foreach (Servant.ServantSkill skill in skillList)
{
if(skill.currentStorageTimes<skill .storageTimes)
@ -201,7 +201,7 @@ public class TurnMaster : Singleton<TurnMaster>
if(skill .currentCoolDown >0)
{
skill.currentCoolDown--;
ServentStateManager.Instance.servant.skillNodeList[skill.effectIndex].coolDownText.text=skill .currentCoolDown .ToString ();
GameManager.Instance.servant.skillNodeList[skill.effectIndex].coolDownText.text=skill .currentCoolDown .ToString ();
}
if (skill.currentCoolDown <= 0)
@ -213,8 +213,8 @@ public class TurnMaster : Singleton<TurnMaster>
if(skill .currentStorageTimes >0)
{
ServentStateManager.Instance.servant.skillNodeList[skill.effectIndex].GetComponent <Image >().sprite = skill.Icon;
ServentStateManager.Instance.servant.skillNodeList[skill.effectIndex].coolDownText.gameObject.SetActive(false);
GameManager.Instance.servant.skillNodeList[skill.effectIndex].GetComponent <Image >().sprite = skill.Icon;
GameManager.Instance.servant.skillNodeList[skill.effectIndex].coolDownText.gameObject.SetActive(false);
}
}
}

2
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/EnemyManager.cs

@ -571,7 +571,7 @@ public class EnemyManager : Singleton<EnemyManager>
foreach ( var i in disInfluencePreviewPool)
{
i.markInfluenced = true;
i.hightLigtMark.GetComponent<Renderer>().material = i.enemyMark;
i.enemyInfMark.GetComponent<Renderer>().material = i.enemyMark;
}
}

2
ColorlessWorld-2024-4-2/Assets/Scripts/EnemyPlanFunction/EnemyAction.cs

@ -31,7 +31,7 @@ public class EnemyAction
foreach (var mapNode in enemyNode.rangePool)
{
mapNode.markInfluenced = true;
mapNode.hightLigtMark.GetComponent<Renderer>().material = mapNode.enemyMark;
mapNode.enemyInfMark.GetComponent<Renderer>().material = mapNode.enemyMark;
}
foreach (var mapNode in enemyNode.aoeRangePool)
{

1
ColorlessWorld-2024-4-2/Assets/Scripts/GameManager.cs

@ -44,6 +44,7 @@ public class GameManager : Singleton<GameManager>
[Header("使魔当前位置参数")]
public MapUnity servantOn;//当前在哪个格子上
[Header("角色状态数据参数")]
public Servant servant;
public ServantState_SO servantState;//在游戏中实际使用的数据
[Header("场地颜色个数UI")]

24
ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs

@ -12,11 +12,13 @@ public class MapUnity : MonoBehaviour
[Header("UI效果范围控件")]
public bool influenced;//被选中
public bool markInfluenced;//需要被高亮显示
public bool infHighLight;//我方高亮
public bool markInfluenced;//敌人范围
public bool aoeInfluenced;//被aoe标记
public GameObject choossedMark;//被选中激活
public GameObject hightLigtMark;//被选中高亮
public GameObject highLightMark;//被选中激活
public GameObject enemyInfMark;//被选中高亮
public GameObject aoeMake;//aoe标记
public Material red;
@ -72,7 +74,7 @@ public class MapUnity : MonoBehaviour
void Update()
{
if(influenced)
if (influenced)
{
choossedMark.SetActive(true);
}
@ -80,13 +82,21 @@ public class MapUnity : MonoBehaviour
{
choossedMark.SetActive(false);
}
if (infHighLight)
{
highLightMark.SetActive(true);
}
else
{
highLightMark.SetActive(false);
}
if (markInfluenced)
{
hightLigtMark.SetActive(true);
enemyInfMark.SetActive(true);
}
else
{
hightLigtMark.SetActive(false);
enemyInfMark.SetActive(false);
}
if (aoeInfluenced)
{
@ -97,7 +107,7 @@ public class MapUnity : MonoBehaviour
aoeMake.SetActive(false);
}
//根据涂色角色改变颜色
if (whoColour == WhoColour.playerColour )
if (whoColour == WhoColour.playerColour)
{
colourGameObject.GetComponent<Renderer>().material = plyerColour;
}
@ -107,7 +117,7 @@ public class MapUnity : MonoBehaviour
}
else if (whoColour == WhoColour.noneColour)
{
colourGameObject.GetComponent<Renderer>().material = noneColour ;
colourGameObject.GetComponent<Renderer>().material = noneColour;
}
}
public void RegisterUnit()

89
ColorlessWorld-2024-4-2/Assets/Scripts/Servent/KindOfServent/ServantBottleCat.cs

@ -1,5 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using UnityEngine;
using UnityEngine.InputSystem;
@ -7,6 +10,7 @@ public class ServantBottleCat : Servant
{
[Header ("技能资源")]
public GameObject bulletPrefab;
public override void SkillePreviewSelector(int index)
{
switch (index)
@ -22,6 +26,21 @@ public class ServantBottleCat : Servant
break;
}
}
public override void SkillePreviewEffectSelector(int index, MapUnity currentMapUnity)
{
switch (index)
{
case 0:
PreEffectRange_0(currentMapUnity);
break;
case 1:
PreEffectRange_1(currentMapUnity);
break;
case 2:
PreEffectRange_2(currentMapUnity);
break;
}
}
public override void SkilleEffectSelector(int index)
{
switch (index)
@ -37,12 +56,15 @@ public class ServantBottleCat : Servant
break;
}
}
//Ô¤ÀÀ·¶Î§
public void PreEffect_0()
{
arrowInMap.gameObject.SetActive(true );//´ò¿ª¼ýÍ·
MovePreView();
}
public void PreEffect_1()
{
arrowInMap.gameObject.SetActive(true);//´ò¿ª¼ýÍ·
influencePreviewPool.UnionWith(MapUnityManager.Instance.findReachableTiles(GameManager.Instance.servantOn,skillList [currentSkillInex].throwRange ));
//遍历影响池变色
foreach (MapUnity mapUnity in influencePreviewPool)
@ -54,6 +76,7 @@ public class ServantBottleCat : Servant
}
public void PreEffect_2()
{
arrowInMap.gameObject.SetActive(true);//´ò¿ª¼ýÍ·
influencePreviewPool.UnionWith(MapUnityManager.Instance.findReachableTiles(GameManager.Instance.servantOn, skillList[currentSkillInex].throwRange));
//遍历影响池变色
foreach (MapUnity mapUnity in influencePreviewPool)
@ -63,6 +86,63 @@ public class ServantBottleCat : Servant
}
TurnMaster.Instance.servantAction = TurnMaster.ServantAction.useSkill;
}
//Ô¤ÀÀЧ¹û·¶Î§
public void PreEffectRange_0(MapUnity currentMapUnity )
{
effectRangePreviewPool.Add(currentMapUnity);
HighLightEffectRange();
}
public void PreEffectRange_1(MapUnity currentMapUnity)
{
effectRangePreviewPool.Add(currentMapUnity);
HighLightEffectRange();
}
public void PreEffectRange_2(MapUnity currentMapUnity)
{
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, chooseNodeLayerMask.value))
{
Vector3 direction = raycastHit.transform.position - transform.position;
float angle1 = Vector3.SignedAngle(transform.forward, direction, transform.up);
if (angle1 < 0)
{
angle1 += 360f;
}
Debug.Log(angle1+"ǰ");
if (angle1 >= 300f)
{
angle1 = 330f;
}
else if (angle1 >= 240f)
{
angle1 = 270f;
}
else if (angle1 >= 180f)
{
angle1 = 210f;
}
else if (angle1 >= 120f)
{
angle1 = 150f;
}
else if (angle1 >= 60f)
{
angle1 = 90f;
}
else if (angle1 >= 0f)
{
angle1 = 30f;
}
Debug.Log(angle1 + "ºó");
effectRangePreviewPool = getNodeTools.setEffectRangePreviewNoCard("3_1", angle1, currentMapUnity);
HighLightEffectRange();
}
}
public void Effect_0()
{
StartCoroutine(MoveToChooseNode());
@ -98,16 +178,17 @@ public class ServantBottleCat : Servant
{
Debug.Log(raycastHit.collider.name);
MapUnity currentNode = raycastHit.transform.GetComponent<MapUnity>();
List <MapUnity > path = AStarManager.Instance.FindPathWithEndNode(GameManager.Instance.servantOn, currentNode);
foreach (var node in path )
if(currentNode .influenced ==true )
{
foreach (var node in effectRangePreviewPool)
{
node.whoColour = MapUnity.WhoColour.playerColour;
}
anim.SetTrigger("shoot");
SettleSkillCoolDown(skillList[currentSkillInex], skillNodeList[currentSkillInex]);
}
}
ResetPreView();
}
}

102
ColorlessWorld-2024-4-2/Assets/Scripts/Servent/Servant.cs

@ -11,6 +11,7 @@ public class Servant : MonoBehaviour
{
public int startPositionX, startPositionY;
public HashSet<MapUnity> influencePreviewPool = new HashSet<MapUnity>();//记录预览影响的对象池
public HashSet<MapUnity> effectRangePreviewPool = new HashSet<MapUnity>();//效果作用范围
[Header("层级检测")]
public LayerMask chooseNodeLayerMask;//移动射线选择的层级
@ -22,7 +23,11 @@ public class Servant : MonoBehaviour
public Animator anim;
[Header("跑步速度")]
public float speed = 2;
[Header("瞄准箭头")]
public ArrowInMap arrowInMap;
[Header("技能瞄准上一帧瞄准格子")]
public MapUnity latestMapUnity;//与当前帧不一致刷新范围
private bool isRefresh;
[Header("步数标识个数集(UI)")]
public int stepIconCount;
public Transform StepIconFather;
@ -47,6 +52,7 @@ public class Servant : MonoBehaviour
private void Start()
{
GameManager.Instance.servant = this;
Invoke("StartSevent", 4f);
InstantiateSkillUI();
@ -58,48 +64,51 @@ public class Servant : MonoBehaviour
GameManager.Instance.servantOn = currentNode;
this.gameObject.transform.position = new Vector3(currentNode.transform.position.x, 0.5f, currentNode.transform.position.z);
}
public void Update()
public virtual void Update()
{
if (Mouse.current.leftButton.wasReleasedThisFrame && TurnMaster.Instance.playerAction != TurnMaster.PlayerAction.useCard && TurnMaster.Instance.servantAction != TurnMaster.ServantAction.banAction)
{
//if (GameManager.Instance.servantState.currentStepRange > 0 && !Usermanager.playerAbnormalCondition.ContainsKey(AbnormalCondition.banStep))
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if(Physics.Raycast(ray, out RaycastHit raycastHit, 500, playerLayerMask.value) )
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, playerLayerMask.value))
{
if (raycastHit.collider.gameObject.tag == "Servant")
{
GameManager.Instance.character = GameManager.SelectedCharacter.servant;
Debug.Log(raycastHit.collider.gameObject.name);
//Debug.Log(raycastHit.collider.gameObject.name);
//展开技能表
ShowSkillUI();
}
else if (raycastHit.collider.gameObject.tag == "ServantSkillUI")//检测到是技能
{
GameManager.Instance.character = GameManager.SelectedCharacter.servant;
TurnMaster.Instance.servantAction = TurnMaster.ServantAction.useSkill;
//技能范围预览(button触发添加技能序号)
//MovePreView();
if (skillList[currentSkillInex ].currentStorageTimes > 0)
if (skillList[currentSkillInex].currentStorageTimes > 0)
{
TurnMaster.Instance.servantAction = TurnMaster.ServantAction.useSkill;
isRefresh = true;
SkillePreviewSelector(currentSkillInex);
ColorInUseSkillUI();
}
}
else if (Physics.Raycast(ray, out RaycastHit raycastHitMap, 500, chooseNodeLayerMask .value))
else if (Physics.Raycast(ray, out RaycastHit raycastHitMap, 500, chooseNodeLayerMask.value))
{
isRefresh = false;
//检测到地面,释放技能实际效果
if (GameManager.Instance.character == GameManager.SelectedCharacter.servant&& TurnMaster.Instance.servantAction == TurnMaster.ServantAction.useSkill)
if (GameManager.Instance.character == GameManager.SelectedCharacter.servant && TurnMaster.Instance.servantAction == TurnMaster.ServantAction.useSkill)
{
SkilleEffectSelector(currentSkillInex);
ColorResrtUseSkillUI();
}
}
}
else
{
ResetPreView();
}
}
if (Mouse.current.rightButton.wasPressedThisFrame)
@ -107,6 +116,22 @@ public class Servant : MonoBehaviour
ResetPreView();
}
//鼠标移动就刷新范围预览
if (isRefresh ==true)
{
Ray rayMap = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if (Physics.Raycast(rayMap, out RaycastHit raycastHitRefresh, 500, chooseNodeLayerMask.value))
{
MapUnity currentMapUnity = raycastHitRefresh.transform.GetComponent<MapUnity>();
if (currentMapUnity != latestMapUnity)
{
CleanEffectRange();
SkillePreviewEffectSelector(currentSkillInex,currentMapUnity);
latestMapUnity = currentMapUnity;
}
}
}
//同步步数UI标识
if (GameManager.Instance.servantState.currentStepRange != stepIconCount)
{
@ -127,12 +152,36 @@ public class Servant : MonoBehaviour
public virtual void SkillePreviewSelector(int index)
{
}
//技能效果范围预览
public virtual void SkillePreviewEffectSelector(int index,MapUnity currentMapUnity )
{
}
//技能效果释放
public virtual void SkilleEffectSelector(int index)
{
}
//高亮效果作用范围
public void HighLightEffectRange()
{
foreach (MapUnity mapUnity in effectRangePreviewPool )
{
mapUnity.infHighLight = true;
}
}
//消除效果作用范围
public void CleanEffectRange()
{
foreach (MapUnity mapUnity in effectRangePreviewPool)
{
mapUnity.infHighLight = false;
}
effectRangePreviewPool.Clear();
}
//展开技能表
public void ShowSkillUI()
{
@ -198,9 +247,11 @@ public class Servant : MonoBehaviour
{
// StepPreviewInfluencedNode(step);
CloseStepPreviewInfluencedNode();//取消格子预览
CleanEffectRange();//取消范围预览
ColorResrtUseSkillUI();//恢复技能UI
arrowInMap.gameObject.SetActive(false);//关闭箭头
isRefresh = false;
if (TurnMaster.Instance.servantAction != TurnMaster.ServantAction.banAction)
TurnMaster.Instance.servantAction = TurnMaster.ServantAction.none;
}
@ -220,11 +271,15 @@ public class Servant : MonoBehaviour
}
public IEnumerator MoveToChooseNode()//射线检测选择一个mapNode
{
//关闭箭头
arrowInMap.gameObject.SetActive(false);
//关闭高亮预览
CleanEffectRange();
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, chooseNodeLayerMask.value))
{
Debug.Log(raycastHit.collider.gameObject.name);
// Debug.Log(raycastHit.collider.gameObject.name);
MapUnity mapNode = raycastHit.collider.transform.GetComponent<MapUnity>();
//改变缩放翻转
@ -250,16 +305,11 @@ public class Servant : MonoBehaviour
GameManager.Instance.servantOn.playerOn = false;
GameManager.Instance.servantOn.influenced = false;
}
//遍历影响池变色
foreach (MapUnity mapUnity in influencePreviewPool)
{
mapUnity.influenced = false;
}
influencePreviewPool.Clear();
CloseStepPreviewInfluencedNode();
//标记终点
mapNode.markInfluenced = true;
mapNode.infHighLight = true;
for (int i = 1; i < movePath.Count; i++)
{
@ -278,8 +328,8 @@ public class Servant : MonoBehaviour
yield return 0;
}
//判断寄生,流血是否生效
Usermanager.Instance.ParasitismnRealize(movePath[i]);//´«È뵱ǰnode
Usermanager.Instance.bleedRealize();
//Usermanager.Instance.ParasitismnRealize(movePath[i]);//传入当前node
// Usermanager.Instance.bleedRealize();
//减体力
GameManager.Instance.servantState.currentStepRange -= 1;
//同步技能UI
@ -298,7 +348,7 @@ public class Servant : MonoBehaviour
anim.SetBool("move", false);
//取消标记终点
mapNode.markInfluenced = false;
mapNode.infHighLight = false;
TurnMaster.Instance.servantAction = TurnMaster.ServantAction.none;

33
ColorlessWorld-2024-4-2/Assets/Scripts/Servent/ServantSkill/ArrowInMap.cs

@ -1,10 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class ArrowInMap : MonoBehaviour
{
public LineRenderer lineRenderer;
public int pointNum;
public float density = 2f; //ÃܶÈ
public float speed;//ËÙ¶È
public Vector3 destination;//Ä¿µÄµØ
public LayerMask aimLayerMask;
private int id = Shader.PropertyToID("_MainTex");
private Material material;
private Vector2 offset = new Vector2(0, 0);
private void OnEnable()
{
material = lineRenderer.material;
}
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, aimLayerMask.value))
{
destination = raycastHit.point;
lineRenderer.SetPosition(0,this.transform.position);
lineRenderer.SetPosition(1,destination);
float lineLength = (lineRenderer.GetPosition(1) - lineRenderer.GetPosition(0)).magnitude;
material.SetTextureScale(id, new Vector2(lineLength * density, 0));
offset -= new Vector2(speed, 0);
material.SetTextureOffset(id, offset);
}
}
}

3
ColorlessWorld-2024-4-2/Assets/Scripts/Servent/ServantSkill/ServantSkillNode.cs

@ -50,7 +50,8 @@ public class ServantSkillNode : MonoBehaviour
col.enabled = true;
button.enabled = true;
image.color = new Color(225f, 225f, 225f, 1f);
servant. CloseStepPreviewInfluencedNode();//È¡Ïû¸ñ×ÓÔ¤ÀÀ
//±éÀúÓ°Ïì³Ø±äÉ«
servant. CloseStepPreviewInfluencedNode();
}
public IEnumerator GoDistination()

2
ColorlessWorld-2024-4-2/Assets/Scripts/Servent/ServentStateManager.cs

@ -7,8 +7,6 @@ public class ServentStateManager : Singleton<ServentStateManager>
[Header("使魔数据")]
//使魔数据
public ServantState_SO servantState;
//使魔脚本
public Servant servant;
private void Start()
{

33
ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using Unity.VisualScripting;
using UnityEditor.VersionControl;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
@ -549,9 +550,41 @@ public class getNodeTools
{
getNodeTools.checkListPass(cardEntity.influencePreviewPool, currentNode);
}
}
public static HashSet<MapUnity> setEffectRangePreviewNoCard(string effectRange, float euler, MapUnity currentNode)
{
MapUnity playerOnNode = GameManager.Instance.playerOn.transform.GetComponent<MapUnity>();
var handlers = new Dictionary<string, EffectRangeHandler>
{
{EffectRange.range1,new EffectRangeHandler1(currentNode,euler) },
{EffectRange.range2,new EffectRangeHandler2(currentNode,euler) },
{EffectRange.range3_1,new EffectRangeHandler3_1(currentNode,euler) },
{EffectRange.range3_2,new EffectRangeHandler3_2(currentNode,euler) },
{EffectRange.range3_3,new EffectRangeHandler3_3(currentNode,euler) },
{EffectRange.range4_1,new EffectRangeHandler4_1(currentNode,euler) },
{EffectRange.range4_2,new EffectRangeHandler4_2(currentNode,euler) },
{EffectRange.range4_3,new EffectRangeHandler4_3(currentNode,euler) },
{EffectRange.range5_1,new EffectRangeHandler5_1(currentNode,euler) },
{EffectRange.range5_2,new EffectRangeHandler5_2(currentNode,euler) },
{EffectRange.range5_3,new EffectRangeHandler5_3(currentNode,euler) },
{EffectRange.range6_1,new EffectRangeHandler6_1(currentNode,euler) },
{EffectRange.range6_2,new EffectRangeHandler6_2(currentNode,euler) },
{EffectRange.range6_3,new EffectRangeHandler6_3(playerOnNode,euler) },
{EffectRange.range7_1,new EffectRangeHandler7_1(currentNode,euler) },
{EffectRange.range7_2,new EffectRangeHandler7_2(currentNode,euler) },
{EffectRange.range8_1,new EffectRangeHandler8_1(currentNode,euler) },
{EffectRange.range8_2,new EffectRangeHandler8_2(playerOnNode,euler) },
};
HashSet<MapUnity> influencePreviewPool = new HashSet<MapUnity>();
if (handlers.TryGetValue(effectRange, out var handler))
{
influencePreviewPool = handler.HandleAngleWithResult(euler);
}
return influencePreviewPool;
}
}

Loading…
Cancel
Save