예제 #1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.tag == "CBullet")
     {
         BannerScript.UnlockTrophy("Golgi");
     }
 }
예제 #2
0
 void FixedUpdate()
 {
     if (Level >= 20)
     {
         BannerScript.UnlockTrophy("RNA");
     }
     if (timeRemaining < 0)
     {
         BannerScript.UnlockTrophy("Ribosome");
     }
     if ((lives < 1 || timeRemaining < 0) && GlobalVariables.arcadeMode != false)
     {
         ShowScore();
     }
     else
     {
         if (lives < 1 || timeRemaining < 0)
         {
             GlobalVariables.arcadeMode = false;
             SceneManager.LoadScene("MemoryGame");
         }
         if (GlobalVariables.arcadeMode == true)
         {
             int tmp = (int)score;
             theScore.GetComponent <TMPro.TextMeshPro>().text = "SCORE: " + tmp.ToString();
         }
         else
         {
             Timer.GetComponent <TMPro.TextMeshPro>().text    = "";
             theScore.GetComponent <TMPro.TextMeshPro>().text = "";
         }
         theLevels.GetComponent <TMPro.TextMeshPro>().text = "LEVEL: " + Level.ToString();
     }
 }
예제 #3
0
    void FixedUpdate()
    {
        if (score >= 1000)
        {
            BannerScript.UnlockTrophy("Endoplasmic reticulum");
        }

        if (GlobalVariables.arcadeMode == false)
        {
            if (numberofstingsdone >= 20)
            {
                CellGameplayScript.loadCase = 2;
                Set.SetAndEnterStatic(15);
            }
        }

        if (GlobalVariables.arcadeMode == true)
        {
            theLives.GetComponent <TMPro.TextMeshPro>().text = "LIVES: " + lives;
            if (lives < 1)
            {
                if (GlobalVariables.tutorial)
                {
                    Set.SetAndEnterStatic(5);
                }
                else
                {
                    ShowScore();
                }
            }
            if (numberofstingsdone >= neededstings)
            {
                TheLevel.GetComponent <TMPro.TextMeshPro>().text = "Level: " + level;
                neededstings += 5;
            }
            int tmp = (int)score;
            theScore.GetComponent <TMPro.TextMeshPro>().text = "SCORE: " + tmp.ToString();
        }
        else
        {
            theScore.GetComponent <TMPro.TextMeshPro>().text = "";
            TheLevel.GetComponent <TMPro.TextMeshPro>().text = "";
            theLives.GetComponent <TMPro.TextMeshPro>().text = "";
        }
    }
예제 #4
0
    void Update()
    {
        SeeValue = PlayerPrefs.GetInt("VirusTotalCount");
        if (GlobalVariables.tutorial == false)
        {
            if (GlobalVariables.arcadeMode)
            {
                DisplayCountAndScore();

                //Checking if you completed a wave
                if (EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && EnemyManger.GetComponent <VirusManager>().DoneSpawning == true)
                {
                    EnemyManger.GetComponent <VirusManager>().DoneSpawning = false;
                    TextForArcade();
                }

                //If you lose arcade bring up scorebaord
                if (VirusLeaveCount == 10)
                {
                    isGameOver = true;
                    ScoreBoard.SetActive(true);
                    Text.text = "You lose arcade mode";

                    if (CurrentScore > BestScoreForFightVirus)
                    {
                        BestScoreForFightVirus = CurrentScore;
                    }

                    if (BestScoreForFightVirus > PlayerPrefs.GetFloat("FightVirusScore"))
                    {
                        PlayerPrefs.SetFloat("FightVirusScore", BestScoreForFightVirus);
                    }
                    else
                    {
                        BestScoreForFightVirus = PlayerPrefs.GetFloat("FightVirusScore");
                    }

                    SetFacebook();

                    ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5);
                }

                //If you win arcade bring up score board
                if (EnemyManger.GetComponent <VirusManager>().WaveNumber >= 5 && EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && VirusLeaveCount < 10)
                {
                    isGameOver = true;
                    ScoreBoard.SetActive(true);
                    Text.text = "You win arcade mode";

                    if (CurrentScore > BestScoreForFightVirus)
                    {
                        BestScoreForFightVirus = CurrentScore;
                    }

                    if (BestScoreForFightVirus > PlayerPrefs.GetFloat("FightVirusScore"))
                    {
                        PlayerPrefs.SetFloat("FightVirusScore", BestScoreForFightVirus);
                    }
                    else
                    {
                        BestScoreForFightVirus = PlayerPrefs.GetFloat("FightVirusScore");
                    }

                    SetFacebook();
                    ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5);

                    if (VirusLeaveCount == 0 && BeatBoss == true)
                    {
                        BannerScript.UnlockTrophy("Virus Trophy");
                    }
                }

                //Check to see if player killed enough viruses
                if (IncrementKill > 0)
                {
                    VirusKillCount = IncrementKill;
                    IncrementKill  = 0;
                }

                if (VirusKillCount == 50)
                {
                    BannerScript.UnlockTrophy("Virus Capsid");
                }
            }

            else
            {
                if (EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && EnemyManger.GetComponent <VirusManager>().DoneSpawning == true)
                {
                    EnemyManger.GetComponent <VirusManager>().DoneSpawning = false;
                    TextForArcade();
                }

                //If you lose story mode keep making them play until they beat it
                if (VirusLeaveCount == 5)
                {
                    isGameOver = true;
                    Text.text  = "You lose story mode";
                    SceneManager.LoadScene("FightVirus");
                }

                //If you win story mode continue to next scene and don't forget to fade out
                if (EnemyManger.GetComponent <VirusManager>().WaveNumber == 4 && EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0)
                {
                    isGameOver     = true;
                    Text.text      = "You win story mode";
                    BeatGameTimer += Time.deltaTime;

                    //float a = BlackCurtain.GetComponent<Renderer>().material.color.a;
                    //if (a < 0)
                    //    a = 0;
                    //BlackCurtain.GetComponent<Renderer>().material.color = new Color(0, 0, 0, a + (Time.deltaTime * 1.5f));

                    if (BeatGameTimer >= 2.0f)
                    {
                        CellGameplayScript.loadCase = 4;
                        Set.SetAndEnterStatic(15);
                    }
                }
            }
        }

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //Set up turtorial
        else if (GlobalVariables.tutorial == true)
        {
            //Need to fade in
            //float a = BlackCurtain.GetComponent<Renderer>().material.color.a;
            //BlackCurtain.GetComponent<Renderer>().material.color = new Color(0, 0, 0, a - (Time.deltaTime * 1.5f));

            //Player input to skip text
            if (StopInput == false)
            {
                bool held = Input.GetButton("Fire1");
                if (held && !last)
                {
                    if (text)
                    {
                        finish = true;
                    }

                    else
                    {
                        PressToContinue.SetActive(false);
                        TextForTutorial();
                    }
                }
                last = held;
            }

            //Checking for events
            if (VirusLeaveCount == 1 && WhatToRead == 5)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
                WhatToRead += 1;
            }

            if (EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && EnemyManger.GetComponent <VirusManager>().WaveNumber == 3 && WhatToRead == 9)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
                WhatToRead++;
            }
        }
    }
예제 #5
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.transform.root.tag == "Player")
     {
         player1Controler PlayerController = col.transform.root.GetComponent <player1Controler>();
         Text             tempBanner       = GameObject.FindGameObjectWithTag("Banner" + PlayerController.PlayerNumber.ToString()).GetComponent <Text>();
         BannerScript     Banner           = GameObject.FindGameObjectWithTag("Banner" + PlayerController.PlayerNumber.ToString()).GetComponent <BannerScript>();
         if (col.transform.root != transform.root && col.tag != "Ground" && !col.isTrigger) // see if you did not hit self or ground
         {
             if (!PlayerController.damage)                                                  // see if he can take damage or not
             {
                 if (PlayerController.horizontal * col.transform.root.localScale.x < -0.2f && PlayerController.up == false && PlayerController.blockCharge > 0)
                 {
                     PlayerController.block = true;
                     Banner.FadeDuration    = 1.0f;
                     tempBanner.text        = "block";
                     transform.root.GetComponent <player1Controler>().GetBlocked = true;
                     Debug.Log("block");
                     GameObject blockObject = blocksparkpool.m_instance1.NewObject();
                     if (blockObject != null)
                     {
                         blockObject.transform.rotation = Quaternion.identity;
                         if (col.transform.root.localScale.x > 0.1f)
                         {
                             blockObject.transform.localScale = new Vector3(-2, 1, 1);
                             blockObject.transform.position   = new Vector3(col.transform.position.x + 0.5f, col.transform.position.y + 0.9f, col.transform.position.z - 0.5f);
                         }
                         else
                         {
                             blockObject.transform.localScale = new Vector3(2, 1, 1);
                             blockObject.transform.position   = new Vector3(col.transform.position.x - 0.5f, col.transform.position.y + 0.9f, col.transform.position.z - 0.5f);
                         }
                         blockObject.SetActive(true);
                     }
                 }
                 else
                 {
                     Banner.FadeDuration = 1.0f;
                     tempBanner.text     = "hit";
                     Debug.Log("hit");
                     PlayerController.damage = true;
                     col.transform.root.GetComponentInChildren <Animator>().SetTrigger("Damage");
                     GameObject newObject = hitsparkpool.m_instance.NewObject();
                     if (newObject != null)
                     {
                         newObject.transform.position = new Vector3(col.transform.position.x, col.transform.position.y + 0.6f, col.transform.position.z - 0.5f);
                         newObject.transform.rotation = Quaternion.identity;
                         newObject.SetActive(true);
                     }
                     player1Controler TempRoot = transform.root.GetComponent <player1Controler>();
                     if (TempRoot.onGround == false && TempRoot.up == false)
                     {
                         PlayerController.InAirAttack = true;
                     }
                     else if (TempRoot.onGround == true && TempRoot.crouch == true)
                     {
                         PlayerController.CrouchAttack = true;
                     }
                 }
             }
         }
     }
 }
예제 #6
0
    void Update()
    {
        SeeValue = PlayerPrefs.GetInt("ReceptorTotalCount");

        //For arcade and story mode
        if (GlobalVariables.tutorial == false)
        {
            if (GlobalVariables.arcadeMode)
            {
                ScoreGameOjbect.text = "Score: " + CurrentScore.ToString();
                LivesGameObject.text = "Lives: " + Lives.ToString();
            }

            //Display wave text
            if (InstructionsDone == true)
            {
                if (WaveStarted == true)
                {
                    switch (WaveManager.GetComponent <WaveManager>().WaveNumber)
                    {
                    case 1:
                        StartCoroutine(DisplayText("Wave1", 2.3f));
                        break;

                    case 2:
                        StartCoroutine(DisplayText("Wave2", 2.3f));
                        break;

                    case 3:
                        StartCoroutine(DisplayText("Wave3", 2.3f));
                        break;

                    case 4:
                        StartCoroutine(DisplayText("Final Wave", 2.3f));
                        break;

                    default:
                        break;
                    }

                    WaveManager.GetComponent <WaveManager>().WaveNumber += 1;
                    WaveStarted = false;
                }
            }

            //Check which enemies are nearby
            Collider[] AntibodiesCloseBy = Physics.OverlapSphere(transform.position, 5.0f);

            if (AntibodiesCloseBy.Length != 0)
            {
                foreach (Collider enemy in AntibodiesCloseBy)
                {
                    //If there is an enemy close then check if player is in the field of view
                    if (enemy.GetComponent <AntiViralProtein>())
                    {
                        if (enemy.GetComponent <AntiViralProtein>().CheckFOV() == true)
                        {
                            //Alert the player
                        }
                    }
                }
            }

            //Gameover
            if (GlobalVariables.arcadeMode)
            {
                if (Lives == 0)
                {
                    isGameover = true;
                }
            }

            if (isGameover == true)
            {
                if (Lives != 0)
                {
                    BeatGameTimer += Time.deltaTime;
                    StartCoroutine(DisplayText("You Win", 2.0f));

                    if (!GlobalVariables.arcadeMode)
                    {
                        float a = BlackCurtain.GetComponent <Renderer>().material.color.a;
                        if (a < 0)
                        {
                            a = 0;
                        }
                        BlackCurtain.GetComponent <Renderer>().material.color = new Color(0, 0, 0, a + (Time.deltaTime * 1.5f));
                    }
                    else
                    {
                        Respawn();

                        if (CurrentScore > FinalScore)
                        {
                            FinalScore = CurrentScore;
                        }

                        if (FinalScore > PlayerPrefs.GetFloat("DestroyCellScore"))
                        {
                            PlayerPrefs.SetFloat("DestroyCellScore", FinalScore);
                        }
                        else
                        {
                            FinalScore = PlayerPrefs.GetFloat("DestroyCellScore");
                        }

                        SetFacebook();

                        ScoreBoard.SetActive(true);
                        ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5);

                        if (Lives == 3)
                        {
                            BannerScript.UnlockTrophy("Protein");
                        }
                    }
                }

                else if (Lives == 0)
                {
                    BeatGameTimer += Time.deltaTime;
                    StartCoroutine(DisplayText("You Lose", 2.0f));
                }

                if (BeatGameTimer >= 2.0f)
                {
                    //For story mode once you beat it proceed to the next story mode
                    if (!GlobalVariables.arcadeMode)
                    {
                        TutorialModeCompleted = false;
                        ContinuePlayThrough();
                    }

                    //For arcade mode once you beat it will bring up scoreboard
                    else
                    {
                        Respawn();
                        SetFacebook();
                        ScoreBoard.SetActive(true);

                        if (CurrentScore > BestScoreForDestroyCell)
                        {
                            BestScoreForDestroyCell = CurrentScore;
                        }

                        ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5);
                    }
                }
            }

            if (IncrementKill > 0)
            {
                CellReceptorKillCount = IncrementKill;
                IncrementKill         = 0;
            }

            if (CellReceptorKillCount == 50)
            {
                BannerScript.UnlockTrophy("Receptor");
            }
        }

        else if (GlobalVariables.tutorial == true)
        {
            //Need to fade in
            float a = BlackCurtain.GetComponent <Renderer>().material.color.a;
            BlackCurtain.GetComponent <Renderer>().material.color = new Color(0, 0, 0, a - (Time.deltaTime * 1.5f));

            //Player input to skip text
            if (StopInput == false)
            {
                bool held = Input.GetButton("Fire1");
                if (held && !last)
                {
                    if (text)
                    {
                        finish = true;
                    }

                    else
                    {
                        PressToContinue.SetActive(false);
                        TextForTutorial();
                    }
                }
                last = held;
            }

            //Checking for events
            if (WhatToRead == 2 && IsCellDoneIdling == true)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
            }

            if (WhatToRead == 4 && IsCellDoneMoving == true)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
            }

            if (WhatToRead == 5 && WaveManager.GetComponent <WaveManager>().CellReceptorsList.Count == 0)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
            }

            if (WhatToRead == 7 && WaveManager.GetComponent <WaveManager>().AntiViralProteinList.Count == 0)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
            }

            if (WhatToRead == 9 && WaveManager.GetComponent <WaveManager>().CellReceptorsList.Count == 0 && WaveManager.GetComponent <WaveManager>().DoneSpawningCellReceptors == true)
            {
                StopInput = false;
                PressToContinue.SetActive(true);
            }
        }
    }