Example #1
0
    public void PutQuitMark(UnitBase _unitToMark, UnitBase _unitAttacking, bool haveToPut, bool showFutureMark)
    {
        //Si pongo la marca actualizo los numeros y el estado del bool
        if (haveToPut)
        {
            _unitToMark.isMarked = true;

            _unitToMark.numberOfMarks += 1;

            if (suplex2)
            {
                if (_unitToMark.numberOfMarks > 2)
                {
                    _unitToMark.isMarked      = false;
                    _unitToMark.numberOfMarks = 0;

                    _unitAttacking.currentHealth += healWithUpgradedMark;
                }
            }

            //NO ES >= 1, ESTÁ BIEN >
            else if (_unitToMark.numberOfMarks > 1)
            {
                _unitToMark.isMarked      = false;
                _unitToMark.numberOfMarks = 0;

                _unitAttacking.currentHealth += healerBonus;
            }

            _unitAttacking.RefreshHealth(false);
            UIM.RefreshHealth();
        }

        //Independientemente de que actualice la maca o no tengo que enseñarla
        //Esto sirve para el showAction que tiene que mostrar el estado en el que acaba la marca (como si ya se hubiese aplicado el ataque)
        if (showFutureMark)
        {
            if (_unitToMark.isMarked)
            {
                if (_unitToMark.numberOfMarks == 1)
                {
                    if (suplex2)
                    {
                        _unitToMark.monkMark.SetActive(false);

                        if (_unitAttacking.GetComponent <Monk>())
                        {
                            _unitToMark.monkMarkUpgrade.SetActive(true);
                        }
                    }

                    else
                    {
                        _unitToMark.monkMark.SetActive(false);

                        _unitAttacking.canvasHover.SetActive(true);
                        _unitAttacking.canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("+" + healerBonus);
                        _unitAttacking.canvasHover.GetComponent <CanvasHover>().damageNumber.color = new Color32(0, 255, 50, 255);
                        _unitAttacking.ColorAvailableToBeHealed();
                        _unitAttacking.myCurrentTile.ColorHeal();
                    }
                }

                else if (_unitToMark.numberOfMarks == 2)
                {
                    _unitToMark.monkMark.SetActive(false);

                    _unitToMark.monkMarkUpgrade.SetActive(false);

                    _unitAttacking.canvasHover.SetActive(true);
                    _unitAttacking.canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("+" + healWithUpgradedMark);
                    _unitAttacking.canvasHover.GetComponent <CanvasHover>().damageNumber.color = new Color32(0, 255, 50, 255);
                    _unitAttacking.ColorAvailableToBeHealed();
                    _unitAttacking.myCurrentTile.ColorHeal();
                }
            }

            else if (_unitToMark.numberOfMarks == 0)
            {
                if (_unitAttacking.GetComponent <Monk>())
                {
                    _unitToMark.monkMark.SetActive(true);
                }

                _unitToMark.monkMarkUpgrade.SetActive(false);
            }
        }

        //El estado actual (sirve para el ataque)
        else
        {
            if (_unitToMark.isMarked)
            {
                if (_unitToMark.numberOfMarks == 1)
                {
                    _unitToMark.monkMark.SetActive(true);

                    _unitToMark.monkMarkUpgrade.SetActive(false);
                }

                else if (_unitToMark.numberOfMarks == 2)
                {
                    _unitToMark.monkMark.SetActive(false);

                    _unitToMark.monkMarkUpgrade.SetActive(true);
                }
            }

            else if (_unitToMark.numberOfMarks == 0)
            {
                _unitToMark.monkMark.SetActive(false);

                _unitToMark.monkMarkUpgrade.SetActive(false);
            }
        }
    }
Example #2
0
    public override void ShowAttackEffect(UnitBase _unitToAttack)
    {
        base.ShowAttackEffect(_unitToAttack);

        if (areaHealer)
        {
            if (_unitToAttack.GetComponent <PlayerUnit>())
            {
                TM.surroundingTiles.Clear();

                TM.GetSurroundingTiles(_unitToAttack.myCurrentTile, 1, true, false);

                tilesInEnemyHover.Add(_unitToAttack.myCurrentTile);

                for (int i = 0; i < TM.surroundingTiles.Count; ++i)
                {
                    if (TM.surroundingTiles[i] != null)
                    {
                        tilesInEnemyHover.Add(TM.surroundingTiles[i]);
                    }
                }

                previsualizeAttackIcon.SetActive(true);
                canvasHover.SetActive(true);
                canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("-1");

                for (int i = 0; i < tilesInEnemyHover.Count; i++)
                {
                    tilesInEnemyHover[i].ColorHeal();

                    if (tilesInEnemyHover[i].unitOnTile != null)
                    {
                        if (tileTransformer)
                        {
                            GameObject shadowTile = Instantiate(shadowHealerTilePref, tilesInEnemyHover[i].transform.position, tilesInEnemyHover[i].transform.rotation);
                            shadowTilesSpawned.Add(shadowTile);
                        }

                        tilesInEnemyHover[i].unitOnTile.canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("+" + healedLife);
                        tilesInEnemyHover[i].unitOnTile.canvasHover.GetComponent <CanvasHover>().damageNumber.color = new Color32(0, 255, 50, 255);
                        tilesInEnemyHover[i].unitOnTile.ColorAvailableToBeHealed();
                        tilesInEnemyHover[i].unitOnTile.canvasHover.SetActive(true);
                        tilesInEnemyHover[i].unitOnTile.myCurrentTile.ColorHeal();
                    }
                }
            }

            else
            {
                int healNumeber;

                if (_unitToAttack.isMarked)
                {
                    if (_unitToAttack.numberOfMarks == 1)
                    {
                        healNumeber = (healedLife + pjMonkUnitReference.healerBonus);
                    }

                    else
                    {
                        healNumeber = (healedLife + pjMonkUnitReference.healWithUpgradedMark);
                    }
                }

                else
                {
                    healNumeber = healedLife;
                }

                canvasHover.SetActive(true);
                canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("+" + healNumeber);
                canvasHover.GetComponent <CanvasHover>().damageNumber.color = new Color32(0, 255, 50, 255);
                ColorAvailableToBeHealed();
                myCurrentTile.ColorHeal();

                CalculateDamage(_unitToAttack);
                _unitToAttack.ColorAvailableToBeAttackedAndNumberDamage(damageWithMultipliersApplied);
                _unitToAttack.myCurrentTile.ColorAttack();
            }
        }

        else
        {
            if (_unitToAttack != null && _unitToAttack.GetComponent <PlayerUnit>())
            {
                if (tileTransformer)
                {
                    GameObject shadowTile = Instantiate(shadowHealerTilePref, _unitToAttack.transform.position, _unitToAttack.transform.rotation);
                    shadowTilesSpawned.Add(shadowTile);
                }

                if (individualHealer2)
                {
                    SetMovementIcon(movementUpgrade, _unitToAttack, true);
                }

                previsualizeAttackIcon.SetActive(true);
                canvasHover.SetActive(true);
                canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("-1");
                _unitToAttack.canvasHover.SetActive(true);
                _unitToAttack.canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("+" + healedLife);
                _unitToAttack.canvasHover.GetComponent <CanvasHover>().damageNumber.color = new Color32(0, 255, 50, 255);
                _unitToAttack.ColorAvailableToBeHealed();
                _unitToAttack.myCurrentTile.ColorHeal();
                tilesInEnemyHover.Add(_unitToAttack.myCurrentTile);
            }

            else if (_unitToAttack != null)
            {
                int healNumeber;

                if (_unitToAttack.isMarked)
                {
                    if (_unitToAttack.numberOfMarks == 1)
                    {
                        healNumeber = (healedLife + pjMonkUnitReference.healerBonus);
                    }

                    else
                    {
                        healNumeber = (healedLife + pjMonkUnitReference.healWithUpgradedMark);
                    }
                }

                else
                {
                    healNumeber = healedLife;
                }

                healthBar.SetActive(true);
                canvasHover.SetActive(true);
                canvasHover.GetComponent <CanvasHover>().damageNumber.SetText("+" + healNumeber);
                canvasHover.GetComponent <CanvasHover>().damageNumber.color = new Color32(0, 255, 50, 255);
                ColorAvailableToBeHealed();
                myCurrentTile.ColorHeal();

                CalculateDamage(_unitToAttack);
                _unitToAttack.ColorAvailableToBeAttackedAndNumberDamage(damageWithMultipliersApplied);
                _unitToAttack.myCurrentTile.ColorAttack();
            }
        }
    }