Example #1
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (bossStage == 0 && collision.CompareTag(Tags.PLAYER))
     {
         bossStage        = 1;
         dialog           = gameObject.AddComponent <RpgDialog>();
         dialog.onFinish += FinishDialog;
         dialog.Activate(TextManager.GetText("nightbar_boss_text"), bossName, bossTextGO);
         AudioManager.GetInstance().StopAllMusic();
         target.GetComponent <PlatformerMovement2D>().SetCanMove(false);
     }
 }
Example #2
0
    private void Start()
    {
        var movementText = InputManager.keyboardConfig[GameCommand.RIGHT].ToString() + ": "
                           + TextManager.GetText("move right") + "\n"
                           + InputManager.keyboardConfig[GameCommand.LEFT].ToString() + ": "
                           + TextManager.GetText("move left");

        dialog.Activate(movementText, dialogBox);
        target.GetComponent <PlatformerMovement2D>().SetCanMove(false);
    }
Example #3
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (bossStage == 0 && collision.gameObject.GetComponent <DamageReceiver>())
     {
         bossStage        = 1;
         lastBossTick     = Time.time;
         dialog           = gameObject.AddComponent <RpgDialog>();
         dialog.onFinish += () => { bossStage++; };
         dialog.Activate(TextManager.GetText("peter_boss_text"), TextManager.GetText("peter_boss_name"), bossTextGO);
         GameState.GetInstance().isCameraLocked = true;
         platform.GetComponent <MoveVertically>().enabled = true;
         target.GetComponent <PlatformerMovement2D>().SetCanMove(false);
     }
 }
Example #4
0
    protected void FixedUpdate()
    {
        if (!GameState.isGameLocked)
        {
            // Check water position (easier than messing with rigidbodys as I have the game right now...)
            if (waters.Count > 0)
            {
                UpdateWaters();
            }

            // Move the collider behind Nun for camera trickery.
            if (bossStage == 0)
            {
                if (target.transform.position.x > nunPrevPos)
                {
                    block.transform.Translate(new Vector2(target.transform.position.x - nunPrevPos, 0f));
                    nunPrevPos = target.transform.position.x;
                }
            }

            // Pablo's dialog finishes, pray ensues.
            if (bossStage == 2)
            {
                target.GetComponent <PlatformerMovement2D>().BossPray();
                prayStart = Time.time;
                bossStage++;
            }

            // Finish praying.
            if (bossStage == 3 && Time.time - prayStart >= 1.6f)
            {
                block.transform.localPosition = blockPos;
                target.GetComponent <PlatformerMovement2D>().SetCanMove(true);
                GameState.activatingBoss = false;
                GameState.bossActive     = true;
                AudioManager.GetInstance().SetFinalBossSongPastIntro();
                if (pablo != null)
                {
                    pablo.GetComponent <BossEntity>().Activate();
                }
                lastBossTick = 0;
                bossStage++;
            }

            // Pablo is dead. The stage is increased from PeterChurches component event call.
            if (bossStage == 5)
            {
                Destroy(pablo);
                InstanceWaters();
                shooter1.SetActive(true);
                lastBossTick = Time.time;
                platform.GetComponent <MoveVertically>().enabled = false;
                bossStage++;
            }

            // Move the platform to the proper middle position for the next phase.
            if (bossStage == 6)
            {
                // Check that the platform is in the proper position.
                var p = platform.transform.position;
                if (Math.Abs(p.x - phase2platformPos.x) < 0.05f &&
                    Math.Abs(p.y - phase2platformPos.y) < 0.05f
                    )
                {
                    bossStage++;
                }
                else
                {
                    // Uglier than hitting a father with a sweated sock
                    platform.transform.position = Vector2.MoveTowards(platform.transform.position, phase2platformPos, 0.01f);
                }
            }

            // Spawn Leninface. TODO: Add animation.
            if (bossStage == 7 && Time.time - lastBossTick > 0.8f)
            {
                bossStage++;
                lastBossTick = Time.time;
                leninface    = Instantiate(leninface, new Vector2(9.79f, -1.5f), Quaternion.identity);
                leninface.GetComponent <Leninface>().onDeathEvent += onBossDeath;
                platform.AddComponent <MoveHorizontally>();
                target.GetComponent <PlatformerMovement2D>().SetCanMove(false);
                dialog.Activate(TextManager.GetText("lenin_boss_text"), TextManager.GetText("lenin_boss_name"), bossTextGO);
            }

            // Finish Lenin's dialog
            if (bossStage == 9)
            {
                target.GetComponent <PlatformerMovement2D>().SetCanMove(true);
                leninface.GetComponent <BossEntity>().Activate();
                bossStage++;
            }

            // This stage is activated by Leninface's death event.
            if (bossStage == 11)
            {
                bossStage++;
                InstanceWaters();
                shooter1.SetActive(false);
                lastBossTick = Time.time;
                if (GameState.difficulty == Difficulty.EXTREME)
                {
                    platform.GetComponent <FireCircleShot>().Shoot();
                }
                // Deactivating or deleting it if the player is on it causes the engine to make the player disappear.
                platform.AddComponent <FallDown>();
                platform.GetComponent <FallDown>().Touch();
            }

            // Spawn Marx-X and add dialog.
            if (bossStage == 12 && Time.time - lastBossTick > 0.8f)
            {
                bossStage++;
                lastBossTick = Time.time;
                marxex       = Instantiate(marxex, new Vector2(3.54f, -1.1514f), Quaternion.identity);
                marxex.GetComponent <Marxex>().onDeathEvent += onBossDeath;
            }

            // Move Marx-Ex to screen.
            if (bossStage == 13)
            {
                if (marxex.transform.position.y > -4.4f)
                {
                    marxex.transform.Translate(new Vector2(0f, -0.07f));
                }
                else
                {
                    bossStage = 14;
                    dialog.Activate(TextManager.GetText("marxex_boss_text"), TextManager.GetText("marxex_boss_name"), bossTextGO);
                }
            }

            // Activate Marx-X
            if (bossStage == 15)
            {
                bossStage++;
                lastBossTick = Time.time;
                marxex.GetComponent <BossEntity>().Activate();
            }

            // Marx-X shoots flames.
            if (bossStage == 16 && Time.time - lastBossTick > 2f)
            {
                // Cambiar de lado
                lastBossTick             = Time.time;
                flame.transform.position = odd? flamePos : flamePosRight;
                if (odd)
                {
                    flame.transform.localScale = new Vector2(2, 2);
                }
                else
                {
                    flame.transform.localScale = new Vector2(-2, 2);
                }
                flame.GetComponent <Rigidbody2D>().velocity        = Vector2.zero;
                flame.GetComponent <Rigidbody2D>().angularVelocity = 0f;
                flame.SetActive(true);
                flame.GetComponent <Rigidbody2D>().AddForce((odd ? Vector2.right : Vector2.left) * 250f);
                flame.GetComponent <MarxFlame>().ResetFlame();
                odd = !odd;
            }

            // Accessed from Marx-X's event, prepare for the last part.
            // We add Jesus dialog.
            if (bossStage == 17)
            {
                bossStage++;
                lastBossTick = Time.time;
                Destroy(flame);
                dialog.Activate(TextManager.GetText("jesus_boss_text"), TextManager.GetText("jesus_boss_name"), bossTextGO);
            }

            if (bossStage == 19)
            {
                InstanceWaters();
                jesus = Instantiate(jesus, jesusSpawnPos, Quaternion.identity);
                jesus.GetComponent <Jesus>().onDeathEvent += onBossDeath;
                jesusHands = Instantiate(jesusHands, jesusHandsPos, Quaternion.identity);
                bossStage++;
            }

            // Jesus activation.
            if (bossStage == 20)
            {
                bossStage++;
                lastBossTick = Time.time;
                jesus.GetComponent <BossEntity>().Activate();
            }

            // Move Jesus up so he's slowly shown. Then, his hands.
            if (bossStage == 21)
            {
                if (jesus.transform.position.y < -5.28f)
                {
                    jesus.transform.Translate(new Vector2(0f, 0.03f));
                }
                else
                {
                    bossStage++;
                }
            }

            if (bossStage == 22)
            {
                if (jesusHands.transform.position.y < -5.28f)
                {
                    jesusHands.transform.Translate(new Vector2(0f, 0.03f));
                }
                else
                {
                    // I don't really like this but meh.
                    jesusLeftHand  = jesusHands.transform.GetChild(0).gameObject;
                    jesusRightHand = jesusHands.transform.GetChild(1).gameObject;
                    jesus.GetComponent <Jesus>().AssignHands(jesusLeftHand, jesusRightHand);
                    bossStage++;
                }
            }

            // When Jesus is dead
            if (bossStage == 24)
            {
                Destroy(jesusHands);
                Instantiate(explosion, new Vector2(4.2f, -3.02f), Quaternion.identity);
                lastBossTick = Time.time;
                bossStage++;
            }

            if (bossStage == 25 && Time.time - lastBossTick > 0.1f)
            {
                Instantiate(explosion, new Vector2(7.76654f, -3.450294f), Quaternion.identity);
                lastBossTick = Time.time;
                bossStage++;
            }

            if (bossStage == 26 && Time.time - lastBossTick > 0.1f)
            {
                Instantiate(explosion, new Vector2(4.739439f, -5.453946f), Quaternion.identity);
                lastBossTick = Time.time;
                bossStage++;
            }

            if (bossStage == 27 && Time.time - lastBossTick > 0.1f)
            {
                Instantiate(explosion, new Vector2(7.290853f, -5.064747f), Quaternion.identity);
                lastBossTick = Time.time;
                bossStage++;
            }

            if (bossStage == 28 && Time.time - lastBossTick > 0.1f)
            {
                Instantiate(explosion, new Vector2(6.267404f, -3.695344F), Quaternion.identity);
                lastBossTick = Time.time;
                bossStage++;
            }

            if (bossStage == 29)
            {
                var blackBg = GameObject.Find("black_bg");
                AudioManager.GetInstance().FinalBossSongFinished();
                if (blackBg != null)
                {
                    blackBg.AddComponent <EndAct>();
                    blackBg.GetComponent <EndAct>().act = 3;
                }
                bossStage++;
            }
        }
    }