Merge branch 'main' of http://10.27.16.144:3000/kawagiri/TH1 into main
This commit is contained in:
commit
7a316ec5d5
@ -728,7 +728,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 3
|
||||
Cost: 5
|
||||
Skills: 0b0000000d000000
|
||||
Skills: 0b0000000d00000002000000
|
||||
Sprite: {fileID: 0}
|
||||
SpriteGlow: {fileID: 0}
|
||||
IsSpriteVarient: 1
|
||||
@ -986,7 +986,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 0200000027000000030000000f00000006000000210000001d000000
|
||||
Skills: 0200000027000000030000000f000000060000001d0000000d000000
|
||||
Sprite: {fileID: 21300000, guid: f4a89946e6d83f5498b8da8784d65ac4, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: c7229ac6b9cbb3c48a0bf40d37f8d3b6, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1004,7 +1004,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 0800000023000000240000002b000000
|
||||
Skills: 0800000023000000240000002b0000000d00000020000000
|
||||
Sprite: {fileID: 21300000, guid: a5f0d65989fcf8140b7434d09144f244, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 60e49b250aebf3e40aaa1aedaf039ad6, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1022,7 +1022,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 25000000260000002c000000
|
||||
Skills: 250000002600000004000000200000000d000000
|
||||
Sprite: {fileID: 21300000, guid: 869a247f7a81bff4c872f47d8e8e9cfe, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: a03eb25b8ec6903448d09ffef670f2bd, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1040,7 +1040,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 020000001300000028000000
|
||||
Skills: 020000001300000028000000200000000d000000
|
||||
Sprite: {fileID: 21300000, guid: 82b5cf2ca68e54d4ba986589c3e86efd, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 1cc0759060f203c46866a3678781e048, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1058,7 +1058,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 1c0000001b00000022000000290000002a00000001000000
|
||||
Skills: 290000002a000000010000000d00000020000000
|
||||
Sprite: {fileID: 21300000, guid: bd7e07fc549ba8a46a4eb79a62f9090b, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 5724de750e51c6a49a6b57d60106275e, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf7dfed55cbe75243aff0dee4812c85c
|
||||
guid: a8d61ad0be50b8b469541eb48895272c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a0dff83f17ad81469aa469004cfa83c
|
||||
guid: 90d8fb3a303ba004b8d8339ee1e93ba7
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12d8e47ec7404af43b19834aa127b7b2
|
||||
guid: 2fae7fe999ce6a04b921334ac7b1e7e7
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -12,10 +12,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 166f55de27df0d64e9e1565037a54aaa, type: 3}
|
||||
m_Name: AnimDataAssets
|
||||
m_EditorClassIdentifier:
|
||||
AttackAnimTime: 0.15
|
||||
AttackReturnAnimTime: 0.15
|
||||
CounterAnimTime: 0.15
|
||||
CounterReturnAnimTime: 0.15
|
||||
AttackAnimTime: 0.1
|
||||
AttackReturnAnimTime: 0.1
|
||||
CounterAnimTime: 0.1
|
||||
CounterReturnAnimTime: 0.1
|
||||
BetweenAttackCounterAnimTime: 0.1
|
||||
MoveAnimTime: 0.15
|
||||
ExplorerMoveDelay: 0.15
|
||||
MoveAnimTime: 0.1
|
||||
ExplorerMoveDelay: 0.1
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13683b9f1b2efd848ba7ecdfa209fd6d
|
||||
guid: 3a02fc78f9cd60d498d19b2af06a2f37
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 497090bd6620c394894a8911f6f19c70
|
||||
guid: de67e93f652ba67419231ebe8d2825bc
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e84da048c6db7348bf5068b825e89b5
|
||||
guid: ff685314a1ddbcb409a28e4e39cf5bb6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dad34d5a36e15dd4dbd8399922912471
|
||||
guid: 984a32b25ebb0814baba629ae7714f5d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88216af47aef11a43bfcfbfc7fc33c42
|
||||
guid: 2a6e137456d781949807bffba2c2d8a6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 503c99d10b6636947b01180699e6bfa8
|
||||
guid: 2b01e22f0124c364d847855ae7132f08
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -728,7 +728,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 3
|
||||
Cost: 5
|
||||
Skills: 0b0000000d000000
|
||||
Skills: 0b0000000d00000002000000
|
||||
Sprite: {fileID: 0}
|
||||
SpriteGlow: {fileID: 0}
|
||||
IsSpriteVarient: 1
|
||||
@ -986,7 +986,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 0200000027000000030000000f00000006000000210000001d000000
|
||||
Skills: 0200000027000000030000000f000000060000001d0000000d000000
|
||||
Sprite: {fileID: 21300000, guid: f4a89946e6d83f5498b8da8784d65ac4, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: c7229ac6b9cbb3c48a0bf40d37f8d3b6, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1004,7 +1004,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 0800000023000000240000002b000000
|
||||
Skills: 0800000023000000240000002b0000000d00000020000000
|
||||
Sprite: {fileID: 21300000, guid: a5f0d65989fcf8140b7434d09144f244, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 60e49b250aebf3e40aaa1aedaf039ad6, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1022,7 +1022,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 25000000260000002c000000
|
||||
Skills: 250000002600000004000000200000000d000000
|
||||
Sprite: {fileID: 21300000, guid: 869a247f7a81bff4c872f47d8e8e9cfe, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: a03eb25b8ec6903448d09ffef670f2bd, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1040,7 +1040,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 020000001300000028000000
|
||||
Skills: 020000001300000028000000200000000d000000
|
||||
Sprite: {fileID: 21300000, guid: 82b5cf2ca68e54d4ba986589c3e86efd, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 1cc0759060f203c46866a3678781e048, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1058,7 +1058,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 1c0000001b00000022000000290000002a00000001000000
|
||||
Skills: 290000002a000000010000000d00000020000000
|
||||
Sprite: {fileID: 21300000, guid: bd7e07fc549ba8a46a4eb79a62f9090b, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 5724de750e51c6a49a6b57d60106275e, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ca9e5183d1f52b478d9f9cbe1b5b894
|
||||
guid: d16887070e445b34eb307304ad5c0f27
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,9 @@ namespace RuntimeData
|
||||
// 唯一 ID
|
||||
public uint Id;
|
||||
|
||||
|
||||
|
||||
|
||||
// 技能信息
|
||||
public List<SkillBase> Skills = new List<SkillBase>();
|
||||
private Dictionary<SkillType, SkillBase> _skillDict;
|
||||
|
||||
@ -405,8 +405,25 @@ namespace RuntimeData
|
||||
return criticalHitRate;
|
||||
}
|
||||
|
||||
|
||||
// 是否能移动到伟人身周
|
||||
public bool IsCanMoveGiantNearbyGrid(MapData map)
|
||||
{
|
||||
foreach (var skill in Skills)
|
||||
{
|
||||
if (skill.IsCanMoveGiantNearbyGrid(this, map)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 是否拥有特别伤害技能,例如ROYALFLAME
|
||||
public bool IsHasAttackSkill(MapData map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 是否能移动无人城市
|
||||
public bool CanMoveNoUnitCity(MapData map)
|
||||
public bool IsCanMoveNoUnitSelfCity(MapData map)
|
||||
{
|
||||
foreach (var skill in Skills)
|
||||
{
|
||||
|
||||
@ -16,8 +16,8 @@ public class ActionDataAssets : ScriptableObject
|
||||
foreach(var t in ActionList)
|
||||
if (actionId == t.ActionId)
|
||||
{
|
||||
Debug.Log(t.ActionName);
|
||||
Debug.Log(t.CityExp);
|
||||
//Debug.Log(t.ActionName);
|
||||
//Debug.Log(t.CityExp);
|
||||
actionInfo = t;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class DebugCenter
|
||||
public float DebugLandThreshold = -1f;
|
||||
public float DebugAIActionTime = 0.3f;
|
||||
public float AnimationSpeed = 1f;
|
||||
public bool DebugShowAIID = false;
|
||||
public bool DebugMode = false;
|
||||
public DebugCenter()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
@ -18,7 +18,7 @@ public enum LandType { None,LandAndPort,WaterAndAshore,LandOnly,WaterOnly,LandAn
|
||||
|
||||
public enum MoveAttackType { None,Move,Attack,MoveToPort,MoveAshore}
|
||||
|
||||
public enum UnitActionType { None,Upgrade,Recover,Heal,Examine,Gather,Capture,Disband}
|
||||
public enum UnitActionType { None,Upgrade,Recover,Heal,Examine,Gather,Capture,Disband,ROYALFLAMES}
|
||||
|
||||
public enum CityLevelUpActionType{None,Explorer,Workshop,CityWall,CityWealth,Expand,Population,Park,BigGuy}
|
||||
|
||||
|
||||
@ -402,7 +402,7 @@ namespace Logic.AI
|
||||
foreach (var grid in mapData.GridMap.GridList)
|
||||
{
|
||||
if (playerData.Sight.CheckIsInSight(grid.Id)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanMoveToGrid(mapData, playerData, grid)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanStandOnGrid(mapData, playerData, unit, grid)) continue;
|
||||
var distance = Mathf.Abs(unitGrid.Pos.X - grid.Pos.X) + Mathf.Abs(unitGrid.Pos.Y - grid.Pos.Y);
|
||||
if (targetGrid == null)
|
||||
{
|
||||
@ -544,7 +544,7 @@ namespace Logic.AI
|
||||
foreach (var gridId in playerData.Sight.SightGidSet)
|
||||
{
|
||||
if (!mapData.GridMap.GetGridDataByGid(gridId, out var gridData)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanMoveToGrid(mapData, playerData, gridData)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanStandOnGrid(mapData, playerData, null,gridData)) continue;
|
||||
score += 1f;
|
||||
_canMoveGrid.Add(gridData);
|
||||
}
|
||||
|
||||
@ -483,10 +483,7 @@ namespace Logic.Action
|
||||
|
||||
if (map.GetGridDataByUnitId(unit.Id, out var unitGrid))
|
||||
{
|
||||
Debug.Log($"生成Action 小兵攻击 {unit.Id}, 攻击范围{unit.GetAttackRange()}" +
|
||||
$"位置{unitGrid.Pos.X}, {unitGrid.Pos.Y}, " +
|
||||
$"目标 {targetUnit.Id}, " +
|
||||
$"目标位置{grid.Pos.X}, {grid.Pos.Y}");
|
||||
//Debug.Log($"生成Action 小兵攻击 {unit.Id}, 攻击范围{unit.GetAttackRange()}" +$"位置{unitGrid.Pos.X}, {unitGrid.Pos.Y}, " + $"目标 {targetUnit.Id}, " + $"目标位置{grid.Pos.X}, {grid.Pos.Y}");
|
||||
}
|
||||
|
||||
continue;
|
||||
@ -577,6 +574,7 @@ namespace Logic.Action
|
||||
return false;
|
||||
var player = actionParams.PlayerData;
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData,city,wonderInfo.Exp);
|
||||
actionParams.GridData.ResourceUnderBuilding = actionParams.GridData.Resource;
|
||||
actionParams.GridData.Resource = ResourceType.Wonder;
|
||||
actionParams.GridData.Wonder = wonderInfo.Wonder;
|
||||
player.Wonder.SetWonderState(wonderInfo.WonderType,WonderState.FINISH_BUILD);
|
||||
@ -720,10 +718,21 @@ namespace Logic.Action
|
||||
needUpdate = ResourceType.Forge;
|
||||
if(_actionId.ResourceType == ResourceType.LumberHut)
|
||||
needUpdate = ResourceType.Sawmill;
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
//更新对应的milllike建筑的buildinglevel
|
||||
var gridDataList1 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
actionParams.GridData, needUpdate);
|
||||
foreach(var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData);
|
||||
foreach (var gridData1 in gridDataList1)
|
||||
{
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData1);
|
||||
//找到该milllike建筑附近的market,更新该market
|
||||
var gridDataList2 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
gridData1, ResourceType.Market);
|
||||
foreach(var gridData2 in gridDataList2)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData2);
|
||||
}
|
||||
|
||||
//更新所有market建筑的buildinglevel
|
||||
|
||||
|
||||
}
|
||||
//处理windmill sawmill forge market
|
||||
@ -734,8 +743,19 @@ namespace Logic.Action
|
||||
actionParams.GridData.RenderMark = true;
|
||||
Main.CityLogic.CalcGridBuildingLevel(actionParams.MapData,actionParams.GridData, _actionId.ResourceType,out var buildingLevel);
|
||||
actionParams.GridData.buildingLevel = buildingLevel;
|
||||
if(_actionId.ResourceType != ResourceType.Market )
|
||||
|
||||
//如果建设的不是market,而是sawmill forge windmill
|
||||
if (_actionId.ResourceType != ResourceType.Market)
|
||||
{
|
||||
//提供城市经验
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData,cityData,buildingLevel * (_actionId.ResourceType == ResourceType.Forge? 2 : 1));
|
||||
//更新附近的market
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
actionParams.GridData, ResourceType.Market);
|
||||
foreach(var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1105,6 +1125,7 @@ namespace Logic.Action
|
||||
return false;
|
||||
if (_actionId.UnitType == UnitType.None)
|
||||
return false;
|
||||
actionParams.PlayerData.PlayerWealth -= GetCost();
|
||||
actionParams.MapData.AddUnitData(gridData.Id,actionParams.CityData.Id,_actionId.UnitType,_actionId.GiantType);
|
||||
actionParams.CityData.CityInfoRenderMark = true;
|
||||
return true;
|
||||
@ -1147,10 +1168,28 @@ namespace Logic.Action
|
||||
//判断钱够不够
|
||||
if (GetCost() > actionParam.PlayerData.PlayerWealth)
|
||||
return false;
|
||||
//如果单位具有unique属性,且player已经拥有一个 TODO 需要Unique重写
|
||||
if (_actionId.GiantType != GiantType.None &&
|
||||
Main.PlayerLogic.GetPlayerUnitTypeCount(actionParam.MapData,actionParam.PlayerData,_actionId.UnitType, _actionId.GiantType) > 0)
|
||||
return false;
|
||||
//如果是伟人,要检查unique属性
|
||||
if (_actionId.UnitType == UnitType.Giant)
|
||||
{
|
||||
//获取unitTypeInfo
|
||||
if(!Table.Instance.UnitTypeDataAssets.GetUnitTypeInfo(_actionId.UnitType, _actionId.GiantType,
|
||||
out var unitTypeInfo))
|
||||
return false;
|
||||
//如果有Unique且全场已经有1个了
|
||||
if (unitTypeInfo.Skills.Contains(SkillType.UNIQUE))
|
||||
{
|
||||
if (Main.PlayerLogic.GetMapUnitTypeCount(actionParam.MapData, _actionId.UnitType, _actionId.GiantType) > 0)
|
||||
return false;
|
||||
}
|
||||
//如果有QUARTER且全场已经有4个了
|
||||
if (unitTypeInfo.Skills.Contains(SkillType.QUARTER))
|
||||
{
|
||||
if(Main.PlayerLogic.GetMapUnitTypeCount(actionParam.MapData,_actionId.UnitType, _actionId.GiantType) > 3)
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public override bool CheckShow(CommonActionParams actionParam)
|
||||
@ -1183,7 +1222,32 @@ namespace Logic.Action
|
||||
//如果城市上面有单位,不能生产,不显示
|
||||
if (actionParam.MapData.GetUnitDataByGid(gridData.Id, out var unitData))
|
||||
return false;
|
||||
//如果是伟人,处理UNIQUE和QUARTER的情况
|
||||
if (_actionId.UnitType == UnitType.Giant)
|
||||
{
|
||||
|
||||
//获取unitTypeInfo
|
||||
if(!Table.Instance.UnitTypeDataAssets.GetUnitTypeInfo(_actionId.UnitType, _actionId.GiantType,
|
||||
out var unitTypeInfo))
|
||||
return false;
|
||||
//如果有Unique且全场已经有1个了
|
||||
if (unitTypeInfo.Skills.Contains(SkillType.UNIQUE))
|
||||
{
|
||||
if (Main.PlayerLogic.GetMapUnitTypeCount(actionParam.MapData, _actionId.UnitType, _actionId.GiantType) > 0)
|
||||
return false;
|
||||
}
|
||||
//如果有QUARTER且全场已经有4个了
|
||||
if (unitTypeInfo.Skills.Contains(SkillType.QUARTER))
|
||||
{
|
||||
if(Main.PlayerLogic.GetMapUnitTypeCount(actionParam.MapData,_actionId.UnitType, _actionId.GiantType) > 3)
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1319,10 +1383,10 @@ namespace Logic.Action
|
||||
if (_actionId.UnitActionType == UnitActionType.Examine)
|
||||
{
|
||||
gridData.Resource = ResourceType.None;
|
||||
gridData.RenderMark = true;
|
||||
if (UnityEngine.Random.Range(0, 100) < 3)
|
||||
{
|
||||
actionParams.PlayerData.PlayerWealth += 10;
|
||||
gridData.RenderMark = true;
|
||||
}
|
||||
//给一个随机科技
|
||||
else if (UnityEngine.Random.Range(0, 100) < 3)
|
||||
@ -1340,7 +1404,6 @@ namespace Logic.Action
|
||||
{
|
||||
Main.PlayerLogic.ResearchTech(actionParams.MapData,actionParams.PlayerData,tt[UnityEngine.Random.Range(0, tt.Count)],0);
|
||||
}
|
||||
gridData.RenderMark = true;
|
||||
}
|
||||
//给一个单位
|
||||
else
|
||||
@ -1481,6 +1544,12 @@ namespace Logic.Action
|
||||
if (_actionId.UnitActionType == UnitActionType.Examine)
|
||||
return gridData.Resource == ResourceType.Treasure;
|
||||
|
||||
//处理战技ROYALFLAMES TODO 未实现
|
||||
if (_actionId.UnitActionType == UnitActionType.ROYALFLAMES)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public override bool CheckShow(CommonActionParams actionParams)
|
||||
@ -1732,13 +1801,14 @@ namespace Logic.Action
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Execute(CommonActionParams actionParams)
|
||||
{
|
||||
if (actionParams.PlayerData == null || actionParams.GridData == null)
|
||||
return false;
|
||||
if (!Table.Instance.ActionDataAssets.GetActionInfo(_actionId, out var actionInfo))
|
||||
return false;
|
||||
|
||||
|
||||
//处理grow forest
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.GrowForest)
|
||||
{
|
||||
@ -1751,6 +1821,7 @@ namespace Logic.Action
|
||||
unit.RenderMark = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//处理clear forest
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.ClearForest)
|
||||
{
|
||||
@ -1763,8 +1834,9 @@ namespace Logic.Action
|
||||
unit.RenderMark = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//处理 burn forest
|
||||
if(_actionId.GridMiscActionType == GridMiscActionType.BurnForest )
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.BurnForest)
|
||||
{
|
||||
actionParams.PlayerData.PlayerWealth -= actionInfo.Cost;
|
||||
actionParams.GridData.Vegetation = Vegetation.None;
|
||||
@ -1772,52 +1844,79 @@ namespace Logic.Action
|
||||
actionParams.GridData.RenderMark = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//处理Destroy
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.Destroy)
|
||||
{
|
||||
if(!Table.Instance.GridAndResourceDataAssets.GetResourceInfo(actionParams.GridData.Resource,out var resourceInfo))
|
||||
Debug.Log($"执行拆除!目标是{actionParams.GridData.Resource}");
|
||||
if (!Table.Instance.GridAndResourceDataAssets.GetResourceInfo(actionParams.GridData.Resource,
|
||||
out var resourceInfo))
|
||||
return false;
|
||||
//如果destroy的位置是无主地块
|
||||
if (!actionParams.MapData.GetCityDataByTerritoryGid(actionParams.GridData.Id, out var cityData))
|
||||
return false;
|
||||
if (_actionId.ResourceType == ResourceType.Farm || _actionId.ResourceType == ResourceType.Mine ||
|
||||
_actionId.ResourceType == ResourceType.LumberHut)
|
||||
if (actionParams.GridData.Resource == ResourceType.Farm ||
|
||||
actionParams.GridData.Resource == ResourceType.Mine ||
|
||||
actionParams.GridData.Resource == ResourceType.LumberHut)
|
||||
{
|
||||
//在已经拆除前,记录下来周围的什么样的milllike建筑要被同时更新
|
||||
ResourceType needUpdate =
|
||||
Table.Instance.GridAndResourceDataAssets.GetMillLikeRelative(actionParams.GridData.Resource);
|
||||
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData, -resourceInfo.Exp);
|
||||
actionParams.GridData.Resource = actionParams.GridData.ResourceUnderBuilding;
|
||||
actionParams.GridData.ResourceUnderBuilding = ResourceType.None;
|
||||
|
||||
//更新周围的milllike建筑
|
||||
ResourceType needUpdate = Table.Instance.GridAndResourceDataAssets.GetMillLikeRelative(_actionId.ResourceType);
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
var gridDataList1 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData,
|
||||
actionParams.GridData, needUpdate);
|
||||
|
||||
Debug.Log($"执行拆除!目标影响到了周围的{needUpdate},数量有是{gridDataList1.Count}");
|
||||
foreach (var gridData1 in gridDataList1)
|
||||
{
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData1);
|
||||
//还要额外连带影响附近的market
|
||||
var gridDataList2 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData, gridData1, ResourceType.Market);
|
||||
foreach (var gridData2 in gridDataList2)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//处理windmill sawmill forge
|
||||
else if (actionParams.GridData.Resource == ResourceType.Windmill ||
|
||||
actionParams.GridData.Resource == ResourceType.Forge ||
|
||||
actionParams.GridData.Resource == ResourceType.Sawmill)
|
||||
{
|
||||
//对应城市先丢失exp
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData,
|
||||
-actionParams.GridData.buildingLevel * (actionParams.GridData.Resource == ResourceType.Forge ? 2 : 1));
|
||||
|
||||
//删除格子的内容
|
||||
actionParams.GridData.Resource = actionParams.GridData.ResourceUnderBuilding;
|
||||
actionParams.GridData.ResourceUnderBuilding = ResourceType.None;
|
||||
actionParams.GridData.buildingLevel = 0;
|
||||
//更新周围的market情况
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData,
|
||||
actionParams.GridData, ResourceType.Market);
|
||||
Debug.Log($"这次拆除后,周围的market找到了{gridDataList.Count()}个");
|
||||
foreach (var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData);
|
||||
}
|
||||
//处理windmill sawmill forge market
|
||||
else if (_actionId.ResourceType == ResourceType.Windmill ||
|
||||
_actionId.ResourceType == ResourceType.Forge ||
|
||||
_actionId.ResourceType == ResourceType.Sawmill ||
|
||||
_actionId.ResourceType == ResourceType.Market)
|
||||
//处理market
|
||||
else if (actionParams.GridData.Resource == ResourceType.Market)
|
||||
{
|
||||
if (_actionId.ResourceType != ResourceType.Market)
|
||||
{
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData, -actionParams.GridData.buildingLevel);
|
||||
//更新周围的market情况
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData,
|
||||
actionParams.GridData, ResourceType.Market);
|
||||
foreach (var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData);
|
||||
}
|
||||
actionParams.GridData.Resource = actionParams.GridData.ResourceUnderBuilding;
|
||||
actionParams.GridData.ResourceUnderBuilding = ResourceType.None;
|
||||
actionParams.GridData.buildingLevel = 0;
|
||||
}
|
||||
//处理港口和桥梁
|
||||
else if(_actionId.ResourceType == ResourceType.Port ||
|
||||
_actionId.ResourceType == ResourceType.Bridge)
|
||||
else if(actionParams.GridData.Resource == ResourceType.Port ||
|
||||
actionParams.GridData.Resource == ResourceType.Bridge)
|
||||
{
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData, -resourceInfo.Exp);
|
||||
Main.PlayerLogic.UpdateCityConnect(actionParams.MapData,actionParams.PlayerData);
|
||||
@ -1873,6 +1972,8 @@ namespace Logic.Action
|
||||
&& actionParams.GridData.Resource != ResourceType.Crop
|
||||
&& actionParams.GridData.Resource != ResourceType.Fruit))
|
||||
return false;
|
||||
if (actionParams.GridData.Feature == TerrainFeature.Mountain)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
//处理clear forest 和 burn forest
|
||||
@ -1901,7 +2002,9 @@ namespace Logic.Action
|
||||
|| actionParams.GridData.Resource == ResourceType.Farm
|
||||
|| actionParams.GridData.Resource == ResourceType.Mine
|
||||
|| actionParams.GridData.Resource == ResourceType.Port
|
||||
|| actionParams.GridData.Resource == ResourceType.Bridge)
|
||||
|| actionParams.GridData.Resource == ResourceType.Bridge
|
||||
|| actionParams.GridData.Resource == ResourceType.Market
|
||||
|| actionParams.GridData.Resource == ResourceType.Wonder)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -115,14 +115,19 @@ namespace Logic
|
||||
return null;
|
||||
}
|
||||
|
||||
//更新grid的buildinglevel,并且顺带会更新城市的exp
|
||||
public void UpdateGridBuildingData(MapData mapData, GridData gridData)
|
||||
{
|
||||
CalcGridBuildingLevel(mapData, gridData, gridData.Resource, out var level);
|
||||
int delta = level - gridData.buildingLevel;
|
||||
if (gridData.Resource == ResourceType.Forge)
|
||||
delta *= 2;
|
||||
if (gridData.Resource == ResourceType.Market)
|
||||
delta = 0;
|
||||
gridData.buildingLevel = level;
|
||||
gridData.RenderMark = true;
|
||||
mapData.GetCityDataByTerritoryGid(gridData.Id,out var cityData);
|
||||
CityUpdateExp(mapData,cityData,delta);
|
||||
if(mapData.GetCityDataByTerritoryGid(gridData.Id,out var cityData))
|
||||
CityUpdateExp(mapData,cityData,delta);
|
||||
}
|
||||
|
||||
//获得一个city当前的回合钱
|
||||
@ -214,8 +219,10 @@ namespace Logic
|
||||
level += grid.buildingLevel;
|
||||
ret = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (level > 8)
|
||||
level = 8;
|
||||
|
||||
}
|
||||
//处理windmill forge话sawmill的情况
|
||||
if ((grid.Resource == ResourceType.Farm && buildingType == ResourceType.Windmill)
|
||||
|
||||
@ -94,6 +94,19 @@ namespace Logic
|
||||
mouseLastDownPosition = Input.mousePosition;
|
||||
}
|
||||
|
||||
// 检测数字键1-5的按下,执行对应的操作
|
||||
if (_main.UIManager.BottomInfoUI.ROBottomInfoUI.activeSelf)
|
||||
{
|
||||
for (int i = 1; i <= 9; i++)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1 + i - 1))
|
||||
{
|
||||
_main.UIManager.BottomInfoUI.ExecuteActionButtonByIndex(i - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(0)) // 检测鼠标点击
|
||||
{
|
||||
if (EventSystem.current.IsPointerOverGameObject())
|
||||
@ -144,7 +157,7 @@ namespace Logic
|
||||
_main.MapData.PlayerMap.SelfPlayerData.PlayerWealth += 1000;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha3))
|
||||
if (Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
|
||||
{
|
||||
@ -168,8 +181,14 @@ namespace Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Alpha3)
|
||||
|| Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Alpha5))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha5))
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
|
||||
{
|
||||
|
||||
@ -27,7 +27,7 @@ namespace Logic
|
||||
public bool AIMoreMoney = true;
|
||||
public float LandThreshold = -1f;
|
||||
public float AnimationSpeed = 1f;
|
||||
public bool DebugShowAIID = false;
|
||||
public bool DebugMode = false;
|
||||
|
||||
[Header("Play Settings")]
|
||||
public int cityCount;
|
||||
@ -76,7 +76,7 @@ namespace Logic
|
||||
DebugCenter.Instance.DebugAIMoreMoney = AIMoreMoney;
|
||||
DebugCenter.Instance.DebugAIActionTime = AIActionTime;
|
||||
DebugCenter.Instance.AnimationSpeed = AnimationSpeed;
|
||||
DebugCenter.Instance.DebugShowAIID = DebugShowAIID;
|
||||
DebugCenter.Instance.DebugMode = DebugMode;
|
||||
if(LandThreshold > 0)
|
||||
DebugCenter.Instance.DebugLandThreshold = LandThreshold;
|
||||
|
||||
|
||||
@ -283,27 +283,34 @@ namespace Logic
|
||||
|
||||
}
|
||||
|
||||
public int GetPlayerUnitTypeCount(MapData mapData, PlayerData player, UnitType unitType, GiantType giantType)
|
||||
public int GetMapUnitTypeCount(MapData mapData, UnitType unitType, GiantType giantType)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
foreach (var unit in mapData.UnitMap.UnitList)
|
||||
if (mapData.GetPlayerDataByUnitId(unit.Id, out var playerData1) && playerData1 == player
|
||||
&& ((unit.UnitType == unitType && unit.GiantType == giantType)
|
||||
||(unit.CarryUnitType == unitType && unit.CarryGiantType == giantType))
|
||||
)
|
||||
{
|
||||
if ((unit.UnitType == unitType && unit.GiantType == giantType)
|
||||
|| (unit.CarryUnitType == unitType && unit.CarryGiantType == giantType))
|
||||
ret++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 获取玩家在某个格子周围 1 单位的拥有某个资源的的全列表,
|
||||
// 获取玩家在某个格子周围 1 单位的拥有某个资源且属于该玩家领土的grid的全列表
|
||||
public List<GridData> GetPlayerResourceNearbyList(MapData mapData, PlayerData playerData, GridData gridData, ResourceType resourceType)
|
||||
{
|
||||
var aroundGridList = new List<GridData>();
|
||||
var aroundGrid = mapData.GridMap.GetAroundGridDataSet(1, 1, gridData);
|
||||
var territoryGidSet = mapData.GetPlayerTerritoryGridIdSet(playerData.Id);
|
||||
|
||||
//var territoryGidSet = mapData.GetPlayerTerritoryGridIdSet(playerData.Id);
|
||||
foreach (var grid in aroundGrid)
|
||||
{
|
||||
if (!territoryGidSet.Contains(grid.Id)) continue;
|
||||
//如果不是玩家的领土
|
||||
if(mapData.GetPlayerDataByTerritoryGridId(grid.Id, out var player)
|
||||
&& player.Id != playerData.Id)
|
||||
continue;
|
||||
|
||||
if (grid.Resource != resourceType) continue;
|
||||
aroundGridList.Add(grid);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
using RuntimeData;
|
||||
|
||||
|
||||
namespace Logic.Skill
|
||||
@ -24,7 +25,11 @@ namespace Logic.Skill
|
||||
{
|
||||
return SkillType.ALLYTRANSPORT;
|
||||
}
|
||||
|
||||
|
||||
public override bool IsCanMoveGiantNearbyGrid(UnitData unit,MapData map)
|
||||
{
|
||||
return unit.Skills.Contains(SkillFactory.GetSkillBySkillType(SkillType.ALLYTRANSPORT));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,9 @@ namespace Logic.Skill
|
||||
{
|
||||
if (!mapData.GetUnitDataByGid(grid.Id, out var unit)) continue;
|
||||
if (!selfUnitList.Contains(unit)) continue;
|
||||
unit.Health += 5;
|
||||
unit.Health += 2;
|
||||
if (unit.Health > unit.GetMaxHealth())
|
||||
unit.Health = unit.GetMaxHealth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,9 +27,9 @@ namespace Logic.Skill
|
||||
return SkillType.CITYTRANSPORT;
|
||||
}
|
||||
|
||||
public override void OnMove(UnitData self, GridData grid, MapData mapData,MoveType moveType)
|
||||
public override bool IsCanMoveToNoUnitSelfCity(UnitData self, MapData mapData)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,8 @@ namespace Logic.Skill
|
||||
public override void OnTurnStart(UnitData self, MapData mapData)
|
||||
{
|
||||
self.Health -= 2;
|
||||
if (self.Health < 1)
|
||||
self.Health = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,6 +90,8 @@ namespace Logic.Skill
|
||||
// 是否能移动到我方的无人城市
|
||||
public bool IsCanMoveToNoUnitSelfCity(UnitData self, MapData mapData);
|
||||
|
||||
public bool IsCanMoveGiantNearbyGrid(UnitData self, MapData mapData);
|
||||
|
||||
// 能否被杀死
|
||||
public bool IsCanBeKill(UnitData self, MapData mapData);
|
||||
|
||||
@ -329,6 +331,11 @@ namespace Logic.Skill
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool IsCanMoveGiantNearbyGrid(UnitData self, MapData mapData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool IsCanBeKill(UnitData self, MapData mapData)
|
||||
{
|
||||
return true;
|
||||
|
||||
@ -274,17 +274,27 @@ namespace Logic
|
||||
Debug.Log(t);
|
||||
}
|
||||
|
||||
// 判断我方单位是否可以移动到某个格子上, 不考虑视野信息
|
||||
public bool CheckUnitCanMoveToGrid(MapData map, PlayerData self, GridData grid)
|
||||
// 判断我方单位是否可以站在某个格子上, 不考虑视野信息,不考虑可达
|
||||
public bool CheckUnitCanStandOnGrid(MapData map, PlayerData self,UnitData unit ,GridData grid)
|
||||
{
|
||||
if (grid.Feature == TerrainFeature.Mountain && !self.TechTree.CheckIfHasTech(TechType.Climbing)) return false;
|
||||
if (grid.Terrain == TerrainType.ShallowSea && !self.TechTree.CheckIfHasTech(TechType.Fishing)) return false;
|
||||
if (grid.Terrain == TerrainType.DeepSea && !self.TechTree.CheckIfHasTech(TechType.Sailing)) return false;
|
||||
|
||||
|
||||
//如果unit不是null,那么就是判断具体的某个unit能否站在grid上
|
||||
if (unit != null)
|
||||
{
|
||||
if(!unit.IsCanMoveOnTerrain(map,grid.Terrain))return false;
|
||||
if (unit.IsCanMoveOnFeature(map, grid.Feature))return false;
|
||||
}
|
||||
//否则可能是判断一个玩家的任意unit能否站在上面
|
||||
else
|
||||
{
|
||||
if (grid.Feature == TerrainFeature.Mountain && !self.TechTree.CheckIfHasTech(TechType.Climbing)) return false;
|
||||
if (grid.Terrain == TerrainType.ShallowSea && !self.TechTree.CheckIfHasTech(TechType.Fishing)) return false;
|
||||
if (grid.Terrain == TerrainType.DeepSea && !self.TechTree.CheckIfHasTech(TechType.Sailing)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 判断我方单位是否可以移动到某个格子上, 不考虑视野信息
|
||||
// 仅从feature和terrain角度判断我方单位是否可以移动到某个格子上, 不考虑视野信息
|
||||
public bool CheckUnitCanMoveToGrid(MapData map, PlayerData self, Vector2Int start, Vector2Int end)
|
||||
{
|
||||
if (!map.GridMap.GetGridDataByPos(start.x, start.y, out var startGrid)) return false;
|
||||
@ -413,8 +423,29 @@ namespace Logic
|
||||
for (int i = 0; i < width; i++)
|
||||
for (int j = 0; j < height; j++)
|
||||
if(MoveInfoMap[i, j] >= 0 && Table.Instance.CalcDistance(new Vector2Int(gridData.Pos.X,gridData.Pos.Y),new Vector2Int(i,j)) > 5)
|
||||
Debug.Log("OWATAA!@!!!!!");
|
||||
//DebugOutputMoveInfo();
|
||||
Debug.Log("moveinfo计算时出现了超过5格的移动距离");
|
||||
|
||||
//处理ALLTRANSPORT技能,可以移动到己方伟人的身周
|
||||
if (unitData.IsCanMoveGiantNearbyGrid(mapData))
|
||||
{
|
||||
//遍历所有单位,找到己方的伟人
|
||||
foreach (var unitA in mapData.UnitMap.UnitList)
|
||||
if(unitA.UnitType == UnitType.Giant
|
||||
&& mapData.GetPlayerIdByUnitId(unitA.Id,out var pid)
|
||||
&& pid == playerData.Id)
|
||||
{
|
||||
mapData.GetGridDataByUnitId(unitA.Id, out var gridA);
|
||||
var nearby = mapData.GridMap.GetAroundGridDataSet(1,1,gridA);
|
||||
foreach (var gridDataA in nearby)
|
||||
//如果能够站在gridA上,并且格子上没人
|
||||
if(CheckUnitCanStandOnGrid(mapData,playerData,unitData,gridDataA)
|
||||
&& !mapData.GetUnitDataByGid(gridA.Id,out var tt))
|
||||
{
|
||||
int x = gridDataA.Pos.X, y = gridDataA.Pos.Y;
|
||||
MoveInfoMap[x, y] = 999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查单位是否能攻击目标点
|
||||
@ -524,7 +555,9 @@ namespace Logic
|
||||
public void LandToBoat(MapData mapData, UnitData unitData)
|
||||
{
|
||||
unitData.CarryUnitType = unitData.UnitType;
|
||||
unitData.CarryGiantType = unitData.GiantType;
|
||||
unitData.UnitType = UnitType.Boat;
|
||||
unitData.GiantType = GiantType.None;
|
||||
unitData.CarryExp = unitData.Exp;
|
||||
unitData.Exp = 0;
|
||||
unitData.CarryVeteran = unitData.Veteran;
|
||||
|
||||
@ -371,7 +371,7 @@ namespace Logic
|
||||
ResourceType.Sawmill => Resources.Load<Sprite>(
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Sawmill_{Mathf.Min(_gridData.buildingLevel, 8)}"),
|
||||
ResourceType.Market => Resources.Load<Sprite>(
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Market"),
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Market_{Mathf.Min(_gridData.buildingLevel, 8)}"),
|
||||
ResourceType.Wonder => Table.Instance.GridAndResourceDataAssets.GetWonderSprite(_gridData.Wonder,_playerData),
|
||||
ResourceType.Tower => Resources.Load<Sprite>(
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Tower"),
|
||||
|
||||
@ -39,14 +39,14 @@ namespace Logic
|
||||
SpriteEffectController effectController;
|
||||
|
||||
//------bounce相关参数--------
|
||||
bool needBounce = false, isBounceDown = true;
|
||||
bool _needBounce = false, _isBounceDown = true;
|
||||
Vector3 bounceUpPos, bounceDownPos;
|
||||
float bounceTime = 0f;
|
||||
float bounceDownFullTime = 0.07f;
|
||||
float bounceUpFullTime = 0.2f;
|
||||
|
||||
|
||||
bool needMove = false;
|
||||
bool _needMove = false;
|
||||
Vector3 moveStartPos, moveEndPos;
|
||||
float moveTime = 0f;
|
||||
float moveFullTime = 0.3f;
|
||||
@ -114,8 +114,8 @@ namespace Logic
|
||||
|
||||
public void PlayBounceAnim()
|
||||
{
|
||||
needBounce = true;
|
||||
isBounceDown = true;
|
||||
_needBounce = true;
|
||||
_isBounceDown = true;
|
||||
bounceTime = 0f;
|
||||
bounceUpPos = _ROUnit.transform.position;
|
||||
bounceDownPos = new Vector3(_ROUnit.transform.position.x, _ROUnit.transform.position.y - 0.8f, _ROUnit.transform.position.z);
|
||||
@ -125,7 +125,7 @@ namespace Logic
|
||||
{
|
||||
Debug.Log($"Unit {_unitId} PlayMoveAnim called: from {Table.Instance.WorldToGrid(_ROUnit.transform.position, "isUnit")} to {new Vector2Int((int)endGridData.Pos.X, (int)endGridData.Pos.Y)}, fullTime={fullTime}");
|
||||
|
||||
needMove = true;
|
||||
_needMove = true;
|
||||
moveFullTime = fullTime * DebugCenter.Instance.AnimationSpeed;
|
||||
moveEndPos = Table.Instance.GridToWorld(endGridData,"isUnit");
|
||||
moveStartPos = _ROUnit.transform.position;
|
||||
@ -159,7 +159,7 @@ namespace Logic
|
||||
public void Update()
|
||||
{
|
||||
//没有任何需要变化的情况,直接return
|
||||
if (!needBounce && !needMove && !_needAttack &&!_unitData.RenderMark && !_unitData.AttackRenderMark)
|
||||
if (!_needBounce && !_needMove && !_needAttack &&!_unitData.RenderMark && !_unitData.AttackRenderMark)
|
||||
return;
|
||||
GridData curGridData = _gridData;
|
||||
_mapData.UnitMap.GetUnitDataByUnitId(_unitId,out _unitData);
|
||||
@ -169,7 +169,7 @@ namespace Logic
|
||||
// 添加调试输出
|
||||
if (_gridData != curGridData)
|
||||
{
|
||||
Debug.Log($"Unit {_unitId} grid changed: {curGridData.Id}->{_gridData.Id}, needMove={needMove}, RenderMark={_unitData.RenderMark}");
|
||||
Debug.Log($"Unit {_unitId} grid changed: {curGridData.Id}->{_gridData.Id}, needMove={_needMove}, RenderMark={_unitData.RenderMark}");
|
||||
}
|
||||
|
||||
//处理attack bounce 和move 动画,三者冲突,必须用if else 独立处理
|
||||
@ -221,15 +221,15 @@ namespace Logic
|
||||
}
|
||||
|
||||
}
|
||||
else if (needBounce)
|
||||
else if (_needBounce)
|
||||
{
|
||||
if (isBounceDown)
|
||||
if (_isBounceDown)
|
||||
{
|
||||
bounceTime += Time.deltaTime / bounceDownFullTime;
|
||||
_ROUnit.transform.position = Vector3.Lerp(bounceUpPos, bounceDownPos, bounceTime);
|
||||
if (bounceTime >= 1f)
|
||||
{
|
||||
isBounceDown = false;
|
||||
_isBounceDown = false;
|
||||
bounceTime = 0f;
|
||||
}
|
||||
}
|
||||
@ -238,11 +238,11 @@ namespace Logic
|
||||
bounceTime += Time.deltaTime / bounceUpFullTime;
|
||||
_ROUnit.transform.position = Vector3.Lerp(bounceDownPos, bounceUpPos, bounceTime);
|
||||
if (bounceTime >= 1f)
|
||||
needBounce = false;
|
||||
_needBounce = false;
|
||||
|
||||
}
|
||||
}
|
||||
else if (needMove)
|
||||
else if (_needMove)
|
||||
{
|
||||
//Debug.Log($"Moving from {moveStartPos} to {moveEndPos}" );
|
||||
moveTime += Time.deltaTime / moveFullTime;
|
||||
@ -250,7 +250,7 @@ namespace Logic
|
||||
if (moveTime >= 1f)
|
||||
{
|
||||
Debug.Log($"Unit {_unitId} move completed. In sight: {_mapData.PlayerMap.SelfPlayerData.Sight.CheckIsInSight(_gridData.Id)}");
|
||||
needMove = false;
|
||||
_needMove = false;
|
||||
Vector2Int tt = Table.Instance.WorldToGrid(_ROUnit.transform.position, "isUnit");
|
||||
if (!_mapData.PlayerMap.SelfPlayerData.Sight.CheckIsInSight(_gridData.Id))
|
||||
_ROUnit.SetActive(false);
|
||||
@ -314,7 +314,7 @@ namespace Logic
|
||||
//初拉单位和selfplayer的视野关系
|
||||
RenderUpdateSelfPlayerSight();
|
||||
//DebugRender
|
||||
if (DebugCenter.Instance.DebugShowAIID)
|
||||
if (DebugCenter.Instance.DebugMode)
|
||||
RenderUpdateDebug();
|
||||
|
||||
|
||||
@ -451,7 +451,7 @@ namespace Logic
|
||||
}
|
||||
public void RenderUpdateSelfPlayerSight()
|
||||
{
|
||||
if (needMove)
|
||||
if (_needMove)
|
||||
return;
|
||||
if (!_mapData.PlayerMap.SelfPlayerData.Sight.CheckIsInSight(_gridData.Id))
|
||||
_ROUnit.SetActive(false); //如果不在玩家视野,就暂时隐藏这个单位的显示
|
||||
@ -533,6 +533,24 @@ namespace Logic
|
||||
|
||||
public void SetAttackAnim(AttackAnimType attackAnimType, Vector3 targetPos,bool needBack = true, float needWaitTime = 0f)
|
||||
{
|
||||
//如果有其他动画还没播放完,先复位
|
||||
if (_needAttack)
|
||||
{
|
||||
_ROUnit.transform.position = _attackBackPos;
|
||||
_needAttack = false;
|
||||
}
|
||||
|
||||
if (_needBounce)
|
||||
{
|
||||
_ROUnit.transform.position = bounceUpPos;
|
||||
_needBounce = false;
|
||||
}
|
||||
|
||||
if (_needMove)
|
||||
{
|
||||
_ROUnit.transform.position = moveEndPos;
|
||||
_needMove = false;
|
||||
}
|
||||
_needAttack = true;
|
||||
_attackAnimType = attackAnimType;
|
||||
_needBack = needBack;
|
||||
@ -562,9 +580,9 @@ namespace Logic
|
||||
|
||||
public void SetBounceAnim()
|
||||
{
|
||||
if (needBounce) return;
|
||||
needBounce = true;
|
||||
isBounceDown = true;
|
||||
if (_needBounce) return;
|
||||
_needBounce = true;
|
||||
_isBounceDown = true;
|
||||
bounceTime = 0f;
|
||||
bounceUpPos = _ROUnit.transform.position;
|
||||
bounceDownPos = new Vector3(_ROUnit.transform.position.x, _ROUnit.transform.position.y - 0.8f, _ROUnit.transform.position.z);
|
||||
|
||||
@ -22,7 +22,10 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_closeButton, // 收起按钮
|
||||
_previewArea, //grid/unit预览框
|
||||
_actionArea,
|
||||
_actionAreaScrollView;
|
||||
_actionAreaScrollView,
|
||||
_debugGrid,
|
||||
_debugUnit,
|
||||
_debugCity;
|
||||
public GameObject _hintWindow;//提示窗口
|
||||
|
||||
//public Tilemap borderTilemap;
|
||||
@ -66,9 +69,12 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_description = ROBottomInfoUI.transform.Find("Description").gameObject; // 描述
|
||||
_closeButton = ROBottomInfoUI.transform.Find("CloseButton").gameObject; // 收起按钮
|
||||
_actionAreaScrollView = ROBottomInfoUI.transform.Find("ActionAreaScrollView").gameObject;
|
||||
_actionArea = _actionAreaScrollView.transform.Find("Viewport").transform.Find("ActionArea").gameObject;
|
||||
_previewArea = ROBottomInfoUI.transform.Find("PreviewArea").transform.Find("Grid").gameObject;
|
||||
_actionArea = _actionAreaScrollView.transform.Find("Viewport/ActionArea").gameObject;
|
||||
_previewArea = ROBottomInfoUI.transform.Find("PreviewArea/Grid").gameObject;
|
||||
_hintWindow = ROBottomInfoUI.transform.Find("HintWindow").gameObject;
|
||||
_debugGrid = ROBottomInfoUI.transform.Find("DebugGrid").gameObject;
|
||||
_debugUnit = ROBottomInfoUI.transform.Find("DebugUnit").gameObject;
|
||||
_debugCity = ROBottomInfoUI.transform.Find("DebugCity").gameObject;
|
||||
ActionBGAvailable = Resources.Load<Sprite>("ArtResources/TH1UI/Common/bgAvailable");
|
||||
ActionBGExpensive = Resources.Load<Sprite>("ArtResources/TH1UI/Common/bgExpensive");
|
||||
ActionBGUnavailable = Resources.Load<Sprite>("ArtResources/TH1UI/Common/bgUnavailable");
|
||||
@ -110,6 +116,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
//如果需要先下滑再上滑
|
||||
if (UIBottomInfoHideFirst)
|
||||
{
|
||||
//设定播放下滑动画的初始参数
|
||||
if (ROBottomInfoUI.activeSelf)
|
||||
{
|
||||
_isAnimating = true;
|
||||
@ -120,6 +127,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
//设定播放上滑动画的初始参数
|
||||
_isAnimating = true;
|
||||
_isShow = true;
|
||||
_slideTime = 0f;
|
||||
@ -184,7 +192,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_closeButton.GetComponent<Button>().onClick.AddListener(SetBottomInfoHide);
|
||||
}
|
||||
|
||||
//RuntimeData.GridData gridData,UnitData unitData)//更新预览框的内容
|
||||
//更新预览框的内容
|
||||
public void UpdateInfo()
|
||||
{
|
||||
foreach (Transform child in _previewArea.transform)
|
||||
@ -253,9 +261,14 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_description.GetComponent<TextMeshProUGUI>().text = showText[1];
|
||||
}
|
||||
|
||||
//如果是DebugMode,更新Debug模块的显示
|
||||
if (DebugCenter.Instance.DebugMode)
|
||||
UpdateDebugInfo();
|
||||
|
||||
}
|
||||
|
||||
public void ActionAreaClickHandler()//让每个action挂一个点击监听事件
|
||||
//让每个action挂一个点击监听事件
|
||||
public void ActionAreaClickHandler()
|
||||
{
|
||||
ActionClickedEvent[] items = _actionArea.GetComponentsInChildren<ActionClickedEvent>(true);//这里设为true,会遍历所有inactive的对象
|
||||
|
||||
@ -265,6 +278,8 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//处理一个action被点击后的情况
|
||||
public void ActionAreaClicked(GameObject clickedItem)
|
||||
{
|
||||
CommonActionId fakeActionId = clickedItem.GetComponent<ActionIdMono>().ActionId;
|
||||
@ -360,6 +375,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//如果是单位
|
||||
else
|
||||
{
|
||||
foreach (Transform child in _actionArea.transform)
|
||||
@ -379,7 +395,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
textUIComponent.color = Color.white;
|
||||
backImage.sprite = ActionBGAvailable;
|
||||
|
||||
//如果是升级单位
|
||||
//如果是变形为其他type的单位
|
||||
if (tActionId.ResourceType !=ResourceType.None)
|
||||
{
|
||||
starImage.gameObject.SetActive(true);
|
||||
@ -419,4 +435,138 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
UIBottomInfoIsGrid = false;
|
||||
UIBottomInfoStatusObjectId = unitId;
|
||||
}
|
||||
}
|
||||
|
||||
//更新Debug模块的信息
|
||||
public void UpdateDebugInfo()
|
||||
{
|
||||
//如果是城市格子
|
||||
if (UIBottomInfoIsGrid && _mapData.GetCityDataByGid(UIBottomInfoStatusObjectId,out var city))
|
||||
{
|
||||
_debugGrid.SetActive(false);
|
||||
_debugUnit.SetActive(false);
|
||||
_debugCity.SetActive(true);
|
||||
|
||||
}
|
||||
//如果是非城市格子
|
||||
else if (UIBottomInfoIsGrid)
|
||||
{
|
||||
_debugGrid.SetActive(true);
|
||||
_debugUnit.SetActive(false);
|
||||
_debugCity.SetActive(false);
|
||||
_main.MapData.GridMap.GetGridDataByGid(UIBottomInfoStatusObjectId,out var gridData);
|
||||
_debugGrid.transform.Find("BuildingLevelValue").GetComponent<TextMeshProUGUI>().text = gridData.buildingLevel.ToString();
|
||||
|
||||
}
|
||||
//如果是unit
|
||||
else
|
||||
{
|
||||
_debugGrid.SetActive(false);
|
||||
_debugUnit.SetActive(true);
|
||||
_debugCity.SetActive(false);
|
||||
|
||||
// 获取单位数据
|
||||
_main.MapData.UnitMap.GetUnitDataByUnitId(UIBottomInfoStatusObjectId, out var unitData);
|
||||
|
||||
// 填充单位类型信息
|
||||
_debugUnit.transform.Find("UnitTypeValue").GetComponent<TextMeshProUGUI>().text = unitData.UnitType.ToString();
|
||||
|
||||
// 填充巨人类型信息
|
||||
_debugUnit.transform.Find("GiantTypeValue").GetComponent<TextMeshProUGUI>().text = unitData.GiantType.ToString();
|
||||
|
||||
// 填充单位ID
|
||||
_debugUnit.transform.Find("UnitIdValue").GetComponent<TextMeshProUGUI>().text = unitData.Id.ToString();
|
||||
|
||||
// 填充AP值
|
||||
_debugUnit.transform.Find("APValue").GetComponent<TextMeshProUGUI>().text = unitData.AP.ToString();
|
||||
|
||||
// 填充MP值
|
||||
_debugUnit.transform.Find("MPValue").GetComponent<TextMeshProUGUI>().text = unitData.MP.ToString();
|
||||
|
||||
// 填充携带单位类型信息
|
||||
if (_debugUnit.transform.Find("CarryUnitTypeValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryUnitTypeValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryUnitType != UnitType.None ? unitData.CarryUnitType.ToString() : "None";
|
||||
}
|
||||
|
||||
// 填充携带巨人类型信息
|
||||
if (_debugUnit.transform.Find("CarryGiantTypeValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryGiantTypeValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryGiantType != GiantType.None ? unitData.CarryGiantType.ToString() : "None";
|
||||
}
|
||||
|
||||
// 填充携带单位经验值
|
||||
if (_debugUnit.transform.Find("CarryExpValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryExpValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryUnitType != UnitType.None ? unitData.CarryExp.ToString() : "0";
|
||||
}
|
||||
|
||||
// 填充携带单位老兵状态
|
||||
if (_debugUnit.transform.Find("CarryVeteranValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryVeteranValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryUnitType != UnitType.None ? unitData.CarryVeteran.ToString() : "False";
|
||||
}
|
||||
|
||||
// 获取技能组
|
||||
Transform skillGroup = _debugUnit.transform.Find("SkillGroup");
|
||||
|
||||
// 初始化所有技能文本为空
|
||||
for (int i = 0; i < 21; i++)
|
||||
{
|
||||
Transform skillTransform = skillGroup.Find($"Skill ({i})");
|
||||
if (skillTransform != null)
|
||||
{
|
||||
skillTransform.GetComponent<TextMeshProUGUI>().text = "";
|
||||
}
|
||||
}
|
||||
|
||||
// 填充技能信息
|
||||
int skillIndex = 0;
|
||||
foreach (var skill in unitData.Skills)
|
||||
{
|
||||
if (skillIndex >= 9) break; // 最多显示9个技能
|
||||
|
||||
Transform skillTransform = skillGroup.Find($"Skill ({skillIndex})");
|
||||
if (skillTransform != null)
|
||||
{
|
||||
// 获取技能名称
|
||||
string skillName = skill.GetSkillType().ToString();
|
||||
|
||||
skillTransform.GetComponent<TextMeshProUGUI>().text = skillName;
|
||||
}
|
||||
|
||||
skillIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 根据索引执行对应的操作按钮点击
|
||||
public void ExecuteActionButtonByIndex(int index)
|
||||
{
|
||||
if (!ROBottomInfoUI.activeSelf || !HasAction)
|
||||
return;
|
||||
|
||||
// 获取所有激活的操作按钮
|
||||
List<GameObject> activeButtons = new List<GameObject>();
|
||||
|
||||
foreach (Transform child in _actionArea.transform)
|
||||
{
|
||||
if (child.gameObject.activeSelf)
|
||||
{
|
||||
activeButtons.Add(child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查索引是否有效
|
||||
if (index >= 0 && index < activeButtons.Count)
|
||||
{
|
||||
GameObject targetButton = activeButtons[index];
|
||||
|
||||
// 直接调用ActionAreaClicked方法,传入目标按钮
|
||||
ActionAreaClicked(targetButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
private Vector3 dragOrigin; // 记录拖动起点
|
||||
|
||||
public float minX = -100f;
|
||||
public float maxX = 100f;
|
||||
public float minY = -10f;
|
||||
public float maxY = 120f;
|
||||
public float minX = -200f;
|
||||
public float maxX = 200f;
|
||||
public float minY = -60f;
|
||||
public float maxY = 230f;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user