Exemplo n.º 1
0
    public void ExecuteBasicAttack()
    {
        _attackType = AttackType.MELEE;
        _performer  = TurnBasedStateMachine.ActiveCharacter;

        if (OpenSkillsPanel.SkillPanelEnabled)
        {
            OpenSkillsPanel.onSkillPanelToggle();
        }


        if (_performer.Target != null)
        {
            if (_attackType == AttackType.MELEE)
            {
                _damage = _performer.Strength * _damageModifier;
            }
            else if (_attackType == AttackType.RANGED)
            {
                _damage = _performer.Accuracy * _damageModifier;
            }

            _performer.Target.CurrentHealth -= _damage;
            _performer.CurrentEnergy        -= _energyCost;
            ShowCharacterStats.onUpdateHealth();
            ShowCharacterStats.onUpdateEnergy();
            _performer.Target.Death();

            Sequence attackSequence = DOTween.Sequence();
            Vector2  startPos       = _performer.transform.position;
            Vector2  battlePos      = new Vector2(0f, _performer.transform.position.y);
            attackSequence.Append(_performer.transform.DOMove(battlePos, 0.5f));
            attackSequence.Append(_performer.transform.DOShakeScale(0.5f));
            attackSequence.Append(_performer.transform.DOMove(startPos, 0.25f));
            attackSequence.SetLoops(1);

            ShowCharacterStats.onUpdateHealth();

            if (TurnBasedStateMachine.OnNextTurnEvent != null)
            {
                TurnBasedStateMachine.OnNextTurnEvent();
            }
        }
        else
        {
            SaveCombatAction();
            Debug.Log("Please select a target");
            if (ManageTargeting.IsEnabled == false)
            {
                ManageTargeting.EnableTargets();
            }
            else
            {
                ManageTargeting.DisableTargets();
            }
        }
    }
Exemplo n.º 2
0
    void DisableSkillsPanel()
    {
        _skillPanel.gameObject.SetActive(false);

        if (ManageTargeting.IsEnabled)
        {
            ManageTargeting.DisableTargets();
        }
    }
Exemplo n.º 3
0
    public static void SetTarget(Character target)
    {
        //Character target = GetComponent<ShowCharacterStats>().Character;
        ManageTargeting.DisableTargets();

        TurnBasedStateMachine.ActiveCharacter.Target = target;
        if (CombatAction.OnTargetSelect != null)
        {
            CombatAction.OnTargetSelect();
            CombatAction.OnTargetSelect = null;
            if (OpenSkillsPanel.SkillPanelEnabled == true)
            {
                OpenSkillsPanel.onSkillPanelToggle();
            }
        }
    }
Exemplo n.º 4
0
    public void ToggleSkillPanel()
    {
        if (_skillPanel.gameObject.activeSelf == true)
        {
            SkillPanelEnabled = false;
            _openPanelTween.Kill();
            _closePanelTween             = _rt.DOAnchorPosX(_startPos, 0.5f).SetEase(Ease.InExpo);
            _closePanelTween.onComplete += DisableSkillsPanel;
        }
        else
        {
            if (ManageTargeting.IsEnabled)
            {
                ManageTargeting.DisableTargets();
            }

            SkillPanelEnabled = true;
            _closePanelTween.Kill();
            _skillPanel.gameObject.SetActive(true);
            _openPanelTween = _rt.DOAnchorPosX(_endPos, 0.5f).SetEase(Ease.OutExpo);
        }
    }