Beispiel #1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.gameObject.CompareTag("Player"))
        {
            PlayerController player = collider.gameObject.GetComponent <PlayerController>();

            PlayerAtomic(player);

            audioPlayer.Play();
            particles.Play();

            toRemove = true;
        }

        if (collider.gameObject.CompareTag("PlayerSnow"))
        {
            PlayeContorollerSnow playerSnow = collider.gameObject.GetComponent <PlayeContorollerSnow>();

            PlayerSnowAtomic(playerSnow);

            audioPlayer.Play();
            particles.Play();

            toRemove = true;
        }

        if (collider.gameObject.CompareTag("PlayerLava"))
        {
            PlayerControllerLava playerLava = collider.gameObject.GetComponent <PlayerControllerLava>();

            PlayerLavaAtomic(playerLava);

            audioPlayer.Play();
            particles.Play();

            toRemove = true;
        }


        if (collider.gameObject.CompareTag("PlayerBoss"))
        {
            PlayerControllerBoss playerBoss     = collider.gameObject.GetComponent <PlayerControllerBoss>();
            BossController       playerRealBoss = collider.gameObject.GetComponent <BossController>();

            PlayerBossAtomic(playerBoss);
            BossAtomic(playerRealBoss);

            audioPlayer.Play();
            particles.Play();

            toRemove = true;
        }
    }
 private void PlayerBossHeart(PlayerControllerBoss playerBoss)
 {
     playerBoss.Heal(lifeGiving);
     playerBoss.TakeDamage(-0);
 }
Beispiel #3
0
 private void PlayerBossAtomic(PlayerControllerBoss playerBoss)
 {
     playerBoss.SetNextBullet(atomicBullet);
 }
Beispiel #4
0
    public void StartGameWithBoss(bool winner)

    {
        //isGameBegan = false;
        //isPaused = true;


        int score1 = PlayerPrefs.GetInt("Score1");
        int score2 = PlayerPrefs.GetInt("Score2");

        try
        {
            if (score1 > score2)
            {
                //Setup player1 as player1

                winner = false;
                BossController bossControler1 = player1.GetComponentInChildren <BossController>();
                bossControler1.enabled = !bossControler1.enabled;
                PlayerControllerBoss player1Controller = player1.GetComponentInChildren <PlayerControllerBoss>();
                player1Controller.ResetPosition();
                PlayerHealth player1Health = player1.GetComponentInChildren <PlayerHealth>();
                player1Health.ResetHealth();


                // Setup player2 as boss

                PlayerControllerBoss player2Controller = player2.GetComponentInChildren <PlayerControllerBoss>();
                player2Controller.ResetPosition();
                player2Controller.enabled = !player2Controller.enabled;
                BossController bossController = player2.GetComponentInChildren <BossController>();
                bossController.ResetPosition();
                PlayerHealth player2Health = player2.GetComponentInChildren <PlayerHealth>();
                player2Health.ResetHealth();
                Transform bossTransform2 = player2.GetComponentInChildren <Transform>();
                //bossTransform2.localScale += new Vector3(0.2F, 0.2f, 0);


                // PlayerPrefs.SetInt("Score2", Player2Score);
            }

            else if (score2 > score1)
            {
                // Setup player2 as player2

                winner = false;
                BossController bossControler2 = player2.GetComponentInChildren <BossController>();
                bossControler2.enabled = !bossControler2.enabled;
                PlayerControllerBoss player2Controller = player2.GetComponentInChildren <PlayerControllerBoss>();
                player2Controller.ResetPosition();
                PlayerHealth player2Health = player2.GetComponentInChildren <PlayerHealth>();
                player2Health.ResetHealth();

                //   setup player1 as boss

                PlayerControllerBoss player1Controller = player1.GetComponentInChildren <PlayerControllerBoss>();
                player1Controller.ResetPosition();
                player1Controller.enabled = !player1Controller.enabled;
                BossController bossController = player1.GetComponentInChildren <BossController>();
                bossController.ResetPosition();
                PlayerHealth player1Health = player1.GetComponentInChildren <PlayerHealth>();
                player1Health.ResetHealth();
            }
        }
        catch (NullReferenceException e)
        {
            Debug.Log(e);
        }
    }