Ejemplo n.º 1
0
    void Start()
    {
        instance         = this;
        basicAttack      = GetComponent <BossMovement>();
        bossAbility      = GetComponent <BossAbility>();
        bossDefense      = GetComponent <BossDefense>();
        bossResources    = GetComponentInParent <ResourceManager>();
        bossAgent        = GetComponent <NavMeshAgent>();
        disablingScripts = false;
        bossAnim         = GetComponent <Animator>();

        p_MaxHp       = 100;
        p_CurrentHP   = p_MaxHp;
        _pHealth.text = "p_Health: " + p_CurrentHP;
        p_EstimateHP  = 0;
        playerIsAlive = true;

        cdOne                 = 0;
        cdTwo                 = 0;
        cdThree               = 0;
        primaryUpgradeCount   = 0;
        defensiveUpgradeCount = 0;
        choice                = 0;

        attackDetected = false;
        this.enabled   = false;
    }
Ejemplo n.º 2
0
    private void NextAbility()
    {
        if (checkIfAlive)
        {
            if (abilityIndex > abilities.Length - 1)
            {
                abilityIndex = 0;
            }
            BossAbility ability = abilities[abilityIndex];
            abilityIndex++;

            if (ability.objectsToActivate.Length > 0)
            {
                for (int i = 0; i < ability.objectsToActivate.Length; i++)
                {
                    ability.objectsToActivate[i].SetActive(true);
                }
            }

            if (ability.animationNameToPlay != "")
            {
                anim.Play(ability.animationNameToPlay);
            }

            StartCoroutine(EndAbility(ability));
        }
    }
Ejemplo n.º 3
0
    private IEnumerator EndAbility(BossAbility ability)
    {
        yield return(new WaitForSeconds(ability.abilityDuration));

        if (ability.objectsToActivate.Length > 0)
        {
            for (int i = 0; i < ability.objectsToActivate.Length; i++)
            {
                ability.objectsToActivate[i].SetActive(false);
            }
        }
        yield return(new WaitForSeconds(ability.DurationUntilEnd));

        NextAbility();
    }
Ejemplo n.º 4
0
    IEnumerator SpawnObject(float seconds)
    {
        //    Debug.Log("Waiting for " + seconds + " seconds");

        yield return(new WaitForSeconds(seconds));


        Vector3 V         = new Vector3(transform.position.x, Random.Range(-3.0f, 2.0f));
        Vector3 V_flaying = new Vector3(transform.position.x, Random.Range(2.0f, 5f));
        //   Random randomSp = new Random();

        int i = Random.Range(1, 4);//parenka prieša

        //     Debug.Log("iiiiiiiiiiiiiiiiii" + i + " seconds");//test

        if (level % 10 == 0)
        {
            Vector3     V_Boss    = new Vector3(-12, 1, 0);
            GameObject  enemyBoss = Instantiate(enemyPrefabBoss, V_Boss, transform.rotation);
            BossAbility B         = enemyBoss.GetComponent <BossAbility>();
            B.enemy_HP        += BossHPBuff * level / 2;
            B.curent_enemy_hp += BossHPBuff * level / 2;
            leftToSpawn        = 0;//one less enemy left
            currentlyAlive++;
        }
        else
        {
            switch (i)
            {
            case 1:
                GameObject enemySlow = (GameObject)Instantiate(enemyPrefab, V, transform.rotation);
                Enemy      e1        = enemySlow.GetComponent <Enemy>();
                e1.enemySpeed      += slowSpeedBuff;
                e1.enemy_HP        += slowHPBuff;
                e1.curent_enemy_hp += slowHPBuff;

                break;

            case 2:
                GameObject enemyFast = Instantiate(enemyPrefab1, V, transform.rotation);
                Enemy      e2        = enemyFast.GetComponent <Enemy>();
                e2.enemySpeed      += fastSpeedBuff;
                e2.enemy_HP        += fastHPBuff;
                e2.curent_enemy_hp += fastHPBuff;
                break;

            case 3:
                GameObject enemyFlying = Instantiate(enemyPrefab2, V_flaying, transform.rotation);
                Enemy      e3          = enemyFlying.GetComponent <Enemy>();
                e3.enemySpeed      += flyingSpeedBuff;
                e3.enemy_HP        += flyingHPBuff;
                e3.curent_enemy_hp += flyingHPBuff;
                break;
            }

            leftToSpawn--;//one less enemy left
            currentlyAlive++;
            //We've spawned, so now we could start another spawn
        }
        isSpawning = false;
    }