Beispiel #1
0
    private void DamageMonster(Collision hit)
    {
        ITarget target = hit.gameObject.GetComponent <ITarget>();

        if (target != null)
        {
            experienceManager.AddExp(ExpType.Hit.GetExp() * coverage);
            target.TakeDamage(dmg * coverage, elementType);
        }
    }
Beispiel #2
0
    public override void Die()
    {
        base.Die();

        // If this enemy was on the players enemies list
        if (PlayerController.instance.enemies.Contains(gameObject))
        {
            //  then remove him from it
            PlayerController.instance.enemies.Remove(gameObject);
        }


        if (EnemyHolder.instance != null)
        {
            // If this enemy was on the EnemyHolderBoss event list
            if (EnemyHolder.instance.enemies.Contains(gameObject))
            {
                //  then remove him from it
                EnemyHolder.instance.enemies.Remove(gameObject);
            }
        }


        if (DungeonManager.instance != null)
        {
            DungeonManager dungeon = DungeonManager.instance;

            // If this enemy was died in a dungeon
            if (dungeon.enemiesInDungeon.Contains(gameObject))
            {
                if (!dungeon.bossKeyHasDropped && DungeonManager.instance.bossRoomAvailable)
                {
                    // check to see if it dropped the key
                    LootController.instance.EnemyBossRoomKeyDrop(dungeon.enemiesInDungeon.Count, gameObject.transform.position);
                }

                //  then remove him from the dungeon list
                dungeon.enemiesInDungeon.Remove(gameObject);
            }
        }

        // Add to statistics
        GameDetails.enemiesKilled++;


        // Give Player experience
        playerExp.AddExp(enemyAI.experienceGain, enemyAI.tier);
        // TODO something fancy with combattext or something

        // Add death animation
        int rand = UnityEngine.Random.Range(0, 2);

        if (rand == 0)
        {
            anim.SetTrigger("Dead");
        }
        else if (rand == 1)
        {
            anim.SetTrigger("Dead1");
            enemyAI.altDeath();
        }
        enemyAI.isDead = true;

        // Loot logic
        if (!noLoot)
        {
            LootController.instance.EnemyLoot(enemyAI.tier, transform.position);
        }

        Destroy(gameObject, 5f);
    }
 private void AddCastExp(float coverage)
 {
     experienceManager.AddExp(coverage * ExpType.Cast.GetExp());
 }