Esempio n. 1
0
    void Start()
    {
        _countdownText.enabled = false;
        _boss         = GameObject.Find("Game Manager").GetComponent <BossStage>();
        _continue     = GameObject.Find("Continue_B").GetComponent <Button>();
        _circleEnergy = GameObject.Find("CircleEnergy").GetComponent <Image>();
        bolts_T       = GameObject.Find("Bolts").GetComponent <Text>();
        _counter      = GameObject.Find("Text_M").GetComponent <Text>();
        _progressBar  = GameObject.Find("ProgressSlider_M").GetComponent <Slider>();
        _lives        = GameObject.Find("Lives").GetComponent <Text>();
        _playerS      = GameObject.Find("Player").GetComponent <Player>();

        _continue.onClick.AddListener(Continued);
        ResumeB.onClick.AddListener(Resume);
        RestartB.onClick.AddListener(Restart);
        ExitB.onClick.AddListener(Exit);
        HowB.onClick.AddListener(How);

        if (!PlayerPrefs.HasKey("Check"))
        {
            Time.timeScale = 0;
            escLocked      = true;
            _HowToPlayPanel.SetActive(true);
        }
        else if (PlayerPrefs.HasKey("Check"))
        {
            _HowToPlayPanel.SetActive(false);
        }

        if (PlayerPrefs.HasKey("_Hs"))
        {
            _hs.text = PlayerPrefs.GetInt("_Hs") + " :Highscore";
        }
    }
Esempio n. 2
0
    private void ChangeBossStage()
    {
        switch (vulture.health)
        {
        case 2:
            bossStage = BossStage.STAGE2;
            vultureMovement.ForceMoveToDefaultPosition();
            break;

        case 1:
            bossStage = BossStage.STAGE3;
            vultureMovement.ForceMoveToShootingPosition();
            break;

        case 0:
            bossStage = BossStage.STAGE4;
            //Open door to leave
            canAttack = false;
            vulture.gameObject.GetComponent <Collider2D>().enabled = false;
            ExitDoor.GetComponent <Door>().OpenDoor();
            FinishBoss();
            break;
        }

        AttackCooldown(2.0f);
    }
Esempio n. 3
0
    public void EvaluateBossStage()
    {
        float healthPercent = currHealth / MaxHealth;

        if (healthPercent > 0.75f)
        {
            currentStage = BossStage.First;
            OnNewBossStage();
        }
        else if (healthPercent > 0.5f && healthPercent <= 0.75f)
        {
            currentStage = BossStage.Second;
            OnNewBossStage();
        }
        else if (healthPercent > 0.25f && healthPercent <= 0.5f)
        {
            currentStage = BossStage.Third;
            OnNewBossStage();
        }
        else if (healthPercent <= 0.25f)
        {
            currentStage = BossStage.Final;
            OnNewBossStage();
        }
        UpdatetageTrigger();
    }
Esempio n. 4
0
    public void GoToNextPhase()
    {
        switch (actualStage)
        {
        case BossStage.PHASE1:
            actualStage   = BossStage.TOPHASE21;
            lastPhase1Pos = transform.position;
            break;

        case BossStage.PHASE2:
            actualStage = BossStage.TOPHASE3;
            break;

        case BossStage.PHASE3:
            actualStage = BossStage.TOPHASE4;
            break;

        case BossStage.PHASE4:
            thirdPhaseBoss.SetActive(true);
            thirdPhaseBoss.GetComponent <ThirdBossStage>().enabled = true;

            // StartLastSection
            //GameObject.FindGameObjectWithTag("Player").GetComponent<SwitchablePlayerController>().isEnding = true;
            //GameObject.FindGameObjectWithTag("UI_InGame").GetComponent<ChangeScene>().shutdown = true;
            break;
        }
    }
Esempio n. 5
0
    //----------------------------------------

    //-------- Stage 4 boss AI ---------------


    //----------------------------------------

    //-------- Switch Stage ------------------

    //switch stages for boss
    void StageSwitch()
    {
        if (currentStage == BossStage.Stage0 & isShowUp)
        {
            currentStage++;
            Debug.Log("In stage switch: switch stage 0 to stage 1");
        }

        if (currentStage == BossStage.Stage1 & enemiesS1.Count == 0 & currentS1emermy == null)
        {
            currentStage  = BossStage.Stage2;
            isEnterStage2 = true;
            crackdown.SetActive(true);
            Debug.Log("In stage switch: switch stage 1 to stage2");
        }

        if (currentStage == BossStage.Stage2 & stage2HP == 0)
        {
            currentStage = BossStage.Stage3;
            Debug.Log("In stage switch: switch stage 2 to stage3");
        }

        if (currentStage == BossStage.Stage3 & stage3HP <= 0)
        {
            currentStage = BossStage.End;
            Debug.Log("Congratulations");
        }
    }
Esempio n. 6
0
    public void BossHitHard()
    {
        Destroy(currentBossStage.gameObject);

        currentBossStage = Instantiate(currentBossStageSlot.go_BossStageHard, new Vector3(0, 0, 0), Quaternion.identity).GetComponent <BossStage>();

        go_Player.SetActive(true);
    }
Esempio n. 7
0
    public virtual void Die()
    {
        bossStage = BossStage.DIE;
        ManagerObject.Instance.RenderCoin(ObjectType.COIN, transform.position, 80, true);
        Level.Instance.SetStage();

        //PoolObject.Instance.DespawnObject(gameObject.transform, "Enemy");
        Destroy(gameObject);
    }
Esempio n. 8
0
    public void BeginNewStage(BossStage stage)
    {
        currentAttackCycle.Clear();
        currentStageData = GetStageData(stage);

        if (currentStageData != null)
        {
            currentStageData.SetUpData();

            foreach (AttackPatternData attackData in currentStageData.AttackPatternData)
            {
                attackData.AttackPattern.playerTransform = playerTransform;
                if (attackData.AttackPattern as PheremoneBlast)
                {
                    if (!pheremoneBlast.gameObject.activeSelf)
                    {
                        pheremoneBlast.gameObject.SetActive(true);
                    }
                    pheremoneBlast.SetUpAbilityData(attackData);


                    currentAttackCycle.Add(pheremoneBlast);
                }
                else if (attackData.AttackPattern as SendSoldiers)
                {
                    if (!sendSoldiers.gameObject.activeSelf)
                    {
                        sendSoldiers.gameObject.SetActive(true);
                    }
                    sendSoldiers.SetUpAbilityData(attackData);
                    currentAttackCycle.Add(sendSoldiers);
                }
                else if (attackData.AttackPattern as AttackDrones)
                {
                    if (!attackDrones.gameObject.activeSelf)
                    {
                        attackDrones.gameObject.SetActive(true);
                    }
                    attackDrones.SetUpAbilityData(attackData);
                    currentAttackCycle.Add(attackDrones);
                }
            }

            if (currentStageData.MaxCycleTime > 0)
            {
                foreach (BaseAttackPattern attackPattern in currentAttackCycle)
                {
                    attackPattern.AttackEnded += NextAttackPattern;
                }
                StartNewCycleStage();
            }
            else
            {
                StartNewStage();
            }
        }
    }
Esempio n. 9
0
 public void SetUpAbilityData(AttackPatternData patternData)
 {
     stage          = patternData.Stage;
     attackRate     = patternData.AttackRate;
     attackDuration = patternData.AttackDuration;
     attackCoolDown = patternData.Cooldown;
     attackCount    = patternData.AttackCount;
     maxAttackCount = patternData.MaxAttackCount;
 }
Esempio n. 10
0
    private void EnterTransition()
    {
        StopAllCoroutines();
        switch (currentStage)
        {
        case BossStage.First:
            currentStage = BossStage.Transition;
            foreach (BaseAttackPattern baseAttack in currentAttackCycle)
            {
                baseAttack.DisableAttack();
                baseAttack.AttackEnded -= NextAttackPattern;
                baseAttack.gameObject.SetActive(false);
            }
            currentAttackCycle.Clear();
            hiveShield.PlayAnimation("BuildShield");
            break;

        case BossStage.Second:
            currentStage = BossStage.Transition;
            foreach (BaseAttackPattern baseAttack in currentAttackCycle)
            {
                baseAttack.DisableAttack();
                baseAttack.AttackEnded -= NextAttackPattern;
                baseAttack.gameObject.SetActive(false);
            }
            currentAttackCycle.Clear();
            hiveShield.PlayAnimation("BuildShield");
            break;

        case BossStage.Third:
            currentStage = BossStage.Transition;
            foreach (BaseAttackPattern baseAttack in currentAttackCycle)
            {
                baseAttack.DisableAttack();
                baseAttack.AttackEnded -= NextAttackPattern;
                baseAttack.gameObject.SetActive(false);
            }
            sendSoldiers.DisableAttack();
            sendSoldiers.gameObject.SetActive(false);
            currentAttackCycle.Clear();
            hiveShield.PlayAnimation("BuildShield");
            break;

        case BossStage.Final:
            currentStage = BossStage.Transition;
            foreach (BaseAttackPattern baseAttack in currentAttackCycle)
            {
                baseAttack.DisableAttack();
                baseAttack.AttackEnded -= NextAttackPattern;
                baseAttack.gameObject.SetActive(false);
            }
            BossDefeated();
            break;
        }
    }
Esempio n. 11
0
    public void NextPhase()
    {
        //현재 페이즈 스테이지 오브젝트 제거
        Destroy(currentBossStage.gameObject);

        //BossStageHard 생성 후 currentBossStage에 BossStageHard를 할당
        currentBossStage = Instantiate(currentBossStageSlot.go_BossStageHard, new Vector3(0, 0, 0), Quaternion.identity).GetComponent <BossStage>();

        //플레이어 위치 및 색 초기화
        go_Player.SetActive(true);
    }
Esempio n. 12
0
 private BossStageData GetStageData(BossStage stage)
 {
     for (int i = 0; i < stageDatas.Count; i++)
     {
         if (stageDatas[i].Stage == stage)
         {
             return(stageDatas[i]);
         }
     }
     return(null);
 }
Esempio n. 13
0
 void advanceStageIfNeeded(FirstBossComponent cmp, BossStage stage)
 {
     if (cmp.age > stage.TimeLimit)
     {
         if (stages.Count > (cmp.stage + 1))
             cmp.stage = cmp.stage + 1;
         else
         {
             cmp.age = stages[0].TimeLimit;
             cmp.stage = 2;
         }
     }
 }
Esempio n. 14
0
    private void Update()
    {
        if (BossStage == BossStage.Peaceful)
        {
            if (Vector3.Distance(target.transform.position
                                 , transform.position) < 7)
            {
                BossStage = BossStage.First;
                GetComponent <CircleCollider2D>().enabled = true;
                IncludeLamp();
                StartCoroutine(SpawnMonster());
            }
            else
            {
                return;
            }
        }
        else if (health > _maxHealth * (1f / 3f) &&
                 health < _maxHealth * (2f / 3f) &&
                 BossStage != BossStage.Second)
        {
            BossStage = BossStage.Second;
            IncludeLamp();
            animator.SetInteger("Boss", 1);
            StartCoroutine(AttackOnSecondeStage());
        }
        else if (health <= _maxHealth * (1f / 3f) &&
                 BossStage != BossStage.Third)
        {
            BossStage = BossStage.Third;
            animator.SetInteger("Boss", 3);
            GetComponentInChildren <BoxCollider2D>().enabled = true;
            GetComponent <SpriteRenderer>().flipY            = false;
            for (int i = 0; i < 5; i++)
            {
                transform.GetChild(0).SetParent(null);
            }
            transform.position
                = new Vector3(transform.position.x, transform.position.y - 0.8f);
        }

        if (BossStage == BossStage.Third)
        {
            AnimationMove();
            Attack();
            RotateAtTarget();
            agent.SetDestination(target.transform.position);
            Dead();
        }
    }
Esempio n. 15
0
    public void BossHitNormal()
    {
        Destroy(currentBossStage.gameObject);

        if (currentBossStageSlot.bossStageType == BossStageSlot.BossStageType.StageRandom)
        {
            currentBossStage = Instantiate(currentBossStageSlot.go_BossStageNormals[Random.Range(0, currentBossStageSlot.go_BossStageNormals.Length)]
                                           , new Vector3(0, 0, 0), Quaternion.identity).GetComponent <BossStage>();
        }
        else if (currentBossStageSlot.bossStageType == BossStageSlot.BossStageType.Standard)
        {
            currentBossStage = Instantiate(currentBossStageSlot.go_BossStageNormals[0], new Vector3(0, 0, 0), Quaternion.identity).GetComponent <BossStage>();
        }

        currentBossStage.go_BossPrefab.SetActive(true);

        go_Player.SetActive(true);
    }
    /* // 보스 스테이지에서 같은 ColoType의 장애물과 충돌하면 데미지가 1씩 축적된다.
     * public void AddDamage(int _damage = 1)
     * {
     *   if (!isGameOver)
     *   {
     *       damage += _damage;
     *       UIManager.instance.bossStageUI.UpdateDamageText( damage );
     *       UIManager.instance.StarImageChange();
     *   }
     * }*/

    //플레이어가 보스와 충돌했을 때 실행
    public void BossCollision()
    {
        currentBossStageSlot.currentHp -= damage;
        UIManager.instance.bossStageUI.UpdateBossHpText();
        StartCoroutine(UIManager.instance.bossStageUI.UpdateBossHpSliderCoroutine());
        if (currentBossStage.bossStageType == BossStage.BossStageType.Normal)
        {
            if (currentBossStageSlot.currentHp <= currentBossStageSlot.hardHp)
            {
                NextPhase();
            }
            else
            {
                Destroy(currentBossStage.gameObject);
                currentBossStage = Instantiate(currentBossStageSlot.go_BossStageNormal, new Vector3(0, 0, 0), Quaternion.identity).GetComponent <BossStage>();
                go_Player.SetActive(false);
                go_Player.SetActive(true);
                currentBossStageSlot.challengeCount++;
                UIManager.instance.bossStageUI.UpdateChallengeCountText();
            }
        }
        else
        {
            //게임 종료
            if (currentBossStageSlot.currentHp <= 0)
            {
                currentBossStageSlot.currentHp = 0;
                FinishStage();
            }
            else
            {
                Destroy(currentBossStage.gameObject);
                currentBossStage = Instantiate(currentBossStageSlot.go_BossStageHard, new Vector3(0, 0, 0), Quaternion.identity).GetComponent <BossStage>();
                go_Player.SetActive(false);
                go_Player.SetActive(true);
                currentBossStageSlot.challengeCount++;
                UIManager.instance.bossStageUI.UpdateChallengeCountText();
            }
        }
    }
    //Changes the current stage of the spider boss fight
    void ChangeCurrentStage()
    {
        switch (currentState)
        {
        case BossStage.None:
            currentState = BossStage.Stage1;
            return;

        case BossStage.Stage1:
            currentState = BossStage.Stage2;
            return;

        case BossStage.Stage2:
            currentState = BossStage.Stage3;
            return;

        case BossStage.Stage3:
            return;

        default:
            return;
        }
    }
Esempio n. 18
0
    // Add control to deactivate scripts
    public void DebugNextStage()
    {
        switch (actualStage)
        {
        case BossStage.ENTERING:
            actualStage = BossStage.TOPHASE1;
            break;

        case BossStage.TOPHASE1:
            actualStage = BossStage.PHASE1;
            break;

        case BossStage.PHASE1:
            actualStage = BossStage.TOPHASE21;
            break;

        case BossStage.TOPHASE21:
            actualStage = BossStage.PHASE21;
            break;

        case BossStage.PHASE21:
            actualStage = BossStage.TOPHASE22;
            break;

        case BossStage.TOPHASE22:
            actualStage = BossStage.PHASE2;
            break;

        case BossStage.PHASE2:
            actualStage = BossStage.TOPHASE3;
            break;

        case BossStage.TOPHASE3:
            actualStage = BossStage.PHASE3;
            break;
        }
    }
Esempio n. 19
0
    // Update is called once per frame
    void Update()
    {
        switch (actualStage)
        {
        case BossStage.ENTERING:
            lerpTime += Time.deltaTime / timeToMoveEachPhase[0];
            if (Vector3.Distance(transform.position, goToPoints[0].position) > 0.1f)
            {
                transform.position = Vector3.Lerp(initialPos, goToPoints[0].position, lerpTime);
            }
            else
            {
                actualStage = BossStage.TOPHASE1;
                lerpTime    = 0.0f;
            }
            break;

        case BossStage.TOPHASE1:
            lerpTime += Time.deltaTime / timeToMoveEachPhase[1];
            if (Vector3.Distance(transform.position, goToPoints[1].position) > 0.1f)
            {
                transform.position = Vector3.Lerp(goToPoints[0].position, goToPoints[1].position, lerpTime);
            }
            else
            {
                actualStage = BossStage.PHASE1;
                fbs.StartBossPhase();
                lerpTime = 0.0f;
            }
            break;

        case BossStage.TOPHASE21:
            lerpTime += Time.deltaTime / timeToMoveEachPhase[2];
            if (Vector3.Distance(transform.position, goToPoints[2].position) > 0.1f)
            {
                transform.position = Vector3.Lerp(lastPhase1Pos, goToPoints[2].position, lerpTime);
            }
            else
            {
                actualStage = BossStage.PHASE21;
                lerpTime    = 0.0f;
            }
            break;

        case BossStage.PHASE21:
            actualStage = BossStage.TOPHASE22;
            break;

        case BossStage.TOPHASE22:
            lerpTime += Time.deltaTime / timeToMoveEachPhase[3];
            if (Vector3.Distance(transform.position, goToPoints[3].position) > 0.1f)
            {
                transform.position = Vector3.Lerp(goToPoints[2].position, goToPoints[3].position, lerpTime);
            }
            else
            {
                actualStage = BossStage.PHASE2;
                lerpTime    = 0.0f;
            }
            break;

        case BossStage.PHASE2:
            if (!sbs.HasStarted())
            {
                lerpTime += Time.deltaTime / timeToMoveEachPhase[4];
                if (Vector3.Distance(transform.position, goToPoints[4].position) > 0.1f)
                {
                    transform.position = Vector3.Lerp(goToPoints[3].position, goToPoints[4].position, lerpTime);
                }
                else
                {
                    lerpTime = 0.0f;
                    sbs.StartBossPhase();
                }
            }
            break;

        case BossStage.TOPHASE3:
            lerpTime += Time.deltaTime / timeToMoveEachPhase[5];
            if (Vector3.Distance(transform.position, goToPoints[5].position) > 0.1f)
            {
                transform.position = Vector3.Lerp(goToPoints[4].position, goToPoints[5].position, lerpTime);
            }
            else
            {
                actualStage = BossStage.PHASE3;
                lerpTime    = 0.0f;
            }
            break;

        case BossStage.TOPHASE4:
            lerpTime += Time.deltaTime / timeToMoveEachPhase[6];
            if (Vector3.Distance(transform.position, goToPoints[6].position) > 0.1f)
            {
                transform.position = Vector3.Lerp(goToPoints[5].position, goToPoints[6].position, lerpTime);
            }
            else
            {
                actualStage = BossStage.PHASE4;
                lerpTime    = 0.0f;
                GoToNextPhase();
            }
            break;
        }
    }
Esempio n. 20
0
    //-------------------------------

    void Start()
    {
        //enemy_anim = null;
        rb2d         = null;
        defaultStage = BossStage.Stage0;
        currentStage = defaultStage;
        //Debug.Log("Default stage is: " + defaultStage.ToString());

        //------ load prefabs -----------
        chest = (GameObject)Resources.Load("Prefabs/FinalBoss/Stage1/chest");
        //chest.transform.localScale = new Vector3(0.3f, 0.3f, 1.0f);
        if (!chest)
        {
            Debug.Log("Chest prefabs load failed.");
        }

        fireBall = (GameObject)Resources.Load("Prefabs/FinalBoss/Stage2/fireBall");
        if (!fireBall)
        {
            Debug.Log("fire ball not loaded.");
        }

        missle = (GameObject)Resources.Load("Prefabs/FinalBoss/Stage3/missle");
        if (!missle)
        {
            Debug.Log("missle load failed");
        }



        stage3 = (GameObject)Resources.Load("Prefabs/FinalBoss/Stage3/stage3");
        if (!stage3)
        {
            Debug.Log("Stage3 not loaded");
        }

        miniFireball = (GameObject)Resources.Load("Prefabs/FinalBoss/miniFireball");
        if (!miniFireball)
        {
            Debug.Log("mini fire ball not loaded");
        }
        miniFireball.transform.localScale = new Vector3(0.04f, 0.04f, 1.0f);

        e = (GameObject)Resources.Load("Prefabs/Enemy/Runner");
        if (!e)
        {
            Debug.Log("runner not loaded.");
        }

        //-------------------------------

        //------ initialize param--------
        stage2isMove    = false;
        isSmall         = false;
        isEnterStage0   = false;
        showUpDistance  = 0.0f;
        isShowUp        = false;
        isEnterStage2   = false;
        isInStage1Move  = false;
        currentPosition = Random.Range(0, 3);
        fireBallCnt     = 0;
        stage2HP        = 3;
        isFireBall      = false;
        stage3HP        = 6;
        missleCnt       = 0;
        isMissle        = false;
        isstage3Silent  = false;
        isInCrack       = false;

        player = GameObject.FindGameObjectWithTag("Player");
        if (!player)
        {
            Debug.Log("Player not found");
        }
        player.transform.localScale = new Vector3(0.1f, 0.1f, 1.0f);

        s1EnemiesNum = enemiesS1.Count;

        if (s1EnemiesNum == 0)
        {
            Debug.Log("No enemy loaded.");
        }

        crackup.SetActive(false);
        crackdown.SetActive(false);
        shield.SetActive(false);

        phoenix = GetComponent <Animator>();

        //-------- new features ---------------
        dashPlayerPosition  = player.transform.position;
        isFreezeStage       = false;
        isIdle              = true;
        isDash              = false;
        currentBossPosition = gameObject.transform;
        groud = player.transform;
        Debug.Log(groud.position.y);
        groud.position = new Vector3(groud.position.x, groud.position.y + 1.0f, 0);
        Debug.Log(groud.position.y);

        currentDashPosition = wallLeft;


        //-------------------------------------

        //-------------------------------------

        //-------- Inherit from enemy class ---
        defaultState = EnemyState.Idle;
        setState(defaultState);
        health = 1000;
        //-------------------------------------
    }
Esempio n. 21
0
 public virtual void Move()
 {
     bossStage = BossStage.MOVE;
 }
Esempio n. 22
0
 public void StartBossBattle()
 {
     currentStage = BossStage.First;
     OnNewBossStage();
 }
Esempio n. 23
0
 public void SetStage(BossStage newStage)
 {
     stage = newStage;
 }
Esempio n. 24
0
 public virtual void Attack()
 {
     isPause = true;
     bossStage = BossStage.ATTACK;
 }
Esempio n. 25
0
 void SetBossStage(BossStage stage)
 {
     m_bossStage = stage;
 }
Esempio n. 26
0
    void FixedUpdate()
    {
        attackCooldownCounter -= Time.deltaTime;

        if (anim.GetBool("IsAttacking"))
        {
            isWalking = false;
            anim.SetBool("IsMoving", false);
            waitCounter = waitTime;
        }

        if (GetComponent <Enemy_Stats>().enemyCurrentHealth < GetComponent <Enemy_Stats>().enemyMaxHealth / 5)
        {
            BossPhase = BossStage.Beserk;
        }
        else if (GetComponent <Enemy_Stats>().enemyCurrentHealth < GetComponent <Enemy_Stats>().enemyMaxHealth / 2)
        {
            BossPhase = BossStage.Enraged;
        }
        else
        {
            BossPhase = BossStage.Aggrovated;
        }

        switch (BossPhase)
        {
        case BossStage.Aggrovated:
            speed              = 1.2f;
            agroRadius         = 3.25f;
            attackCooldownTime = 3.0f;
            projectileSpacing  = 0.15f;
            waitTime           = 1.0f;
            miniGolems         = 0;
            break;

        case BossStage.Enraged:
            speed              = 1.35f;
            agroRadius         = 3.35f;
            attackCooldownTime = 2.75f;
            projectileSpacing  = 0.05f;
            waitTime           = 0.65f;
            miniGolems         = 1;
            break;

        case BossStage.Beserk:
            speed              = 1.7f;
            agroRadius         = 3.5f;
            attackCooldownTime = 2.5f;
            projectileSpacing  = 0.01f;
            waitTime           = 0.0f;
            miniGolems         = 4;
            break;
        }

        //If Boss Phase contains mini golems and has not spawned total number, spawn them
        if (miniGolemsSpawned != miniGolems)
        {
            GameObject miniGolem = Instantiate(miniGolemPrefab, transform.position, Quaternion.identity);

            //Set parent to Golem Boss
            miniGolem.transform.SetParent(this.transform);
            miniGolem.name = "Mini Golem " + miniGolemsSpawned;
            miniGolemsSpawned++;
        }

        //If spike attack started, instantiate spikes with spacing and in order
        if (AttackInProgress)
        {
            projectileCounter -= Time.deltaTime;

            switch (BossPhase)
            {
            //Tier 1
            case BossStage.Aggrovated:
                if (projectiles_fired == 0 && projectileCounter < projectileSpacing * 8f)
                {
                    Instantiate(projectile, xPosition + offset * 1.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 1 && projectileCounter < projectileSpacing * 7f)
                {
                    Instantiate(projectile, xPosition + offset * 1.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 2 && projectileCounter < projectileSpacing * 6f)
                {
                    Instantiate(projectile, xPosition + offset * 2.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 3 && projectileCounter < projectileSpacing * 5f)
                {
                    Instantiate(projectile, xPosition + offset * 2.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 4 && projectileCounter < projectileSpacing * 4f)
                {
                    Instantiate(projectile, xPosition + offset * 3.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 5 && projectileCounter < projectileSpacing * 3f)
                {
                    Instantiate(projectile, xPosition + offset * 3.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 6 && projectileCounter < projectileSpacing * 2f)
                {
                    Instantiate(projectile, xPosition + offset * 4.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 7 && projectileCounter < projectileSpacing * 1f)
                {
                    Instantiate(projectile, xPosition + offset * 4.5f, Quaternion.identity);
                    projectiles_fired++;
                    AttackInProgress = false;
                }
                break;

            case BossStage.Enraged:
                if (projectiles_fired == 0 && projectileCounter < projectileSpacing * 8f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 1.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 1.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 1.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 1.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 1 && projectileCounter < projectileSpacing * 7f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 1.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 1.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 1.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 1.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 2 && projectileCounter < projectileSpacing * 6f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 2.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 2.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 2.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 2.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 3 && projectileCounter < projectileSpacing * 5f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 2.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 2.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 2.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 2.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 4 && projectileCounter < projectileSpacing * 4f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 3.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 3.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 3.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 3.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 5 && projectileCounter < projectileSpacing * 3f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 3.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 3.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 3.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 3.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 6 && projectileCounter < projectileSpacing * 2f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 4.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 4.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 4.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 4.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 7 && projectileCounter < projectileSpacing * 1f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 4.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 4.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 4.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 4.5f, Quaternion.identity);
                    projectiles_fired++;
                    AttackInProgress = false;
                }
                break;

            case BossStage.Beserk:
                if (projectiles_fired == 0 && projectileCounter < projectileSpacing * 8f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 1.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 1.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 1.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 1.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 1 && projectileCounter < projectileSpacing * 7f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 1.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 1.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 1.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 1.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 2 && projectileCounter < projectileSpacing * 6f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 2.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 2.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 2.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 2.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 3 && projectileCounter < projectileSpacing * 5f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 2.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 2.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 2.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 2.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 4 && projectileCounter < projectileSpacing * 4f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 3.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 3.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 3.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 3.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 5 && projectileCounter < projectileSpacing * 3f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 3.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 3.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 3.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 3.5f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 6 && projectileCounter < projectileSpacing * 2f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 4.0f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 4.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 4.0f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 4.0f, Quaternion.identity);
                    projectiles_fired++;
                }
                else if (projectiles_fired == 7 && projectileCounter < projectileSpacing * 1f)
                {
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, offsetNumX) * 4.5f, Quaternion.identity);
                    Instantiate(projectile, (Vector2)transform.position + new Vector2(0, -offsetNumX) * 4.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(offsetNumX, 0) * 4.5f, Quaternion.identity);
                    Instantiate(projectile, xPosition + new Vector2(-offsetNumX, 0) * 4.5f, Quaternion.identity);
                    projectiles_fired++;
                    AttackInProgress = false;
                }
                break;
            }
        }

        if (!anim.GetBool("IsDead"))
        {
            if (!AttackInProgress)
            {
                AttackRadius();
            }

            if (isWalking && !anim.GetBool("IsAttacking"))
            {
                walkCounter -= Time.deltaTime;
                switch (direction_raw)
                {
                case 0:                         //Up
                    rbody.velocity = new Vector2(0, speed);
                    offset         = new Vector2(0, offsetNumY);
                    direction_x    = 0;
                    direction_y    = 1;
                    break;

                case 1:                         //Down
                    rbody.velocity = new Vector2(0, -speed);
                    offset         = new Vector2(0, -offsetNumY);
                    direction_x    = 0;
                    direction_y    = -1;
                    break;

                case 2:                         //Left
                    rbody.velocity = new Vector2(-speed, 0);
                    offset         = new Vector2(-offsetNumX, 0);
                    direction_x    = -1;
                    direction_y    = 0;
                    break;

                case 3:                         //Right
                    rbody.velocity = new Vector2(speed, 0);
                    offset         = new Vector2(offsetNumX, 0);
                    direction_x    = 1;
                    direction_y    = 0;
                    break;
                }
                if (walkCounter < 0)
                {
                    isWalking = false;
                    anim.SetBool("IsMoving", false);
                    waitCounter = waitTime;
                }
            }
            else
            {
                waitCounter   -= Time.deltaTime;
                rbody.velocity = Vector2.zero;
                //If wait counter hits 0, choose new direction and move
                if (waitCounter < 0)
                {
                    RandomDirection();
                }
            }
            anim.SetFloat("Golem_x", direction_x);
            anim.SetFloat("Golem_y", direction_y);
        }
        else
        {
            rbody.velocity = Vector2.zero;
        }
    }