Exemple #1
0
    private void Awake()
    {
        rb            = GetComponent <Rigidbody>();
        anim          = GetComponent <Animator>();
        levelUpSystem = GetComponent <LevelUpSystem>();
        gameManager   = FindObjectOfType <GameManager>();
        gameManager.setCharacterLevel(levelUpSystem.getCurrentLevel());

        //set experience
        levelUpSystem.addEp(gameManager.GetStoredExperience());
        //set level
        gameManager.setCharacterLevel(levelUpSystem.getCurrentLevel());
    }
Exemple #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Crystal")
        {
            Crystal crystal = other.transform.GetComponent <Crystal> ();

            //increase Score
            gameManager.IncreaseScore(crystal.GetValue());

            //simple levelUpSystem: add ep
            bool islevelUp = levelUpSystem.addEp(crystal.GetValue());

            //if level up
            if (islevelUp)
            {
                execLevelUpEffekt();
                //update ui
                gameManager.setCharacterLevel(levelUpSystem.getCurrentLevel());
            }

            //store ep(level) on disk
            int currentEp = levelUpSystem.getCurrentEp();
            gameManager.SetStoredExperience(currentEp);

            //debuff
            if (crystal.GetValue() < 0)
            {
                runSpeed = 4;
                //after 2sec, the running speed is reset
                Invoke("resetRunSpeed", 2.0f);
            }

            //zerstört Kristall
            crystal.DestroyWithEffect();
        }
    }