Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 private void OnPressedAbility(TankSectionAbility ability)
 {
     if (battleState.CanUseAbility())
     {
         dragAndDropArrow.StartDrag(ability.CenterPosition);
         pressedAbility = ability.TankAbility;
     }
 }
Пример #4
0
        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);
        }
Пример #5
0
        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);
            });
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
 public void ResolveAbility(TankAbility ability, CardData card, Action onComplete)
 {
     //UpdateHUD();
     onComplete();
 }