增加一些代码容错
This commit is contained in:
parent
ec5ada0e03
commit
3b31711d3d
@ -145,6 +145,16 @@ public class GridAndResourceDataAssets : ScriptableObject
|
||||
{
|
||||
if (!t.HasLevel || gridData == null) return t.Sprite;
|
||||
//如果是拥有level的建筑,还要根据level返回
|
||||
if (t.LevelSprite.Count == 0)
|
||||
{
|
||||
LogSystem.LogError($"LevelSprite Count is 0 {gridData.Resource} : {gridData.buildingLevel}");
|
||||
return null;
|
||||
}
|
||||
if (gridData.buildingLevel < 0)
|
||||
{
|
||||
LogSystem.LogError($"building Level < 0 {gridData.Resource} : {gridData.buildingLevel}");
|
||||
return null;
|
||||
}
|
||||
if (gridData.buildingLevel >= t.LevelSprite.Count)
|
||||
{
|
||||
LogSystem.LogError($"gridData BuildingLevel Overflow {gridData.Resource} : {gridData.buildingLevel}");
|
||||
@ -152,7 +162,6 @@ public class GridAndResourceDataAssets : ScriptableObject
|
||||
}
|
||||
return t.LevelSprite[gridData.buildingLevel];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return resourceInfo.Sprite;
|
||||
|
||||
@ -393,6 +393,7 @@ public class Table
|
||||
public string[] unitInfo(UnitData u, GiantType g = GiantType.None)//返回tile的名称,用于bottomInfoUI
|
||||
{
|
||||
string[] ret = new string[3];
|
||||
if (u == null) return ret;
|
||||
ret[0] = u.UnitType switch
|
||||
{
|
||||
UnitType.Warrior => "步兵",
|
||||
|
||||
@ -5,6 +5,7 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
using RuntimeData;
|
||||
using Logic;
|
||||
using Logic.CrashSight;
|
||||
using Logic.Event;
|
||||
using TH1Resource;
|
||||
using UnityEngine.UI;
|
||||
@ -791,6 +792,11 @@ namespace TH1Renderer
|
||||
// 应用动画速度调整
|
||||
moveTime /= DebugCenter.Instance.AnimationSpeed;
|
||||
|
||||
if(!_temporaryExplorer)
|
||||
{
|
||||
LogSystem.LogError($"_temporaryExplorer is null, cannot move explorer.");
|
||||
return;
|
||||
}
|
||||
// 设置移动参数
|
||||
Vector3 targetWorldPos = Table.Instance.GridToWorld(targetGridData, "isUnit");
|
||||
_explorerMoveStartPos = _temporaryExplorer.transform.position;
|
||||
|
||||
@ -81,11 +81,10 @@ namespace TH1Renderer
|
||||
//如果不在视野,不处理
|
||||
mapData.GridMap.GetGridDataByVector3Pos(startPos, out var g1);
|
||||
mapData.GridMap.GetGridDataByVector3Pos(endPos,out var g2);
|
||||
if (g1 == null || g2 == null) return;
|
||||
if (!mapData.PlayerMap.SelfPlayerData.Sight.CheckIsInSight(g1.Id)
|
||||
&& mapData.PlayerMap.SelfPlayerData.Sight.CheckIsInSight(g2.Id))
|
||||
return;
|
||||
|
||||
|
||||
&& mapData.PlayerMap.SelfPlayerData.Sight.CheckIsInSight(g2.Id)) return;
|
||||
|
||||
//先创建新的projectileData数据
|
||||
var t = new ProjectileData(mapData, IdCalculater++, projectileType, moveType, startPos, endPos);
|
||||
ProjectileDataDict[t.Id] = t;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user