Added minigame to attack action
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Babushka.scripts.CSharp.Common.Fight.ActionDetails;
|
||||
using Babushka.scripts.CSharp.Common.Util;
|
||||
@@ -15,6 +16,8 @@ public class AllyAttackAction : FighterAction
|
||||
selectAlly = false
|
||||
};
|
||||
|
||||
public MinigameActionDetail minigameDetail = new();
|
||||
|
||||
public override Variant<float, Func<bool>> GetAnimationEnd()
|
||||
{
|
||||
return 1;
|
||||
@@ -22,12 +25,12 @@ public class AllyAttackAction : FighterAction
|
||||
|
||||
public override bool NextDetail()
|
||||
{
|
||||
return !targetSelect.DetailComplete();
|
||||
return !targetSelect.DetailComplete() || !minigameDetail.DetailComplete();
|
||||
}
|
||||
|
||||
public override FighterActionDetail CurrentDetail()
|
||||
{
|
||||
return targetSelect;
|
||||
return targetSelect.DetailComplete() ? minigameDetail : targetSelect;
|
||||
}
|
||||
|
||||
public override AllyActionButton BindToActionButton()
|
||||
@@ -38,11 +41,13 @@ public class AllyAttackAction : FighterAction
|
||||
public override void Reset()
|
||||
{
|
||||
targetSelect.ResetResult();
|
||||
minigameDetail.ResetResult();
|
||||
}
|
||||
|
||||
public override void ExecuteAction()
|
||||
{
|
||||
targetSelect.GetTarget().AddHealth(-5);
|
||||
var totalDamage = minigameDetail.damageHits!.Sum(dh => dh);
|
||||
targetSelect.GetTarget().AddHealth(-totalDamage);
|
||||
}
|
||||
|
||||
public override async Task AnimateAction(AllFightersVisual allFightersVisual)
|
||||
@@ -52,7 +57,7 @@ public class AllyAttackAction : FighterAction
|
||||
|
||||
var currentFighterVisual = allFightersVisual.GetVisualForFighter(currentFighter);
|
||||
var targetFighterVisual = allFightersVisual.GetVisualForFighter(targetFighter);
|
||||
|
||||
|
||||
await currentFighterVisual.AnimatePosToTarget(targetFighterVisual);
|
||||
_ = targetFighterVisual.AnimateHit();
|
||||
await currentFighterVisual.AnimatePosToBase();
|
||||
|
||||
Reference in New Issue
Block a user