更新了飞行道具的基础代码
This commit is contained in:
parent
1fa6eeb5ec
commit
746ae6cfa1
@ -129,6 +129,54 @@ MonoBehaviour:
|
||||
ResourceName: '-'
|
||||
Exp: 0
|
||||
SpriteList: []
|
||||
- Resource: 1
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u9C7C\u7FA4"
|
||||
Exp: 1
|
||||
SpriteList: []
|
||||
- Resource: 2
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u9CB8\u9C7C"
|
||||
Exp: 0
|
||||
SpriteList: []
|
||||
- Resource: 3
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u77FF\u77F3"
|
||||
Exp: 2
|
||||
SpriteList: []
|
||||
- Resource: 4
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u52A8\u7269"
|
||||
Exp: 1
|
||||
SpriteList: []
|
||||
- Resource: 5
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u852C\u679C"
|
||||
Exp: 1
|
||||
SpriteList: []
|
||||
- Resource: 6
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u5E84\u7A3C"
|
||||
Exp: 2
|
||||
SpriteList: []
|
||||
- Resource: 7
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u6751\u5E84"
|
||||
Exp: 0
|
||||
SpriteList: []
|
||||
- Resource: 8
|
||||
Sprite: {fileID: 0}
|
||||
VarientSprite: 0
|
||||
ResourceName: "\u9057\u8FF9"
|
||||
Exp: 0
|
||||
SpriteList: []
|
||||
WonderInfoList:
|
||||
- Wonder: 0
|
||||
WonderType: 1
|
||||
|
||||
2853
My project/Assets/Resources/Prefab/projectilePrefab.prefab
Normal file
2853
My project/Assets/Resources/Prefab/projectilePrefab.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bbbb0836227809479cd548b78da596c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -253,8 +253,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1170740}
|
||||
- component: {fileID: 1170742}
|
||||
- component: {fileID: 1170741}
|
||||
m_Layer: 0
|
||||
m_Name: GridMap
|
||||
m_TagString: Untagged
|
||||
@ -277,93 +275,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1057660731}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!483693784 &1170741
|
||||
TilemapRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1170739}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
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: -288522843
|
||||
m_SortingLayer: 1
|
||||
m_SortingOrder: 0
|
||||
m_ChunkSize: {x: 32, y: 32, z: 32}
|
||||
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
|
||||
m_MaxChunkCount: 16
|
||||
m_MaxFrameAge: 16
|
||||
m_SortOrder: 3
|
||||
m_Mode: 1
|
||||
m_DetectChunkCullingBounds: 0
|
||||
m_MaskInteraction: 0
|
||||
--- !u!1839735485 &1170742
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1170739}
|
||||
m_Enabled: 1
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!1 &2690384
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -84635,6 +84546,37 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 566022632}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &568308643
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 568308644}
|
||||
m_Layer: 0
|
||||
m_Name: ProjectileMap
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &568308644
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 568308643}
|
||||
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: 1057660731}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &569278947
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -125588,8 +125530,8 @@ RectTransform:
|
||||
m_GameObject: {fileID: 826951404}
|
||||
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_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children:
|
||||
- {fileID: 1270843465}
|
||||
- {fileID: 1259739106}
|
||||
@ -138894,8 +138836,8 @@ RectTransform:
|
||||
m_GameObject: {fileID: 916180261}
|
||||
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_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children:
|
||||
- {fileID: 1640501328}
|
||||
m_Father: {fileID: 20834529}
|
||||
@ -160632,6 +160574,7 @@ Transform:
|
||||
- {fileID: 1623486915}
|
||||
- {fileID: 1955952727}
|
||||
- {fileID: 1170740}
|
||||
- {fileID: 568308644}
|
||||
- {fileID: 1648196620}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -180842,7 +180785,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1181852328
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -289571,8 +289514,8 @@ RectTransform:
|
||||
m_GameObject: {fileID: 1948549456}
|
||||
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_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children:
|
||||
- {fileID: 1139719342}
|
||||
- {fileID: 1632644411}
|
||||
@ -290648,8 +290591,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1955952727}
|
||||
- component: {fileID: 1955952729}
|
||||
- component: {fileID: 1955952728}
|
||||
m_Layer: 0
|
||||
m_Name: UnitMap
|
||||
m_TagString: Untagged
|
||||
@ -290672,93 +290613,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1057660731}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!483693784 &1955952728
|
||||
TilemapRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1955952726}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
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_ChunkSize: {x: 32, y: 32, z: 32}
|
||||
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
|
||||
m_MaxChunkCount: 16
|
||||
m_MaxFrameAge: 16
|
||||
m_SortOrder: 3
|
||||
m_Mode: 1
|
||||
m_DetectChunkCullingBounds: 0
|
||||
m_MaskInteraction: 0
|
||||
--- !u!1839735485 &1955952729
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1955952726}
|
||||
m_Enabled: 1
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!1 &1956194983
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -140,7 +140,12 @@ public class GridAndResourceDataAssets : ScriptableObject
|
||||
{
|
||||
|
||||
if (!_resourceInfoDict.TryGetValue(resource, out var resourceInfo))
|
||||
{
|
||||
Debug.Log("Error In GetResourceName , " + resource);
|
||||
return "Error In GetResourceName";
|
||||
}
|
||||
|
||||
|
||||
return resourceInfo.ResourceName;
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,6 @@ namespace Logic
|
||||
{
|
||||
//如果锁了input
|
||||
if (inputLock) return;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
mouseLastDownPosition = Input.mousePosition;
|
||||
@ -110,6 +109,7 @@ namespace Logic
|
||||
|
||||
if (Input.GetMouseButtonUp(0)) // 检测鼠标点击
|
||||
{
|
||||
//Debug.Log("Alive");
|
||||
if (EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
//如果同时点到了其他UI要素,那么判断是不是UICanvans的点击,如果点到了UICancas,那么return,这次tile点击不生效
|
||||
@ -223,7 +223,9 @@ namespace Logic
|
||||
return;
|
||||
|
||||
string actionNameFinal = MultilingualManager.Instance.GetMultilingualText(uint.Parse(actionInfo.ActionName));
|
||||
string actionDescFinal = MultilingualManager.Instance.GetMultilingualText(uint.Parse(actionInfo.Desc)).Replace("\\n", "\n");
|
||||
string actionDescFinal = "";
|
||||
if(actionInfo.Desc != "")
|
||||
actionDescFinal = MultilingualManager.Instance.GetMultilingualText(uint.Parse(actionInfo.Desc)).Replace("\\n", "\n");
|
||||
|
||||
// 文本内容,这里可以更细分,比如根据按钮绑定的ActionId来取不同的文字
|
||||
_main.UIManager.BottomInfoUI._hintWindow.transform.Find("Text").GetComponent<TextMeshProUGUI>().text
|
||||
|
||||
@ -4,16 +4,12 @@
|
||||
* @Date: 2025年04月01日 星期二 11:04:16
|
||||
* @Modify:
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using Logic.AI;
|
||||
using Logic.Audio;
|
||||
using Logic.Multilingual;
|
||||
using UnityEngine;
|
||||
using RuntimeData;
|
||||
using Unity.VisualScripting;
|
||||
|
||||
using TH1Renderer;
|
||||
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
using UnityEngine;
|
||||
using RuntimeData;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using Logic;
|
||||
using Logic.Multilingual;
|
||||
namespace Logic
|
||||
namespace TH1Renderer
|
||||
{
|
||||
public class CityInfoRenderer
|
||||
{
|
||||
@ -1,12 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using RuntimeData;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Logic;
|
||||
|
||||
|
||||
namespace Logic
|
||||
namespace TH1Renderer
|
||||
{
|
||||
|
||||
public enum EffectTypeEnum
|
||||
@ -1,9 +1,9 @@
|
||||
using UnityEngine;
|
||||
using RuntimeData;
|
||||
using Animancer;
|
||||
using Logic;
|
||||
|
||||
|
||||
namespace Logic
|
||||
namespace TH1Renderer
|
||||
{
|
||||
public class GridRenderer
|
||||
{
|
||||
@ -3,12 +3,10 @@ using UnityEngine;
|
||||
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
using TMPro;
|
||||
|
||||
using UnityEditor;
|
||||
using RuntimeData;
|
||||
using Logic;
|
||||
|
||||
namespace Logic
|
||||
namespace TH1Renderer
|
||||
{
|
||||
public class MapRenderer
|
||||
{
|
||||
@ -16,51 +14,22 @@ namespace Logic
|
||||
private MapData _mapData;
|
||||
private Transform _unitRenderMap;
|
||||
private Transform _gridRenderMap;
|
||||
Transform cityBuildingMap;
|
||||
|
||||
Transform _cityInfoRenderMap;
|
||||
CameraController cameraController;
|
||||
public EffectManager effectManager; //特效管理器,管理目前所有特效
|
||||
public EffectManager EffectManager; //特效管理器,管理目前所有特效
|
||||
public ProjectileManager ProjectileManager;
|
||||
|
||||
private Transform _projectileRenderMap;
|
||||
|
||||
GameObject _unitPrefab; //承载单位图像的prefab
|
||||
GameObject _gridPrefab; //承载grid的prefab
|
||||
GameObject _cityInfoPrefab; //承载城市图形信息、人口条的prefab
|
||||
|
||||
//CityInfoUI资源
|
||||
Sprite showbarMiddleWhite;
|
||||
Sprite showbarMiddleBlue;
|
||||
Sprite showbarLeftWhite;
|
||||
Sprite showbarLeftBlue;
|
||||
Sprite showbarRightWhite;
|
||||
Sprite showbarRightBlue;
|
||||
Sprite popbarBlack;
|
||||
Sprite popbarWhite;
|
||||
|
||||
//特效的预制体
|
||||
GameObject fogEffectPrefab;
|
||||
GameObject shineEffectPrefab;
|
||||
GameObject attackEffectPrefab;
|
||||
GameObject firePrefab; // 火焰预制体
|
||||
|
||||
|
||||
private List<GameObject> renderedUnit = new List<GameObject>();
|
||||
//private List<GameObject> renderedCityInfoMapPrefab = new List<GameObject>();
|
||||
public GameObject[,] renderedGrid;
|
||||
public Dictionary<uint, GridRenderer> ROGridMap;
|
||||
public Dictionary<uint, CityInfoRenderer> ROCityInfoMap;
|
||||
public Dictionary<uint, UnitRenderer> ROUnitMap;
|
||||
|
||||
public string[] housePath = new string[16]
|
||||
{
|
||||
"Xin-Xi", "Imperius", "Bardur", "Oumaji", "Kickoo", "Hoodrick", "Luxidoor", "Vengir", "Zebasi", "Ai-Mo",
|
||||
"Aquarion", "Quetzali", "Elyrion", "Yadakk", "Polaris", "Cymanti"
|
||||
};
|
||||
|
||||
public string[] namePath = new string[16]
|
||||
{
|
||||
"Xinxi", "Imperius", "Bardur", "Oumaji", "Kickoo", "Hoodrick", "Luxidoor", "Vengir", "Zebasi", "Aimo",
|
||||
"Aquarion", "Quetzali", "Elyrion", "Yadakk", "Polaris", "Cymanti"
|
||||
};
|
||||
|
||||
bool aniFlagExplorer = false; //用于探险家动画的标识bool
|
||||
GameObject explorerUnit; //用于存储探险家图像
|
||||
Vector2Int explorerNowPos; //用于存储探险家Data当前的位置
|
||||
@ -103,6 +72,11 @@ namespace Logic
|
||||
ROGridMap = new Dictionary<uint, GridRenderer>();
|
||||
ROCityInfoMap = new Dictionary<uint, CityInfoRenderer>();
|
||||
ROUnitMap = new Dictionary<uint, UnitRenderer>();
|
||||
|
||||
//建立子模块的manager,目前仅有projectile
|
||||
ProjectileManager = new ProjectileManager();
|
||||
|
||||
|
||||
// 获取场景中的所有根 GameObject
|
||||
GameObject[] rootObjects = currentScene.GetRootGameObjects();
|
||||
foreach (GameObject rootObject in rootObjects)
|
||||
@ -111,39 +85,17 @@ namespace Logic
|
||||
{
|
||||
_unitRenderMap = rootObject.transform.Find("UnitMap");
|
||||
_gridRenderMap = rootObject.transform.Find("GridMap");
|
||||
|
||||
_cityInfoRenderMap = rootObject.transform.Find("CityInfoMap").GetComponent<Transform>();
|
||||
cityBuildingMap = rootObject.transform.Find("CityBuildingMap");
|
||||
_unitPrefab = Resources.Load<GameObject>($"Prefab/unitPrefab");
|
||||
_gridPrefab = Resources.Load<GameObject>($"Prefab/tilePrefab");
|
||||
_cityInfoPrefab = Resources.Load<GameObject>($"Prefab/cityInfoMapPrefab");
|
||||
|
||||
showbarMiddleWhite =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_middlepart_blank");
|
||||
showbarMiddleBlue =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_middlepart_filled");
|
||||
showbarLeftWhite =
|
||||
Resources.Load<Sprite>($"ArtResources/graphic_resource/Misc/city_level_showbar_leftpart_blank");
|
||||
showbarLeftBlue =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_leftpart_filled");
|
||||
showbarRightWhite =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_rightpart_blank");
|
||||
showbarRightBlue =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_rightpart_filled");
|
||||
popbarBlack =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_population_black");
|
||||
popbarWhite =
|
||||
Resources.Load<Sprite>(
|
||||
$"ArtResources/graphic_resource/Misc/city_level_showbar_population_white");
|
||||
fogEffectPrefab = Resources.Load<GameObject>($"Prefab/fogEffectPrefab");
|
||||
shineEffectPrefab = Resources.Load<GameObject>($"Prefab/shineEffectPrefab");
|
||||
attackEffectPrefab = Resources.Load<GameObject>($"Prefab/attackEffectPrefab");
|
||||
firePrefab = Resources.Load<GameObject>($"Prefab/fireEffectPrefab");
|
||||
//处理子模块Manager的Init,目前仅有projectileManager
|
||||
ProjectileManager.Init(rootObject);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (rootObject.name == "Main Camera")
|
||||
{
|
||||
@ -289,12 +241,14 @@ namespace Logic
|
||||
//cameraController.FocusOnTile(highlightGridMap, tilePosition);
|
||||
}
|
||||
|
||||
//当gridMap出现新的对象时,新建对象
|
||||
public void RenderUpdateGridMap()
|
||||
{
|
||||
foreach (var gridData in _main.MapData.GridMap.GridList)
|
||||
ROGridMap[gridData.Id] = new GridRenderer(_gridPrefab,_gridRenderMap,gridData.Id,_main.MapData,_main);
|
||||
}
|
||||
|
||||
//当cityMap出现新的对象时,新建对象
|
||||
public void RenderUpdateCityMap()
|
||||
{
|
||||
foreach (var cityData in _main.MapData.CityMap.CityList)
|
||||
@ -308,6 +262,7 @@ namespace Logic
|
||||
}
|
||||
}
|
||||
|
||||
//当unitMap出现新的对象时,新建对象
|
||||
public void RenderUpdateUnitMap()
|
||||
{
|
||||
foreach (var unitData in _main.MapData.UnitMap.UnitList)
|
||||
@ -317,6 +272,13 @@ namespace Logic
|
||||
ROUnitMap[unitData.Id] = new UnitRenderer(_unitPrefab,_unitRenderMap,unitData.Id,_main.MapData,_main);
|
||||
}
|
||||
}
|
||||
|
||||
//当projectileMap出现新的对象时,新建对象
|
||||
public void RenderUpdateProjectileMap()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 初次渲染地图
|
||||
public void FirstRenderMap()
|
||||
{
|
||||
57
My project/Assets/Scripts/TH1Renderer/ProjectileManager.cs
Normal file
57
My project/Assets/Scripts/TH1Renderer/ProjectileManager.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Logic.Skill;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using RuntimeData;
|
||||
|
||||
namespace TH1Renderer
|
||||
{
|
||||
|
||||
public enum ProjectileType { Arrow, Bomb, MagicFireBall}
|
||||
public enum ProjectileMoveType { Straight, Parabola, Spin, Curved,Bounce,SpecialAnimation}
|
||||
|
||||
public class ProjectileData
|
||||
{
|
||||
public MapData MapData;
|
||||
public uint Id;
|
||||
public ProjectileType ProjectileType;
|
||||
public ProjectileMoveType ProjectileMoveType;
|
||||
public GridData StartGrid, EndGrid;
|
||||
}
|
||||
|
||||
public class ProjectileManager
|
||||
{
|
||||
|
||||
public uint IdCalculater;
|
||||
public Dictionary<uint, ProjectileData> ProjectileDict;
|
||||
public Dictionary<uint, ProjectileRenderer> ROProjectileMap;
|
||||
|
||||
|
||||
//存储的projectileRenderMap对象(在主界面挂在谁下面)和projectilePrefab对象(用来实例化)
|
||||
private GameObject _projectilePrefab;
|
||||
private Transform _projectileRenderMap;
|
||||
public void Init(GameObject rootObject)
|
||||
{
|
||||
IdCalculater = 0;
|
||||
ProjectileDict = new Dictionary<uint, ProjectileData>();
|
||||
_projectileRenderMap = rootObject.transform.Find("ProjectileMap");
|
||||
_projectilePrefab = Resources.Load<GameObject>($"Prefab/projectilePrefab");
|
||||
|
||||
}
|
||||
|
||||
public void CreateProjectile(MapData mapData,GridData startGrid,GridData endGrid,ProjectileType projectileType,ProjectileMoveType moveType)
|
||||
{
|
||||
//先创建新的projectileData数据
|
||||
var t = new ProjectileData();
|
||||
t.Id = IdCalculater++;
|
||||
ProjectileDict[t.Id] = t;
|
||||
|
||||
//再创建对应projectileRender对象,以及绑定的prefab
|
||||
//ROProjectileMap[t.Id] = new UnitRenderer(_projectilePrefab,_unitRenderMap,unitData.Id,_main.MapData,_main);
|
||||
//ProjectileRenderer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5aefd27a0473ed34c9cbd460000fab84
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
My project/Assets/Scripts/TH1Renderer/ProjectileRenderer.cs
Normal file
82
My project/Assets/Scripts/TH1Renderer/ProjectileRenderer.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using RuntimeData;
|
||||
using Logic;
|
||||
|
||||
namespace TH1Renderer
|
||||
{
|
||||
public class ProjectileRenderer
|
||||
{
|
||||
private MapData _mapData;
|
||||
private Main _main;
|
||||
|
||||
private GameObject _ROprojectile;
|
||||
private ProjectileData _projectileData;
|
||||
|
||||
//------- Update缓存数据 -------//
|
||||
private UnitData _unitData;
|
||||
private GridData _gridData;
|
||||
private PlayerData _playerData;
|
||||
|
||||
private Vector3 originalPosition; // 记录初始位置
|
||||
public Material shadowMaterial; // 指向你创建的阴影 Material
|
||||
public Vector2 shadowOffset = new Vector2(0.1f, -0.1f); // 阴影偏移
|
||||
public float shadowSoftness = 0.5f; // 阴影柔和程度
|
||||
|
||||
SpriteEffectController effectController;
|
||||
|
||||
//------bounce相关参数--------
|
||||
bool _needBounce = false, _isBounceDown = true;
|
||||
Vector3 bounceUpPos, bounceDownPos;
|
||||
float bounceTime = 0f;
|
||||
float bounceDownFullTime = 0.07f;
|
||||
float bounceUpFullTime = 0.2f;
|
||||
|
||||
|
||||
bool _needMove = false;
|
||||
Vector3 moveStartPos, moveEndPos;
|
||||
float moveTime = 0f;
|
||||
float moveFullTime = 0.3f;
|
||||
bool renderVeteran = false;
|
||||
|
||||
private bool _needAttack = false;
|
||||
private AttackAnimType _attackAnimType = AttackAnimType.None;
|
||||
private float _attackTime = 0f;
|
||||
private bool _isAttackGo = false;
|
||||
private bool _isAttackBack = false;
|
||||
private bool _isAttackArrow = false;
|
||||
private bool _isAttackBomb = false;
|
||||
private float _needWaitTime = 0f;
|
||||
private Vector3 _attackTargetPos, _attackBackPos;
|
||||
private bool _needBack;
|
||||
private float _attackGoFullTime = 0.15f;
|
||||
private float _attackBackFullTime = 0.15f;
|
||||
|
||||
|
||||
private GameObject _attackHighlight;
|
||||
private GameObject _selectHighlight;
|
||||
|
||||
public ProjectileRenderer(GameObject prefab,Transform father, ProjectileData projectileData, MapData mapData, Main main)
|
||||
{
|
||||
_mapData = mapData;
|
||||
_main = main;
|
||||
_projectileData = projectileData;
|
||||
//在projectileData的startGrid处创建对象
|
||||
Vector3 tpos = Table.Instance.GridToWorld(_projectileData.StartGrid,"isUnit");
|
||||
_ROprojectile = GameObject.Instantiate(prefab, tpos, Quaternion.identity, father);
|
||||
}
|
||||
|
||||
|
||||
public GameObject GetROUnit() { return _ROprojectile; }
|
||||
|
||||
public void Die()
|
||||
{
|
||||
GameObject.Destroy(_ROprojectile.gameObject);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9460e39a401e7274cbe2ee2e155332d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,9 +1,9 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using RuntimeData;
|
||||
using System.Collections.Generic;
|
||||
using Logic;
|
||||
|
||||
namespace Logic
|
||||
namespace TH1Renderer
|
||||
{
|
||||
public class UnitRenderer
|
||||
{
|
||||
@ -1,16 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Animancer.Units;
|
||||
using System.Collections.Generic;
|
||||
using Logic;
|
||||
using Logic.Action;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Tilemaps;
|
||||
using TMPro; // 如果使用TextMeshPro
|
||||
using RuntimeData;
|
||||
using Logic.Multilingual;
|
||||
using Unity.VisualScripting;
|
||||
|
||||
public class BottomInfoUI// : MonoBehaviour
|
||||
{
|
||||
@ -232,7 +227,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
if (_main.MapData.GetCityDataByGid(gridData.Id, out var cityData))
|
||||
{
|
||||
GameObject clone =
|
||||
GameObject.Instantiate(_main.MapRenderer.ROGridMap[UIBottomInfoStatusObjectId].GetROGrid());
|
||||
GameObject.Instantiate(_main.MapRenderer.ROGridMap[UIBottomInfoStatusObjectId].GetROGrid() as GameObject);
|
||||
clone.transform.SetParent(_cityPreviewArea.transform);
|
||||
clone.transform.localPosition = new Vector3(0,15,0);
|
||||
clone.transform.Find("SelectHighlight").gameObject.SetActive(false);
|
||||
@ -302,7 +297,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
else
|
||||
{
|
||||
GameObject clone =
|
||||
GameObject.Instantiate(_main.MapRenderer.ROGridMap[UIBottomInfoStatusObjectId].GetROGrid());
|
||||
GameObject.Instantiate(_main.MapRenderer.ROGridMap[UIBottomInfoStatusObjectId].GetROGrid() as GameObject);
|
||||
clone.transform.SetParent(_gridPreviewArea.transform);
|
||||
clone.transform.localPosition = new Vector3(0,15,0);
|
||||
clone.transform.Find("SelectHighlight").gameObject.SetActive(false);
|
||||
@ -365,7 +360,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(Table.Instance.GridAndResourceDataAssets.GetResourceName(gridData.Resource));
|
||||
//Debug.Log(Table.Instance.GridAndResourceDataAssets.GetResourceName(gridData.Resource));
|
||||
MultilingualManager.Instance.SetUIText(_gridBaseInfo.transform.Find("DataInfo/Title3").GetComponent<TextMeshProUGUI>(),
|
||||
Table.Instance.GridAndResourceDataAssets.GetResourceName(gridData.Resource));
|
||||
}
|
||||
@ -410,7 +405,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
{
|
||||
_main.MapData.UnitMap.GetUnitDataByUnitId(UIBottomInfoStatusObjectId,out var unitData);
|
||||
//筹备unit预览格子
|
||||
GameObject clone = GameObject.Instantiate(_main.MapRenderer.ROUnitMap[UIBottomInfoStatusObjectId].GetROUnit());
|
||||
GameObject clone = GameObject.Instantiate(_main.MapRenderer.ROUnitMap[UIBottomInfoStatusObjectId].GetROUnit() as GameObject);
|
||||
clone.transform.SetParent(_unitPreviewArea.transform);
|
||||
clone.transform.localPosition = new Vector3(0,5,0);
|
||||
clone.transform.localScale = new Vector3(4,4,4);
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user