Exemple #1
0
    public void ChangePosition(Mage mage2Move)
    {
        CreateAttackCommand(mage2Move);

        IndividualTiles magePreviousTile = mage2Move.myCurrentTile;

        mage2Move.MoveToTilePushed(myCurrentTile);
        mage2Move.UpdateInformationAfterMovement(myCurrentTile);
        this.MoveToTilePushed(magePreviousTile);
        UpdateInformationAfterMovement(magePreviousTile);
        mage2Move.hasMoved = true;
        LM.UnitHasFinishedMovementAndRotation();
        UIM.RefreshTokens();

        if (mage2Move.isDecoyBomb2)
        {
            TM.GetSurroundingTiles(myCurrentTile, 1, true, false);

            //Hago daño a las unidades adyacentes
            for (int i = 0; i < TM.surroundingTiles.Count; ++i)
            {
                if (TM.surroundingTiles[i] != null)
                {
                    TM.surroundingTiles[i].ColorAttack();
                }
            }

            StartCoroutine("WaitToDamageSurroundingAfterChangePos");
        }

        HideAttackEffect(null);
    }
Exemple #2
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);

        if (!_isThisUnitTheAttacker)
        {
            isInRage           = lastAttack.isInRage;
            turnsLeftToRageOff = lastAttack.rageTurnsLeft;

            if (!isInRage)
            {
                isInRageIcon.SetActive(false);
                turnsLeftToRageOff = maxNumberOfTurnsInRage;
                myPanelPortrait.GetComponent <Portraits>().specialSkillTurnsLeft.enabled = false;

                RageColor();
            }
        }

        Debug.Log("woooooowooo");

        //Quitar efectos de rage visuales si se le quita con el undo

        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }
        UIM.CheckActionsAvaliable();
    }
Exemple #3
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);

        if (isDead &&
            (_isThisUnitTheAttacker && lastAttack.pjPreviousHealth > 0) ||
            (!_isThisUnitTheAttacker && lastAttack.objPreviousHealth > 0))
        {
            for (int i = 0; i < LM.charactersOnTheBoard.Count; i++)
            {
                if (LM.charactersOnTheBoard[i].GetComponent <Mage>())
                {
                    myMage = LM.charactersOnTheBoard[i].GetComponent <Mage>();

                    myMage.myDecoys.Add(gameObject);
                    LM.charactersOnTheBoard.Add(this);

                    break;
                }
            }

            EnableUnableCollider(true);
            //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
            Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

            if (samuraiUpgraded != null)
            {
                samuraiUpgraded.RefreshHonorOnPortrait();
            }
            UIM.CheckActionsAvaliable();
        }
    }
Exemple #4
0
 private void OnMouseDown()
 {
     //GB.gameObject.SetActive(true);
     //WB.gameObject.SetActive(true);
     UIM.GetComponent <UIManager>().BuildSelect = true;
     UIM.GetComponent <UIManager>().Upgrading   = false;
     UIM.GetComponent <UIManager>().ability     = false;
 }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     curretHeath = maxHealth;
     damageText  = GetComponentInChildren <DamageText>();
     minionColor = playerRenderer.material.color;
     ChangeState(STATE.idle);
     uiman = FindObjectOfType <UIM>();
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
 }
 void Start()
 {
     uiMan = FindObjectOfType <UIM>();
     uiMan.sunImage.gameObject.SetActive(true);
     uiMan.moonImage.gameObject.SetActive(false);
     waveCountdown           = timeBetweenWaves;
     waveCountdownint        = Convert.ToInt32(waveCountdown);
     uiMan.DaylightText.text = waveCountdownint.ToString();
     if (spawnPoints.Length == 0)
     {
         Debug.LogError("No spawnpoints referencede");
     }
 }
Exemple #8
0
    public void ChangePosition(PlayerUnit unitToMove)
    {
        CreateAttackCommand(unitToMove);

        IndividualTiles valkyriePreviousTile = unitToMove.myCurrentTile;

        unitToMove.MoveToTilePushed(myCurrentTile);
        unitToMove.UpdateInformationAfterMovement(myCurrentTile);
        this.MoveToTilePushed(valkyriePreviousTile);
        UpdateInformationAfterMovement(valkyriePreviousTile);
        hasMoved = true;
        LM.UnitHasFinishedMovementAndRotation();
        UIM.RefreshTokens();
    }
Exemple #9
0
    void Update()
    {
        //if (Input.GetKey(KeyCode.R))
        //{
        //    hp -= 1;
        //}
        GB.transform.position   = new Vector3(0.042f - ((5000 - hp) * 1.792f) / 5000.0f + 0.5f, 1.782f + 0.5f, 5.0f);
        GB.transform.localScale = new Vector3(0.42f * hp / 5000.0f, 0.042f, 1.0f);

        if (hp <= 0)
        {
            UIM.GetComponent <UIManager>().gameover = true;
        }
    }
Exemple #10
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);

        CheckUnitsAndTilesInRangeToAttack(false);
        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }
        UIM.CheckActionsAvaliable();
    }
Exemple #11
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);
        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }
        UIM.CheckActionsAvaliable();

        //myDecoys.
        //Hacer la movida de los decoys
    }
Exemple #12
0
    public override void ReceiveDamage(int damageReceived, UnitBase unitAttacker)
    {
        if (parryOn && unitToParry != null)
        {
            particleParryAttack.SetActive(true);

            if (parryOn2)
            {
                if (unitAttacker == unitToParry)
                {
                    damageReceived = 0;
                    DoDamage(unitToParry);
                    UIM.RefreshHealth();
                    parryIcon.SetActive(false);
                }
                else if (unitToParry != null)
                {
                    if ((unitAttacker.currentFacingDirection == FacingDirection.North || unitAttacker.currentFacingDirection == FacingDirection.South &&
                         currentFacingDirection == FacingDirection.West || currentFacingDirection == FacingDirection.East)
                        ||
                        (unitAttacker.currentFacingDirection == FacingDirection.West || unitAttacker.currentFacingDirection == FacingDirection.East &&
                         currentFacingDirection == FacingDirection.North || currentFacingDirection == FacingDirection.South))
                    {
                        base.ReceiveDamage(damageReceived, unitAttacker);

                        DoDamage(unitToParry);
                        UIM.RefreshHealth();

                        parryIcon.SetActive(false);
                    }
                }
            }

            else if (unitAttacker == unitToParry)
            {
                damageReceived = 0;
                DoDamage(unitToParry);
                UIM.RefreshHealth();

                parryIcon.SetActive(false);
            }
        }

        else
        {
            base.ReceiveDamage(damageReceived, unitAttacker);
        }
    }
Exemple #13
0
    void HitBall(GameObject obj)
    {
        GameObject UIMgr;
        UIManager  UIM;

        UIMgr = GameObject.Find("UIManager");
        UIM   = UIMgr.GetComponent <UIManager>();
        UIScore UIS = UIM.UI <UIScore>(false);
        UITimer UIT = UIS.GetComponentInChildren <UITimer>();

        //给球加力
        rb.AddForce(pos.normalized * 1000 * value);
        LR.SetPosition(0, BallPos);
        LR.SetPosition(1, BallPos);
        bFirst = true;
        //停止计时
        UIT.Timer1.value = 1;
        UIT.Timer2.value = 2;
    }
Exemple #14
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);

        unitToParry = lastAttack.unitToParry;

        CheckIfIsLonely();

        //Falta Honor
        currentHonor  = lastAttack.honor;
        LM.honorCount = currentHonor;

        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }

        UIM.CheckActionsAvaliable();
    }
Exemple #15
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);

        unitsAttacked.Clear();
        for (int i = 0; i < lastAttack.unitsAttacked.Count; i++)
        {
            unitsAttacked.Add(lastAttack.unitsAttacked[i]);
        }

        extraTurnCount = lastAttack.ninjaExtraTurns;
        unitsCanJump   = lastAttack.ninjaExtraJumps;

        baseDamage = lastAttack.ninjaBonusDamage;

        //Destruyo bombas actuales
        for (int i = 0; i < realBombsSpawned.Count; i++)
        {
            Destroy(realBombsSpawned[i]);
        }

        realBombsSpawned.Clear();
        //Instancio bombas antiguas
        for (int i = 0; i < lastAttack.smokeTiles.Count; i++)
        {
            realBombsSpawned.Add(lastAttack.smokeTiles[i]);
            Instantiate(lastAttack.smokeTiles[i], lastAttack.smokeTiles[i].transform);
        }

        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }
        UIM.CheckActionsAvaliable();
    }
Exemple #16
0
    public override void UndoAttack(AttackCommand lastAttack, bool _isThisUnitTheAttacker)
    {
        base.UndoAttack(lastAttack, _isThisUnitTheAttacker);

        //Tiles de curación instanciados borrados
        for (int i = 0; i < realTilesSpawned.Count; i++)
        {
            if (!lastAttack._realTilesInstantiated.Contains(realTilesSpawned[i]))
            {
                Destroy(realTilesSpawned[i]);
                realTilesSpawned.RemoveAt(i);
                i--;
            }
        }

        damageTilesReplaced.Clear();

        for (int i = 0; i < lastAttack._damageTilesReplaced.Count; i++)
        {
            lastAttack._damageTilesReplaced[i].SetActive(true);
        }

        //healedLife en vez de buffbonusStateDamage
        healedLife = lastAttack._healedLife;
        buffHeal   = lastAttack._buffHeal;

        UIM.CheckActionsAvaliable();

        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }
    }
Exemple #17
0
    public override void UndoMove(MoveCommand _moveCommand, IndividualTiles tileToMoveBack, FacingDirection rotationToTurnBack, bool shouldResetMovement)
    {
        base.UndoMove(_moveCommand, tileToMoveBack, rotationToTurnBack, shouldResetMovement);

        if (shouldResetMovement)
        {
            if (myDecoys.Count > 0)
            {
                LM.charactersOnTheBoard.Remove(myDecoys[myDecoys.Count - 1].GetComponent <PlayerUnit>());

                Destroy(myDecoys[myDecoys.Count - 1]);
                myDecoys.RemoveAt(myDecoys.Count - 1);
            }
        }

        //Estas líneas las añado para comprobar si hay samurai y si hay que actualizar el honor
        Samurai samuraiUpgraded = FindObjectOfType <Samurai>();

        if (samuraiUpgraded != null)
        {
            samuraiUpgraded.RefreshHonorOnPortrait();
        }
        UIM.CheckActionsAvaliable();
    }
Exemple #18
0
 // Use this for initialization
 void Start()
 {
     myAgent  = GetComponent <NavMeshAgent>();
     uiMan    = FindObjectOfType <UIM>();
     Dumpster = FindObjectOfType <Dump>().gameObject;
 }
Exemple #19
0
    public override void Attack(UnitBase unitToAttack)
    {
        CheckIfUnitHasMarks(unitToAttack);

        if (areaHealer)
        {
            if (unitToAttack.GetComponent <PlayerUnit>())
            {
                Instantiate(areaHealParticle, unitToAttack.transform.position, areaHealParticle.transform.rotation);
                SoundManager.Instance.PlaySound(AppSounds.HEALING);

                //COMPROBAR QUE NO DE ERROR EN OTRAS COSAS
                TM.surroundingTiles.Clear();

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

                //UNDO
                CreateAttackCommand(unitToAttack);

                //Unidad a la que he clickado
                if (areaHealer2)
                {
                    unitToAttack.isStunned   = false;
                    unitToAttack.turnStunned = 0;
                    ApplyBuffOrDebuffDamage(unitToAttack, 0, 0);

                    unitToAttack.buffbonusStateDamage = 0;
                }

                if (tileTransformer)
                {
                    realTilesSpawned.Add(Instantiate(healerTilePref, unitToAttack.transform.position, unitToAttack.transform.rotation));
                }

                unitToAttack.currentHealth += healedLife;
                unitToAttack.RefreshHealth(false);

                //Curo a las unidades en el área
                for (int i = 0; i < TM.surroundingTiles.Count; ++i)
                {
                    if (TM.surroundingTiles[i].unitOnTile != null)
                    {
                        //UNDO
                        CreateAttackCommand(TM.surroundingTiles[i].unitOnTile);

                        if (areaHealer2)
                        {
                            TM.surroundingTiles[i].unitOnTile.isStunned   = false;
                            TM.surroundingTiles[i].unitOnTile.turnStunned = 0;
                            ApplyBuffOrDebuffDamage(TM.surroundingTiles[i].unitOnTile, 0, 0);

                            TM.surroundingTiles[i].unitOnTile.buffbonusStateDamage = 0;
                        }

                        if (tileTransformer)
                        {
                            realTilesSpawned.Add(Instantiate(healerTilePref, TM.surroundingTiles[i].unitOnTile.transform.position, TM.surroundingTiles[i].unitOnTile.transform.rotation));
                        }

                        //Curación
                        if (TM.surroundingTiles[i].unitOnTile.currentHealth < TM.surroundingTiles[i].unitOnTile.maxHealth && !TM.surroundingTiles[i].unitOnTile.GetComponent <BossMultTile>())
                        {
                            TM.surroundingTiles[i].unitOnTile.currentHealth += healedLife;
                            TM.surroundingTiles[i].unitOnTile.RefreshHealth(false);
                        }
                    }
                }

                if (shadowTilesSpawned.Count > 0)
                {
                    for (int i = 0; i < shadowTilesSpawned.Count; i++)
                    {
                        Destroy(shadowTilesSpawned[i].gameObject);
                    }

                    shadowTilesSpawned.Clear();
                }

                //IMPORTANTE PARA EL UNDO QUE LA VIDA SE QUITE AL FINAL
                currentHealth -= 1;
                if (currentHealth <= 0)
                {
                    Die();
                    isDead = true;
                }


                UIM.RefreshTokens();
                UIM.RefreshHealth();
                unitToAttack.RefreshHealth(false);
                RefreshHealth(false);
            }

            else
            {
                //UNDO
                CreateAttackCommand(unitToAttack);

                //Hago daño
                DoDamage(unitToAttack);

                if (currentHealth < maxHealth)
                {
                    currentHealth += healedLife;
                    RefreshHealth(false);
                    UIM.RefreshTokens();
                    UIM.RefreshHealth();
                }

                //Hay que cambiar
                SoundManager.Instance.PlaySound(AppSounds.MAGE_ATTACK);
            }
        }

        else
        {
            //UNDO
            CreateAttackCommand(unitToAttack);

            if (unitToAttack.GetComponent <PlayerUnit>())
            {
                Instantiate(healParticle, unitToAttack.transform.position, healParticle.transform.rotation);

                SoundManager.Instance.PlaySound(AppSounds.HEALING);

                if (individualHealer2)
                {
                    ApplyBuffOrDebuffMovement(unitToAttack, fMovementUds + movementUpgrade, 3);
                }

                else if (tileTransformer)
                {
                    realTilesSpawned.Add(Instantiate(healerTilePref, unitToAttack.transform.position, unitToAttack.transform.rotation));
                }

                if (shadowTilesSpawned.Count > 0)
                {
                    for (int i = 0; i < shadowTilesSpawned.Count; i++)
                    {
                        Destroy(shadowTilesSpawned[i].gameObject);
                    }

                    shadowTilesSpawned.Clear();
                }

                if (unitToAttack.currentHealth < unitToAttack.maxHealth)
                {
                    unitToAttack.currentHealth += healedLife;

                    unitToAttack.RefreshHealth(false);
                }

                currentHealth -= 1;
                if (currentHealth <= 0)
                {
                    Die();
                    isDead = true;
                }

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

            else
            {
                //Hay que cambiar
                Instantiate(attackParticle, unitToAttack.transform.position, attackParticle.transform.rotation);

                //Hago daño
                DoDamage(unitToAttack);

                if (currentHealth < maxHealth)
                {
                    currentHealth += healedLife;
                    RefreshHealth(false);
                    UIM.RefreshTokens();
                    UIM.RefreshHealth();
                }

                //Hay que cambiar
                SoundManager.Instance.PlaySound(AppSounds.MAGE_ATTACK);
            }
        }


        hasAttacked = true;
        HideAttackEffect(unitToAttack);
        //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
        base.Attack(unitToAttack);
    }
Exemple #20
0
    // Start is called before the first frame update

    public void Start()
    {
        Instance = this;
    }
Exemple #21
0
    //En función de donde este mirando el personaje paso una lista de tiles diferente.
    public override void Attack(UnitBase unitToAttack)
    {
        CalculateDamage(unitToAttack);
        CheckIfUnitHasMarks(unitToAttack);
        HideAttackEffect(unitToAttack);

        if (checkersAttack)
        {
            //UNDO
            CreateAttackCommand(unitToAttack);

            unitsCanJump--;

            //Importante esta llamada sea la primera
            CalculateAttackLogic(unitToAttack, true);

            //Quito el color del tile
            myCurrentTile.ColorDeselect();
            transform.DOJump(currentTileVectorToMove, 1, 1, 1);

            //Cambio la rotación
            NewRotationAfterJump(unitToAttack.myCurrentTile);
            unitsAttacked.Add(unitToAttack);

            //Hago daño
            DoDamage(unitToAttack);

            CheckPasiveUpgrades(unitToAttack);

            myPanelPortrait.GetComponent <Portraits>().specialSkillTurnsLeft.text = unitsCanJump.ToString();

            SoundManager.Instance.PlaySound(AppSounds.ROGUE_ATTACK);

            if (unitsCanJump >= 1)
            {
                LM.DeSelectUnit();
                hasAttacked = false;
                CheckUnitsAndTilesInRangeToAttack(true);

                hasMoved = true;

                UIM.RefreshTokens();
                LM.SelectUnit(0, this);

                UIM.CheckActionsAvaliable();


                for (int i = 0; i < unitsAttacked.Count; i++)
                {
                    currentUnitsAvailableToAttack.Remove(unitsAttacked[i]);
                }
            }
            else
            {
                //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
                base.Attack(unitToAttack);
                hasAttacked = true;
            }
        }

        else if (extraTurnAttackAfterKill)
        {
            //UNDO
            CreateAttackCommand(unitToAttack);

            //Importante esta llamada sea la primera
            CalculateAttackLogic(unitToAttack, true);

            //Quito el color del tile
            myCurrentTile.ColorDeselect();
            transform.DOJump(currentTileVectorToMove, 1, 1, 1);

            //Cambio la rotación
            NewRotationAfterJump(unitToAttack.myCurrentTile);

            //Hago daño
            DoDamage(unitToAttack);

            CheckPasiveUpgrades(unitToAttack);

            SoundManager.Instance.PlaySound(AppSounds.ROGUE_ATTACK);

            if (unitToAttack.isDead && extraTurnCount > 0)
            {
                extraTurnCount--;
                hasAttacked = false;
                hasMoved    = false;
                UIM.RefreshTokens();
                LM.DeSelectUnit();
                UIM.CheckActionsAvaliable();
                myPanelPortrait.GetComponent <Portraits>().specialSkillTurnsLeft.text = "0";

                //Lo hago aquí para que cuando se seleccione nuevamente ya esté bien calculado.
                LM.tilesAvailableForMovement = new List <IndividualTiles>(LM.TM.OptimizedCheckAvailableTilesForMovement(movementUds, this, false));

                for (int i = 0; i < LM.tilesAvailableForMovement.Count; i++)
                {
                    LM.tilesAvailableForMovement[i].ColorMovement();
                }

                LM.SelectUnit(movementUds, this);
            }
            else
            {
                //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
                base.Attack(unitToAttack);
                hasAttacked = true;
            }
        }
        else
        {
            //UNDO
            CreateAttackCommand(unitToAttack);

            //Importante esta llamada sea la primera
            CalculateAttackLogic(unitToAttack, true);

            //Quito el color del tile
            myCurrentTile.ColorDeselect();
            transform.DOJump(currentTileVectorToMove, 1, 1, 1);

            //Cambio la rotación
            NewRotationAfterJump(unitToAttack.myCurrentTile);

            //Hago daño
            DoDamage(unitToAttack);

            CheckPasiveUpgrades(unitToAttack);

            SoundManager.Instance.PlaySound(AppSounds.ROGUE_ATTACK);

            //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
            base.Attack(unitToAttack);
            hasAttacked = true;
        }
    }
Exemple #22
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);
            }
        }
    }
Exemple #23
0
    public override void Attack(UnitBase unitToAttack)
    {
        CheckIfUnitHasMarks(unitToAttack);

        List <IndividualTiles> tilesInFront = new List <IndividualTiles>();

        tilesInFront = myCurrentTile.GetTilesInFrontOfTheCharacter(currentFacingDirection, 3);

        //Particulas
        for (int i = 0; i < tilesInFront.Count; i++)
        {
            if (tilesInFront[i].unitOnTile != null && tilesInFront[i].unitOnTile == unitToAttack)
            {
                if (i == 1)
                {
                    attack1.SetActive(true);
                }

                else if (i == 2)
                {
                    attack2.SetActive(true);
                }

                else if (i == 3)
                {
                    attack3.SetActive(true);
                }
            }
        }

        if (canChooseEnemy)
        {
            //Animación de ataque
            myAnimator.SetTrigger("Attack");

            //UNDO
            CreateAttackCommand(unitToAttack);

            //Quito el color del tile
            myCurrentTile.ColorDeselect();

            for (int i = 0; i < currentUnitsAvailableToAttack.Count; i++)
            {
                if (currentUnitsAvailableToAttack[i] == unitToAttack)
                {
                    break;
                }
                else if (currentUnitsAvailableToAttack[i] != null)
                {
                    //UNDO
                    CreateAttackCommand(currentUnitsAvailableToAttack[i]);

                    DoDamage(currentUnitsAvailableToAttack[i]);
                }
            }


            //Hago daño antes de que se produzca el intercambio
            DoDamage(unitToAttack);

            HideAttackEffect(unitToAttack);
            //Intercambio
            previousTile = unitToAttack.myCurrentTile;

            currentTileVectorToMove = unitToAttack.myCurrentTile.transform.position;
            transform.DOMove(currentTileVectorToMove, 1);

            currentTileVectorToMove = myCurrentTile.transform.position;
            unitToAttack.transform.DOMove(currentTileVectorToMove, 1);

            unitToAttack.UpdateInformationAfterMovement(myCurrentTile);
            UpdateInformationAfterMovement(previousTile);
            unitToAttack.UpdateInformationAfterMovement(unitToAttack.myCurrentTile);

            //Hay que cambiarlo
            SoundManager.Instance.PlaySound(AppSounds.ROGUE_ATTACK);
            //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
            base.Attack(unitToAttack);
        }

        else if (armorMode)
        {
            //Animación de ataque
            myAnimator.SetTrigger("Attack");

            //UNDO
            CreateAttackCommand(unitToAttack);

            //Quito el color del tile
            myCurrentTile.ColorDeselect();

            if (unitToAttack.GetComponent <PlayerUnit>())
            {
                if (armorMode2)
                {
                    currentArmor += numberOfArmorAdded;
                    if (currentArmor > currentHealth)
                    {
                        currentArmor = currentHealth;
                    }
                }

                unitToAttack.currentArmor += numberOfArmorAdded;
                if (unitToAttack.currentArmor > unitToAttack.currentHealth)
                {
                    unitToAttack.currentArmor = unitToAttack.currentHealth;
                }

                unitToAttack.RefreshHealth(false);
                RefreshHealth(false);
            }

            else
            {
                //Hago daño
                DoDamage(unitToAttack);
            }

            //Intercambio
            previousTile = unitToAttack.myCurrentTile;

            currentTileVectorToMove = unitToAttack.myCurrentTile.transform.position;
            transform.DOMove(currentTileVectorToMove, 1);

            currentTileVectorToMove = myCurrentTile.transform.position;
            unitToAttack.transform.DOMove(currentTileVectorToMove, 1);

            unitToAttack.UpdateInformationAfterMovement(myCurrentTile);
            UpdateInformationAfterMovement(previousTile);
            unitToAttack.UpdateInformationAfterMovement(unitToAttack.myCurrentTile);

            HideAttackEffect(unitToAttack);
            UIM.RefreshHealth();
            //Hay que cambiarlo
            SoundManager.Instance.PlaySound(AppSounds.ROGUE_ATTACK);
            //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
            base.Attack(unitToAttack);
        }

        else
        {
            //UNDO
            CreateAttackCommand(unitToAttack);

            //Animación de ataque
            myAnimator.SetTrigger("Attack");

            //Quito el color del tile
            myCurrentTile.ColorDeselect();

            if (unitToAttack.GetComponent <PlayerUnit>())
            {
            }

            else
            {
                //Hago daño
                DoDamage(unitToAttack);
            }

            HideAttackEffect(unitToAttack);
            //Intercambio
            previousTile = unitToAttack.myCurrentTile;

            currentTileVectorToMove = unitToAttack.myCurrentTile.transform.position;
            transform.DOMove(currentTileVectorToMove, 1);

            currentTileVectorToMove = myCurrentTile.transform.position;
            unitToAttack.transform.DOMove(currentTileVectorToMove, 1);

            unitToAttack.UpdateInformationAfterMovement(myCurrentTile);
            UpdateInformationAfterMovement(previousTile);
            unitToAttack.UpdateInformationAfterMovement(unitToAttack.myCurrentTile);

            //Hay que cambiarlo
            SoundManager.Instance.PlaySound(AppSounds.ROGUE_ATTACK);
            //La base tiene que ir al final para que el bool de hasAttacked se active después del efecto.
            base.Attack(unitToAttack);
        }

        hasAttacked = true;
    }
Exemple #24
0
 // Use this for initialization
 void Start()
 {
     uiMan = FindObjectOfType <UIM>();
 }
Exemple #25
0
 private void Start()
 {
     Currency = FindObjectOfType <UIM>();
 }