修复攻击动画bug,更新AI播放动画相关行为和镜头控制

This commit is contained in:
daixiawu 2025-06-24 18:28:23 +08:00
parent 5521af6313
commit 723429983c
9 changed files with 28 additions and 28 deletions

View File

@ -19,7 +19,7 @@ MonoBehaviour:
AttackBounceWaitAnimTime: 0.05
CounterAnimTime: 0.15
CounterReturnAnimTime: 0.15
BetweenAttackCounterAnimTime: 0.15
BetweenAttackCounterAnimTime: 0.2
MoveAnimTime: 0.15
ExplorerMoveDelay: 0.15
ProjectileMoveTime: 0.3

View File

@ -19,7 +19,7 @@ MonoBehaviour:
AttackBounceWaitAnimTime: 0.05
CounterAnimTime: 0.15
CounterReturnAnimTime: 0.15
BetweenAttackCounterAnimTime: 0.15
BetweenAttackCounterAnimTime: 0.2
MoveAnimTime: 0.15
ExplorerMoveDelay: 0.15
ProjectileMoveTime: 0.3

View File

@ -78161,6 +78161,7 @@ MonoBehaviour:
maxX: 150
minY: -10
maxY: 170
moveSpeed: 5
--- !u!1 &520790903
GameObject:
m_ObjectHideFlags: 0
@ -107871,10 +107872,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4c0a91e9c554c694791fbd5691165798, type: 3}
m_Name:
m_EditorClassIdentifier:
NoAI: 0
NoAI: 1
FullSight: 1
AIActionTime: 0.5
AIAllTech: 1
AIAllTech: 0
AIMoreMoney: 0
LandThreshold: 0.3
AnimationSpeed: 1

View File

@ -170,7 +170,6 @@ namespace RuntimeData
//Attack信息的RenderMakr
public bool AttackRenderMark;
public float AttackRenderMarkWaitTime;
public Vector3 AttackRenderMarkTargetPos;
public bool AttackRenderMarkNeedBack;
public AttackAnimType AttackRenderMarkAttackAnimType;

View File

@ -196,7 +196,6 @@ namespace Logic
1 => AttackAnimType.Melee, 2 => AttackAnimType.Arrow, 3 => AttackAnimType.Bomb,
_ => AttackAnimType.None
};
unit1.AttackRenderMarkWaitTime = 0f;
unit1.AttackRenderMarkTargetPos = Table.Instance.GridToWorld(grid2,"isUnit");
unit1.AttackRenderMarkNeedBack = true;
@ -338,17 +337,23 @@ namespace Logic
Table.Instance.AnimDataAssets.AttackAnimTime);
//处理反击情况设置unit2的rendermark
unit2.AttackRenderMark = canCounter;
if (canCounter)
{
unit2.AttackRenderMarkWaitTime = counterAttackStart;
unit2.AttackRenderMarkAttackAnimType = unit2.GetAttackRange() switch
{
1 => AttackAnimType.Melee, 2 => AttackAnimType.Arrow, 3 => AttackAnimType.Bomb,
_ => AttackAnimType.None
};
unit2.AttackRenderMarkTargetPos = Table.Instance.GridToWorld(grid1,"isUnit");
unit2.AttackRenderMarkNeedBack = true;
//unit2.AttackRenderMarkWaitTime = counterAttackStart;
Timer.Instance.TimerRegister(unit2, () =>
{
unit2.AttackRenderMark = canCounter;
unit2.AttackRenderMarkAttackAnimType = unit2.GetAttackRange() switch
{
1 => AttackAnimType.Melee, 2 => AttackAnimType.Arrow, 3 => AttackAnimType.Bomb,
_ => AttackAnimType.None
};
unit2.AttackRenderMarkTargetPos = Table.Instance.GridToWorld(grid1,"isUnit");
unit2.AttackRenderMarkNeedBack = true;
},
counterAttackStart);
//如果会被反击至死
if (dmg2 >= unit1.Health)

View File

@ -85,7 +85,7 @@ namespace TH1Renderer
{
MainEditor.Instance.GetCityStrategy(_cityId, out var cst);
MainEditor.Instance.GetPlayerStrategy(_playerData.Id, out var pst);
_debugText.text += $"CST={cst} PST={pst}";
_debugText.text += $"CST={cst} PST={pst}\n";
}
//如果是首都,展示科技

View File

@ -432,8 +432,10 @@ namespace TH1Renderer
$"ArtResources/TH1Buildings/TH1Buildings{forcesName}/{civName}/{forcesName}_{civName}_House_{z + 1}");
house.transform.parent = _cityBuilding.transform;
Vector3 tpos = _ROGrid.transform.position;
//每层的层高
float levelHeight = 1.2f;
tpos = new Vector3(tpos.x + 1.22f * (x - y),
tpos.y + 0.7f * (x + y) + z * 1.6f - 8.32f + 0.7f * (4 - houseEdge),
tpos.y + 0.7f * (x + y) + z * levelHeight - 7.5f + 0.7f * (4 - houseEdge),
tpos.z + 0.9f - (30 + z - x - y) * 0.001f);
house.transform.position = tpos;
}

View File

@ -62,7 +62,6 @@ namespace TH1Renderer
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;
@ -216,7 +215,7 @@ namespace TH1Renderer
else if (_unitData.AttackRenderMark)
{
_unitData.AttackRenderMark = false;
SetAttackAnim(_unitData.AttackRenderMarkAttackAnimType,_unitData.AttackRenderMarkTargetPos,_unitData.AttackRenderMarkNeedBack,_unitData.AttackRenderMarkWaitTime);
SetAttackAnim(_unitData.AttackRenderMarkAttackAnimType,_unitData.AttackRenderMarkTargetPos,_unitData.AttackRenderMarkNeedBack);
}
@ -246,12 +245,9 @@ namespace TH1Renderer
else
if (_needAttack)
{
if (_needWaitTime > 0)
{
_needWaitTime -= Time.deltaTime;
}
//如果处在攻击对方状态
else if (_isAttackGo)
if (_isAttackGo)
{
_attackTime += Time.deltaTime / _attackGoFullTime;
if(_needBack)
@ -582,7 +578,7 @@ namespace TH1Renderer
}
public void SetAttackAnim(AttackAnimType attackAnimType, Vector3 targetPos,bool needBack = true, float needWaitTime = 0f)
public void SetAttackAnim(AttackAnimType attackAnimType, Vector3 targetPos,bool needBack = true)
{
//如果有其他动画还没播放完,先复位
if (_needAttack)
@ -610,19 +606,16 @@ namespace TH1Renderer
{
_isAttackGo = true;
_isAttackBack = false;
_needWaitTime = needWaitTime;
}
else if (attackAnimType == AttackAnimType.Arrow)
{
_isAttackArrow = true;
_isAttackBack = false;
_needWaitTime = needWaitTime;
}
else if (attackAnimType == AttackAnimType.Bomb)
{
_isAttackBomb = true;
_isAttackBack = false;
_needWaitTime = needWaitTime;
}
_attackTargetPos = targetPos;

Binary file not shown.