Esempio n. 1
0
    private EnemyModel initEnemy(EnemyModel enemy)
    {
        EnemyModel newEnemy = Instantiate(enemy);

        for (int i = 0; i < enemy.weaponModels.Length; i++)
        {
            WeaponModel newWeaponModel = Instantiate(enemy.weaponModels[i]);
            if (newWeaponModel.GetType().Equals(typeof(MeleeWeaponModel)))
            {
                newWeaponModel.attackDemage = randomValue(1, 10);
            }
            else
            {
                newWeaponModel.attackDemage = randomValue(2, 20);
            }
            newEnemy.weaponModels[i] = newWeaponModel;
        }

        newEnemy.runningSpeed = randomValue(2, 15);
        newEnemy.walkSpeed    = randomValue(2, (int)newEnemy.runningSpeed);
        newEnemy.energy       = randomValue(10, 30);
        newEnemy.health       = randomValue(2, 8);

        return(newEnemy);
    }