Exemplo n.º 1
0
 public override void onAtk(int targetIndex)
 {
     if (targetIndex > 0 && myEnemies[targetIndex - 1].myUnit != null)
     {
         bUnit potUnit = myEnemies[targetIndex - 1].myUnit;
         potUnit.atkDamage(me.curAtk);
     }
     if (targetIndex < myEnemies.Length - 1 && myEnemies[targetIndex + 1].myUnit != null)
     {
         bUnit potUnit = myEnemies[targetIndex + 1].myUnit;
         potUnit.atkDamage(me.curAtk);
     }
 }
Exemplo n.º 2
0
    void executeAttack()
    {
        bUnit sub1unit = trueSub1.GetComponent <UnitMesh>().myUnit;
        bUnit sub2unit = trueSub2.GetComponent <UnitMesh>().myUnit;



        sub1unit.atkDamage(sub2unit.curAtk);
        //STORE INDEX IN METADATA
        sub1unit.myData.onAtk(sub2unit.myData.myIndex);
        sub2unit.atkDamage(sub1unit.curAtk);
        sub2unit.myData.onHitBy(sub1unit.myData.myIndex);



        if (sub1unit.isDead())
        {
            sub1unit.myData.onDeath();
        }
        if (sub2unit.isDead())
        {
            sub2unit.myData.onDeath();
        }

        trueSub1.GetComponent <UnitMesh>().refreshText();
        trueSub2.GetComponent <UnitMesh>().refreshText();


        if (sub2unit.isDead())
        {
            emptySlot(trueSub2.GetComponent <UnitMesh>().mySlot);
        }
        if (sub1unit.isDead())
        {
            emptySlot(trueSub1.GetComponent <UnitMesh>().mySlot);
        }

        restoreMats(trueSub1, trueSub2);

        playerTurn = !playerTurn;
        curAttackersHighlighted = false;
        refreshMetaData();

        arrow.transform.position = new Vector3(100, 100, 100);
    }