Ejemplo n.º 1
0
 public void AttackCreatureRanged(CreatureClass creature)
 {
     if (creature.getName() == this.getName())
     {
         Debug.Log("Can't attack yourself!");
         return;
     }
     Debug.Log("attacking ranged");
     //IMPLEMENT
     return;
 }
Ejemplo n.º 2
0
    public void AttackCreatureMelee(CreatureClass creature)
    {
        if (creature.getName() == this.getName())
        {
            Debug.Log("Can't attack yourself!");
            return;
        }
        float rnd        = Random.Range(0, 100);
        float chance     = rnd + critChance;
        int   modifier   = 1;
        int   calcDamage = Mathf.FloorToInt((2 * Random.Range(this.getAtkPower(), this.getAtkPower() + 5) - creature.getDefense()) * 0.5f);

        if (chance >= 80)
        {
            modifier = modifier * 2;
        }
        creature.takeDamage(calcDamage * modifier);
        //Debug.Log("Attacked creature: " + creature + " with " + calcDamage*modifier + " damage " + "cc: " + chance);
        GameObject tmp_txt = Instantiate(damageText);

        tmp_txt.GetComponent <Text_Damage>().setPos(creature.transform.position);
        tmp_txt.GetComponent <Text_Damage>().setText("-" + (calcDamage * modifier).ToString());
    }
Ejemplo n.º 3
0
    public void UpdateUI(GameObject Creature, bool show)
    {
        if (Creature == null)
        {
            ShowUI(false);
            return;
        }

        if (show == false)
        {
            ShowUI(false);
        }
        else
        {
            ShowUI(true);
        }
        CreatureClass cCreature = Creature.GetComponent <CreatureClass>();

        SetName(cCreature.getName());
        SetHealth(cCreature.getHealth(), cCreature.getMaxHealth());
        SetArcana(cCreature.getArcana(), cCreature.getMaxArcana());
        SetExp(cCreature.getExp(), cCreature.getMaxExp());
        SetSprite(cCreature.getSprite());
    }