Ejemplo n.º 1
0
    public void TakeDamage(int damage)
    {
        health -= damage;
        if (health > healthMax)
        {
            health = healthMax;
        }

        AnimaText animaText = new AnimaText();

        if (damage > 0)
        {
            animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.red);
        }
        else if (damage < 0)
        {
            animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.green);
        }
        else
        {
            animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.gray);
        }

        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(PlayerMovement.tilePos);
    }
Ejemplo n.º 2
0
 public bool ConsumeRage()
 {
     if (rage >= rageConsume)
     {
         rage -= rageConsume;
         UnitStat unitStat = new UnitStat();
         unitStat.DisplayStats(PlayerMovement.tilePos);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
    public void DamagePlayer(int damage, int tile, Type type)
    {
        Rng rng = new Rng();

        damage = rng.Range(Mathf.FloorToInt(damage * 0.5f), Mathf.FloorToInt(damage * 1.5f) + 1);
        PlayerStat playerStat = new PlayerStat();

        playerStat.TakeDamage(damage);
        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(tile);
    }
Ejemplo n.º 4
0
    public void ResetStats()
    {
        health = healthMax;
        rage   = 0;

        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(PlayerMovement.tilePos);

        keyObtained = false;
        bossKilled  = false;
    }
Ejemplo n.º 5
0
    public void DamageEnemy(int damage, int tile)
    {
        Enemy.enemies[tile].health -= damage;
        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(tile);
        AnimaText animaText = new AnimaText();

        animaText.ShowText(tile, damage.ToString(), Color.red);

        if (Enemy.enemies[tile].health <= 0)
        {
            Enemy enemy = new Enemy();
            enemy.Destroy(tile);
        }
    }
Ejemplo n.º 6
0
    public void GainRage(int amount)
    {
        if (amount > rageMax - rage)
        {
            amount = rageMax - rage;
        }
        else if (amount < -rage)
        {
            amount = -rage;
        }

        if (amount != 0)
        {
            rage += amount;
        }

        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(PlayerMovement.tilePos);
    }
Ejemplo n.º 7
0
    public void SummonEnemy(int tile, UnitStat.Units unit)
    {
        enemies[tile]         = new EnemyUnit();
        enemies[tile].tilePos = tile;
        enemies[tile].xPos    = tile % 40;
        enemies[tile].yPos    = tile / 40;

        UnitStat unitStat = new UnitStat();

        unitStat.SetStats(tile, unit);

        GameObject prefab = Resources.Load <GameObject>("Assets/Enemy");
        GameObject parent = GameObject.Find("Enemies");

        prefab = Instantiate(prefab, Tile.Tiles[tile].transform.position, new Quaternion(0, 0, 0, 0), parent.transform);

        prefab.name = "Enemy" + tile.ToString();

        occupied[tile]      = true;
        Tile.passable[tile] = false;
        unitStat.DisplayStats(tile);
        prefab.GetComponentInChildren <Image>().sprite = Resources.Load <Sprite>("Enemies/" + enemies[tile].title);
        MoveEnemy(prefab, tile, tile);
    }