Ejemplo n.º 1
0
    void Update()
    {
        if (!paused)
        {
            if (isSinking)
            {
                transform.Translate(-Vector3.up * sinkSpeed * Time.deltaTime);
            }

            timer += Time.deltaTime;
            if (timer >= timeBetweenAttacks && playerInRange && currentHealth > 0)
            {
                if ((face.getHappiness() >= happinessFrom) && (face.getHappiness() <= happinessTo))
                {
                    TakeDamage(40);
                    timer = 0f;
                }
                else
                {
                    if (playerHealth.currentHealth > 0)
                    {
                        playerHealth.TakeDamage(attackDamage);
                    }
                    timer = 0f;
                }
            }
        }
    }
Ejemplo n.º 2
0
 void Update()
 {
     if (face.getHappiness() != -1)
     {
         lightRef.color = g.Evaluate(face.getHappiness());
     }
 }
Ejemplo n.º 3
0
    void Update()
    {
        //timer += Time.deltaTime;
        Debug.Log("|sdfgh");
        if (/*timer >= timeBetweenAttacks &&*/ playerInRange && enemyHealth.currentHealth > 0)
        {
            if (face.getHappiness() >= happinessFrom && face.getHappiness() <= happinessTo)
            {
                enemyHealth.currentHealth = 0;
                // stworek powinien umrzec i dac playerowi punkty
            }
            else
            {
                Attack();
            }
        }


        /*
         * if in range then check smile status
         *
         */
    }
Ejemplo n.º 4
0
    void Update()
    {
        if (paused == false)
        {
            playerHappiness = face.getHappiness();

            if (playerHappiness > 0.25f)
            {
                isPlayerSmiling = true;
            }
            else
            {
                isPlayerSmiling = false;
            }

            timer += Time.deltaTime;
            if (timer >= timeBetweenRegen)
            {
                timer = 0f;
                if (manaSlider.value < 100)
                {
                    manaSlider.value += manaRegen;
                }

                if (isPlayerSmiling)
                {
                    if (manaSlider.value >= manaDepletion)
                    {
                        manaSlider.value -= manaDepletion;
                    }
                    else
                    {
                        manaSlider.value = 0;
                    }
                }
            }
        }
    }