void testMSIBallErf()
    {
        try {
            ExternalComponentLibrary library = ErfContext.GetInstance().LoadComponentLibrary("MSIBallErf.dll");
            if (library == null)
            {
                Debug.LogError("Could not load MSIBallErf library");
                return;
            }
        } catch (Exception e)
        {
            Debug.Log(e.Message);
            return;
        }
        //init:
        ExternalExpert msiBallEmotionModel = ErfContext.GetInstance().FindExpert("MSIBallEmotionModel");
        CharacterModel playerModel         = new CharacterModel();

        playerModel.RegisterExpert(msiBallEmotionModel);


        //collision:
        EecEvent timeElapsedEvent = new EecEvent((int)GameEvent.STD_TIME_ELAPSED);

        timeElapsedEvent.AddValue("NO_OF_COLLISIONS", Variant.Create(2));
        timeElapsedEvent.AddValue("CURRENT_SPEED", Variant.Create(7.0f));
        playerModel.HandleEvent(timeElapsedEvent);

        //odpowiedz z erf
        float fear = playerModel.GetEmotionVector().GetValue(OccEmotions.FEAR).AsFloat();

        //przeliczenie na poziom trudnosci
        if (fear > 0.0f)
        {
            Debug.Log("FIRST I WAS AFRAID, I WAS PETRIFIED!");
        }
        else
        {
            Debug.Log("I AM FEARLESS! I AM DEATH! I AM FIRE!");
        }
    }
    void FixedUpdate()
    {
        float fac;
        //transition scale
        float curScale = transform.localScale.x;
        float newScale = 0.05f * (targetScale - curScale) + curScale;

        transform.localScale = new Vector3(newScale, newScale, newScale);
        //
        if (gameSettings.gameMode == GameMode.EMOTIONAL)
        {
            //erf
            DateTime now = DateTime.Now;

            if ((now - lastReportTime).TotalMilliseconds >= interval)//czy należy rozpatrzeć zmianę emocji?
            {
                lastReportTime = now;
                //tutaj wysyłamy emocję
                EecEvent timeElapsedEvent = new EecEvent((int)GameEvent.STD_TIME_ELAPSED);
                timeElapsedEvent.AddValue("NO_OF_COLLISIONS", Variant.Create(scoreController.buffer.movingScore));
                timeElapsedEvent.AddValue("CURRENT_SPEED", Variant.Create(zSpeed));
                playerModel.HandleEvent(timeElapsedEvent);
                //odpowiedz z erf
                float fear = playerModel.GetEmotionVector().GetValue(OccEmotions.FEAR).AsFloat();
                //adaptacyjny zakres
                if (fear < minFear)
                {
                    minFear = fear;
                }
                else if (fear > maxFear)
                {
                    maxFear = fear;
                }

                float fearLength = maxFear - minFear;
                float fearRatio  = (fear - minFear) / fearLength;
                if (fearRatio < 0.1f)
                {
                    setDifficultyEnum(GameDifficulty.HARD);
                }
                else if (fearRatio < 0.4)
                {
                    setDifficultyEnum(GameDifficulty.MEDIUM);
                }
                else
                {
                    setDifficultyEnum(GameDifficulty.EASY);
                }
                Debug.LogFormat("ratio: {0} [{1}  -  {2}  -  {3}", fearRatio, minFear, fear, maxFear);
            }
        }
        else
        {
            //nie zmieniamy poziomu trudności
        }

        if (Input.GetKeyDown("escape"))//wychodzimy do menu?
        {
            Application.LoadLevel("MainMenuScene");
        }


        //obsługa poruszania kulą przez użytkownika
        float moveHorizontal = Input.GetAxis("Horizontal");

        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal / difficulty, 0.0f, zSpeed);

        rb.AddForce(movement * speed);
        distanceTraveled = transform.localPosition.z;
        updateSpeed();
    }