public async Task ShowTurnCompare(CombatUtil.CombatAction playerAction,
                                          CombatUtil.CombatAction enemyAction,
                                          float duration = 1.5f)
        {
            _playerActionLabel.Text     = CombatUtil.GetActionName(playerAction);
            _playerActionLabel.Modulate = CombatUtil.GetActionColor(playerAction);
            _enemyActionLabel.Text      = CombatUtil.GetActionName(enemyAction);
            _enemyActionLabel.Modulate  = CombatUtil.GetActionColor(enemyAction);
            _lineLabel.Visible          = true;
            compareContainer.Visible    = true;

            if (duration > 0)
            {
                var color = _playerActionLabel.Modulate;
                color.a = 0;
                _playerActionLabel.Modulate = color;
                color   = _enemyActionLabel.Modulate;
                color.a = 0;
                _enemyActionLabel.Modulate = color;

                _tween.InterpolateProperty(_enemyActionLabel, "modulate:a", 0f, 1f,
                                           actionTweenDuration, Tween.TransitionType.Quad, Tween.EaseType.Out,
                                           actionTweenDelay);
                _tween.InterpolateProperty(_playerActionLabel, "modulate:a", 0f, 1f,
                                           actionTweenDuration, Tween.TransitionType.Quad, Tween.EaseType.Out,
                                           actionTweenDelay);
                _tween.Start();

                await ToSignal(_tween, "tween_all_completed");
                await ToSignal(GetTree().CreateTimer(duration), "timeout");

                _lineLabel.Visible       = false;
                compareContainer.Visible = false;
            }
        }
Example #2
0
        public async Task AnimatePlayerHurt(int damage, bool enemyCountered = false)
        {
            if (enemyCountered)
            {
                await _attackEffect.Play(_effectAnimations.GetAnimation("counter"),
                                         CombatUtil.GetActionColor(CombatUtil.CombatAction.Heavy));
            }

            Shake(1, 20, 1);
            _playerHealthIcon.Blink(1, 6);
            await ToSignal(GetTree().CreateTimer(1.5f), "timeout");
        }
Example #3
0
        public async Task AnimatePlayerAttack(PlayerCombat playerCombat,
                                              CombatUtil.CombatAction action)
        {
            if (action == CombatUtil.CombatAction.Counter)
            {
                await _attackEffect.Play(_effectAnimations.GetAnimation("counter"),
                                         CombatUtil.GetActionColor(CombatUtil.CombatAction.Heavy));
            }

            var damageType = playerCombat.GetDamageType(action);

            if (damageType == "none")
            {
                return;
            }
            var effectAnimation = _effectAnimations.GetAnimation(damageType);
            await _attackEffect.Play(effectAnimation,
                                     CombatUtil.GetActionColor(action));
        }
 private void SetWinLabel(string actor, CombatUtil.CombatAction action)
 {
     _winActorLabel.Text      = actor;
     _winActionLabel.Text     = CombatUtil.GetActionName(action);
     _winActionLabel.Modulate = CombatUtil.GetActionColor(action);
 }