public void SpentSectionTurn(TankAbility tankAbility) { var crewMember = gameState.crewMemberStates.FirstOrDefault(x => x.TankPart == tankAbility.TankPart); crewMember.HasActed = true; crewMember.fatigue = Mathf.Clamp(crewMember.fatigue + tankAbility.fatigueDamage, 0, crewMember.maxFatigue); }
public void RegisterAbility(int slot, TankAbility tankAbility, Action <TankSectionAbility> onHoverAbility, Action <TankSectionAbility> onPressedAbility) { var sectionAbility = sectionAbilityPool.GetInstance <TankSectionAbility>(); sectionAbility.Initialize(tankAbility, onPressedAbility, onHoverAbility); sectionAbilities.Add(sectionAbility); }
private void OnPressedAbility(TankSectionAbility ability) { if (battleState.CanUseAbility()) { dragAndDropArrow.StartDrag(ability.CenterPosition); pressedAbility = ability.TankAbility; } }
public void Initialize(TankAbility tankAbility, Action <TankSectionAbility> onPressedAbility, Action <TankSectionAbility> onHoverAbility) { TankAbility = tankAbility; powerText.text = tankAbility.power.GetDescription(); fatigueText.text = string.Format("+{0} fatigue", tankAbility.fatigueDamage.ToString()); OnPressed += () => onPressedAbility(this); OnHover += () => onHoverAbility(this); }
private void OnResolveAbility(TankAbility ability, CardData card) { Debug.Log("OnResolveAbility - ability: " + ability.id + ", card: " + card.id); battleState.SpentSectionTurn(ability); battleState.DestroyCard(card); battleHUD.ResolveAbility(ability, card, () => { battleHUD.UpdateHUD(); ChangePhase(BattlePhase.PLAYER_ACTION); }); }
public bool CanTargetCard(TankAbility ability, CardData card) { if (battlePhase != BattlePhase.PLAYER_ACTION) { return(false); } if (ability.power.powerType != card.powerCost.powerType) { return(false); } if (ability.power.cost < card.powerCost.cost) { return(false); } var crewMember = gameState.crewMemberStates.FirstOrDefault(x => x.TankPart == ability.TankPart); if (crewMember == null || crewMember.HasActed) { return(false); } return(true); }
public void SetupTankAbility(int slot, TankSection tankPart, TankAbility ability, Action <TankSectionAbility> onHoverAbility, Action <TankSectionAbility> onPressedAbility) { var tankSection = abilitySections.FirstOrDefault(x => x.TankSection == tankPart); tankSection.RegisterAbility(slot, ability, onHoverAbility, onPressedAbility); }
public void ResolveAbility(TankAbility ability, CardData card, Action onComplete) { //UpdateHUD(); onComplete(); }