Beispiel #1
0
    void Update()
    {
        health.GetComponent <Text>().text = pHealth.ToString() + " / " + pHealthLevel.ToString();

        if (pHealth <= 0)
        {
            AIPath aiPath = GetComponent <AIPath>();
            aiPath.canMove = false;

            StrengthSkill strSkill = GetComponent <StrengthSkill>();
            StrengthSkill.clickOnEnemy = false;
            StrengthSkill.strAtt       = false;
            strSkill.ePos = null;

            DefenseSkill defSkill = GetComponent <DefenseSkill>();
            DefenseSkill.clickOnEnemy = false;
            DefenseSkill.defAtt       = false;
            defSkill.ePos             = null;

            MagicSkill.magTar = null;

            pHealth = Mathf.RoundToInt(0.5f * pHealthLevel);

            transform.position = new Vector3(-0.087f, -6.31f, 0f);

            aiPath.target = transform;

            aiPath.canMove = false;

            //for (int i = 0; i < pHealth; i++)
            //    heart[i].GetComponent<SpriteRenderer>().color = new Color(255, 255, 255, 255);

            theDM.dLines      = new string[1];
            theDM.dLines[0]   = "You have died and respawned back at the village. You have lost 100 coins.";
            theDM.currentLine = 0;
            theDM.ShowDialog();

            StartCoroutine(WaitForDeath());
            PlayerEngine pEng = GetComponent <PlayerEngine>();
            pEng.RespawnPlayer();
        }

        if (countDown <= coolDown)
        {
            countDown += Time.deltaTime;
            if (healSpellButton != null)
            {
                healSpellButton.GetComponentInChildren <Text>().text = (25 - countDown).ToString("0.00");
            }
        }
        else
        if (healSpellButton != null)
        {
            healSpellButton.GetComponentInChildren <Text>().text = "Ready";
        }
    }