private void UpdateTurnUI(BattleController.Turn turn)
    {
        Color transitionColor = Color.black;

        if (turn == BattleController.Turn.Player)
        {
            transitionColor = Color.blue;
        }
        else
        {
            transitionColor = Color.red;
        }

        float fadeDuration = 0.75f;

        Sequence fadeSequence = DOTween.Sequence();

        fadeSequence
        .Append(turnText.DOFade(0, fadeDuration))
        .Append(turnText.DOText(turn + " Turn", 0))
        .Append(turnText.DOColor(transitionColor, 0))
        .Append(turnText.DOFade(1, fadeDuration));

        //fadeSequence.SetEase(Ease.InFlash);

        buttonsContainer.gameObject.SetActive((turn == BattleController.Turn.Player));

        DeactivatePanel();
        battleController.Attacking = false;
        Pathfinding.DeselectNodes(battleController.Nodes);
    }
Example #2
0
    /// <summary>
    /// Called when Pathfinding.OnPathUpdatedEvent is invoked
    /// </summary>
    /// <param name="nodes"></param>
    private void OnPathUpdated(List <Node> nodes)
    {
        BattleEntity entity = friendlies[0];

        if (!entity.IsMoving && canMove && Input.GetMouseButtonDown(0))
        {
            entity.SetPathNodes(nodes);
            Pathfinding.DeselectNodes(nodes);
            canDisplayPathTiles = false;
            canMove             = false;
            OnPlayerInfoChangedEvent(canMove: canMove.ToString());
        }
    }
    private void OnAttackButtonClicked(Attack attack, Button button, BattleEntity player)
    {
        if (currentPressedAttackButton == null)
        {
            currentPressedAttackButton = button;
        }

        List <Node> rangeNodes = Pathfinding.GetRange(battleController.Nodes, player.nodeParent, attack.Range);

        Pathfinding.DeselectNodes(battleController.Nodes);
        Pathfinding.SelectNodes(rangeNodes, Color.cyan);

        FindPressedButton(attackButtons, button, ButtonType.Attack);

        battleController.lastSelectedAttack = attack;
        battleController.Attacking          = true;
    }
 private void Update()
 {
     if (Input.GetMouseButtonDown(1))
     {
         DeactivatePanel();
         if (battleController.Attacking)
         {
             Pathfinding.DeselectNodes(battleController.Nodes);
             battleController.Attacking = false;
         }
     }
     //TODO: use DOTween for this
     if (!fadeOut)
     {
         fadeController.FadeCanvasGroup(fadeOut, panel, false);
     }
     else
     {
         fadeController.FadeCanvasGroup(fadeOut, panel, true, "World");
     }
 }