Ejemplo n.º 1
0
    IEnumerator StateSwitch(float timeTillStateChange)
    {
        timeTillStateChange = Random.Range(0, maxTimeBetweenStates);
        currentRunTime     += Time.deltaTime;

        if (bossStage == BossStages.Stage1)
        {
            if (currentRunTime <= timeTillStateChange && damageDealt)
            {
                currentRunTime += attackProbabilityBooster;                                                      //does not attack, raise probability nothing happens
            }
            else if (currentRunTime >= timeTillStateChange)
            {
                Stage1CurrentState = S1BossStates.S1Attacking;                                            //attacks, repeat
            }
        }

        else if (bossStage == BossStages.Stage2)
        {
            if (currentRunTime <= timeTillStateChange && damageDealt)
            {
                currentRunTime += attackProbabilityBooster;                                                      //does not attack, raise probability nothing happens
            }
            else if (timeTillStateChange >= currentRunTime)
            {
                Stage2CurrentState = S2BossStates.S2Attacking;                                            //attacks, repeat
            }
        }

        yield return(null);
    }
Ejemplo n.º 2
0
    IEnumerator SlamAttack()
    {
        isSlamming = true;
        isTrackingPlayerPosition = false;
        timeHoldingSlam          = 0;

        while (true)
        {
            anim.SetBool("SlamAttack", true);

            timeHoldingSlam += Time.deltaTime;

            if (timeHoldingSlam >= timeToHoldSlam) // If Kali has held long enough...
            {
                if (activeSlamSide == rightMapDetectionCollider)
                {
                    slamRightCollider.gameObject.SetActive(true);
                    slamLeftCollider.gameObject.SetActive(false);
                }

                if (activeSlamSide == leftMapDetectionCollider)
                {
                    slamLeftCollider.gameObject.SetActive(true);
                    slamRightCollider.gameObject.SetActive(false);
                }

                anim.SetBool("SlamAttack", false);
                currentPlayerActiveSideCollider.SendMessage("Slamming");

                Stage1CurrentState = S1BossStates.S1Idle;
                Stage2CurrentState = S2BossStates.S2Idle;

                isTrackingPlayerPosition = true;
                isSlamming = false;

                yield return(new WaitForSeconds(2));

                slamLeftCollider.gameObject.SetActive(false);
                slamRightCollider.gameObject.SetActive(false);
                yield break; //...stop the coroutine
            }

            yield return(null); // Otherwise, continue next frame
        }
    }
Ejemplo n.º 3
0
    void StateSwitching()
    {
        if (Input.GetKeyDown(KeyCode.J))
        {
            if (bossStage == BossStages.Stage1)
            {
                Stage1CurrentState = S1BossStates.S1Attacking;
            }
            else if (bossStage == BossStages.Stage2)
            {
                StartCoroutine(LaserEyeBeam());                                     //Stage2CurrentState = S2BossStates.S2Attacking;
            }
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            if (bossStage == BossStages.Stage1)
            {
                Stage1CurrentState = S1BossStates.S1Idle;
            }
            else if (bossStage == BossStages.Stage2)
            {
                StartCoroutine(MoveToSweepAttackLocation());                                     //Stage2CurrentState = S2BossStates.S2Idle;
            }
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            if (bossStage == BossStages.Stage1)
            {
                Stage1CurrentState = S1BossStates.S1Dead;
            }
            else if (bossStage == BossStages.Stage2)
            {
                StartCoroutine(SlamAttack());                                     //Stage2CurrentState = S2BossStates.S2Dead;
            }
        }
    }