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";
        }
    }
Beispiel #2
0
    void Start()
    {
        player   = FindObjectOfType <PlayerEngine>().gameObject;
        strSkill = player.GetComponent <StrengthSkill>();
        defSkill = player.GetComponent <DefenseSkill>();
        magSkill = player.GetComponent <MagicSkill>();
        theQM    = FindObjectOfType <QuestManager>();
        theDM    = FindObjectOfType <DialogManager>();
        pDef     = DefenseSkill.defLvl;
        bossAnim = transform.GetChild(0).GetComponent <Animator>();

        nameO = "Ezekiel";
    }
Beispiel #3
0
    void Start()
    {
        if (!exists)
        {
            exists = true;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        transform.position = player.transform.position;
        aiPath             = player.GetComponent <AIPath>();
        strSkill           = player.GetComponent <StrengthSkill>();
        defSkill           = player.GetComponent <DefenseSkill>();
    }
Beispiel #4
0
    void Start()
    {
        anim = gameObject.transform.GetChild(0).GetComponent <Animator>();

        foreach (Transform child in transform)
        {
            if (child.CompareTag("Enemy"))
            {
                eHealth     = 10f;
                eSpeed      = 0.5f;
                eCoinReward = 5;
                eDefense    = 3f;
                eStrength   = 1f;
                eRange      = 5.75f;
                roamRange   = 1.5f;
                coolDown    = 3f;
                eWeak       = 2;
                ePower      = 0;
                questName   = "Enemy";
                Aggro       = false;
            }
            else if (child.CompareTag("Chicken"))
            {
                eHealth     = 3f;
                eSpeed      = 0.75f;
                eCoinReward = 2;
                eDefense    = 1f;
                eStrength   = 1f;
                eRange      = 3f;
                roamRange   = 4f;
                coolDown    = 2f;
                questName   = "Chicken";
                Aggro       = false;
            }
            else if (child.CompareTag("Zombie"))
            {
                eHealth     = 10f;
                eSpeed      = 0.3f;
                eCoinReward = 15;
                eDefense    = 5f;
                eStrength   = 5f;
                eRange      = 5.75f;
                roamRange   = 4f;
                coolDown    = 3f;
                eWeak       = 2;
                ePower      = 0;
                questName   = "Zombie";
                Aggro       = true;
            }
            else if (child.CompareTag("Skeleton"))
            {
                eHealth     = 15f;
                eSpeed      = 0.75f;
                eCoinReward = 20;
                eDefense    = 7f;
                eStrength   = 7f;
                eRange      = 5.75f;
                roamRange   = 8f;
                coolDown    = 1f;
                eWeak       = 0;
                ePower      = 2;
                questName   = "Skeleton";
                Aggro       = true;
            }
            else if (child.CompareTag("Goblin"))
            {
                eHealth     = 20f;
                eSpeed      = 0.6f;
                eCoinReward = 50;
                eDefense    = 15f;
                eStrength   = 15f;
                eRange      = 3.75f;
                roamRange   = 5f;
                coolDown    = 2f;
                eWeak       = 1;
                ePower      = 0;
                questName   = "Goblin";
                Aggro       = false;
            }
        }

        player = GameObject.FindGameObjectWithTag("Player");

        eTar         = Instantiate(eTarget, transform.position, Quaternion.identity).GetComponent <RoamTarget>();
        eTar.spawner = spawner;
        eTar.enemy   = gameObject;

        aiPath      = GetComponent <AIPath>();
        theQM       = FindObjectOfType <QuestManager>();
        theDM       = FindObjectOfType <DialogManager>();
        spawnScript = spawner.GetComponent <SpawnEnemy>();
        strSkill    = player.GetComponent <StrengthSkill>();
        defSkill    = player.GetComponent <DefenseSkill>();
        magSkill    = player.GetComponent <MagicSkill>();

        nAggro       = Aggro;
        countDown    = coolDown;
        startPos     = transform.position;
        aiPath.speed = eSpeed;
        roaming      = true;
        pDef         = DefenseSkill.defLvl;
    }