示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (interaktableController.getInterakted())
     {
         interaktableController.GetRecourceManager().mediValue += 1;
         Destroy(gameObject);
     }
 }
 private void Update()
 {
     if (interaktableController.getInterakted())
     {
         interaktableController.GetRecourceManager().addRecources(1);
         Destroy(gameObject);
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (currentTimer <= 0)
        {
            currentTimer   = tickTimer;
            currentHealth -= loseLivePerTick;
        }
        else
        {
            currentTimer -= Time.deltaTime;
        }

        if (interaktController.getInterakted())
        {
            interaktController.setInterakted(false);
            int useAbleRecourceAmount = interaktController.GetRecourceManager().useRessource();
            if (useAbleRecourceAmount != 0)
            {
                int brieflyCurrentHealth = currentHealth + 30 * useAbleRecourceAmount;
                if (brieflyCurrentHealth > maxMateHealth)
                {
                    currentHealth = maxMateHealth;
                }
                else
                {
                    currentHealth = brieflyCurrentHealth;
                }
            }
            if (interaktController.GetRecourceManager().mediValue == 3)
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
            }
        }

        if (currentHealth <= 0)
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
    }