// Update is called once per frame
 void Update()
 {
     if ((useA && Input.GetButtonDown(InputNames.GetName("accept"))) || (useB && Input.GetButtonDown(InputNames.GetName("cancel"))))
     {
         SceneManager.LoadScene(scene);
     }
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown(InputNames.GetName("accept")))
        {
            switch (textnumber)
            {
            case 1:
                guitext.text = "THE ONLY HOPE LEFT FOR PIXEL-KIND WAS THE BRAVE SOLDIERS OF THE UNITED\nPIXELS. THEY PUT ALL THEIR RESOURCES TOWARDS THE GREAT QUANTUM\nERASER PROJECT.THE UNITED PIXELS GATHERED ALL THE GREATEST\nQUANTUM PHYSICISTS TO CREATE THE ULTIMATE WEAPON.";
                break;

            case 2:
                guitext.text = "THE IDEA WAS TO CREATE THE MOST DANGEROUS STEALTH WARRIORS\nTHE WORLD HAD EVER SEEN. BUT SOMETHING WENT WRONG...";
                break;

            case 3:
                guitext.text = "IN THE PROCESS OF CREATING THE ULTIMATE CAMOUFLAGE THE TEST SUBJECTS\nWERE ALSO QUANTUM ENTANGLED AND ALL RESEARCH DATA WAS DESTROYED.\nONLY THE TWO BRAVE SOLDIERS WHO HAD VOLUNTEERED FOR THE EXPERIMENT\nSURVIVED THE SUB-PIXEL QUANTIFIED FORCES SET FREE.";
                break;

            case 4:
                guitext.text = "DESPITE THE MISHAP THE UNITED PIXELS DECIDED TO SEND OUT THESE\nSOLDIERS TO ELIMINATE THE ENEMIES OF PEACE\nAND ERASE ALL EVIL FROM THE WORLD.";
                break;

            case 5:
                SceneManager.LoadScene("Briefing1");
                //SceneManager.LoadScene(nextLevel.name);
                break;
            }

            textnumber++;
        }
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        foreach (GameObject g in players)
        {
            if (g.GetComponent <PlayerController>().playerNumber == 1)
            {
                if (Input.GetButtonDown(InputNames.GetName("p1 interact key")))
                {
                    Debug.Log("Interacting");
                    Interact();
                }
                else if (Input.GetAxis(InputNames.GetName("p1 interact axis")) > 0 && !pressing)
                {
                    pressing = true;
                    Debug.Log("Interacting");
                    Interact();
                }
                else
                {
                    Toggled = false;
                }


                if (Input.GetAxis(InputNames.GetName("p1 interact axis")) == 0)
                {
                    pressing = false;
                }
            }

            if (g.GetComponent <PlayerController>().playerNumber == 2)
            {
                if (Input.GetButtonDown(InputNames.GetName("p2 interact key")))
                {
                    Debug.Log("Interacting");
                    Interact();
                }
                else if (Input.GetAxis(InputNames.GetName("p2 interact axis")) > 0 && !pressing)
                {
                    pressing = true;
                    Debug.Log("Interacting");
                    Interact();
                }
                else
                {
                    Toggled = false;
                }


                if (Input.GetAxis(InputNames.GetName("p2 interact axis")) == 0)
                {
                    pressing = false;
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (!startedKilling && numberOfPlayersInZone == 2)
        {
            if (Input.GetAxis(InputNames.GetName("p1 interact axis")) > 0 || Input.GetButton(InputNames.GetName("p1 interact key")))
            {
                if (Input.GetAxis(InputNames.GetName("p2 interact axis")) > 0 || Input.GetButton(InputNames.GetName("p2 interact key")))
                {
                    Kill();
                }
                else
                {
                    targetController.onPlayer1KillHold();
                }
            }
            else
            {
                targetController.onPlayer1KillRelease();



                if (Input.GetAxis(InputNames.GetName("p2 interact axis")) > 0 || Input.GetButton(InputNames.GetName("p2 interact key")))
                {
                    if (Input.GetAxis(InputNames.GetName("p1 interact axis")) > 0 || Input.GetButton(InputNames.GetName("p1 interact key")))
                    {
                        Kill();
                    }
                    else
                    {
                        targetController.onPlayer2KillHold();
                    }
                }
                else
                {
                    targetController.onPlayer2KillRelease();
                }
            }
        }
    }
Example #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetAxis(InputNames.GetName("p1 horizontal key")) == 0 && Input.GetAxis(InputNames.GetName("p1 vertical key")) == 0)
        {
            buttonReset1 = true;
        }
        if (Input.GetAxis(InputNames.GetName("p2 horizontal key")) == 0 && Input.GetAxis(InputNames.GetName("p2 vertical key")) == 0)
        {
            buttonReset2 = true;
        }

        if (Input.GetAxis(InputNames.GetName("p1 horizontal axis")) == 0 && Input.GetAxis(InputNames.GetName("p1 vertical axis")) == 0)
        {
            analogReset1 = true;
        }
        if (Input.GetAxis(InputNames.GetName("p2 horizontal axis")) == 0 && Input.GetAxis(InputNames.GetName("p2 vertical axis")) == 0)
        {
            analogReset2 = true;
        }

        if (Input.GetAxis(InputNames.GetName("p1 horizontal axis alt")) == 0 && Input.GetAxis(InputNames.GetName("p1 vertical axis alt")) == 0)
        {
            analogAltReset1 = true;
        }
        if (Input.GetAxis(InputNames.GetName("p2 horizontal axis alt")) == 0 && Input.GetAxis(InputNames.GetName("p2 vertical axis alt")) == 0)
        {
            analogAltReset2 = true;
        }

        if (buttonReset1)
        {
            if (Input.GetAxis(InputNames.GetName("p1 vertical key")) < -0.5)
            {
                buttonReset1 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 vertical key")) > 0.5)
            {
                buttonReset1 = false;
                moveSelection(-1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 horizontal key")) < -0.5)
            {
                buttonReset1 = false;
                moveSelection(4);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 horizontal key")) > 0.5)
            {
                buttonReset1 = false;
                moveSelection(-4);
            }
        }
        if (buttonReset2)
        {
            if (Input.GetAxis(InputNames.GetName("p2 vertical key")) < -0.5)
            {
                buttonReset2 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 vertical key")) > 0.5)
            {
                buttonReset2 = false;
                moveSelection(-1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 horizontal key")) < -0.5)
            {
                buttonReset2 = false;
                moveSelection(4);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 horizontal key")) > 0.5)
            {
                buttonReset2 = false;
                moveSelection(-4);
            }
        }

        if (analogReset1)
        {
            if (Input.GetAxis(InputNames.GetName("p1 vertical axis")) < -0.5)
            {
                analogReset1 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 vertical axis")) > 0.5)
            {
                analogReset1 = false;
                moveSelection(-1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 horizontal axis")) < -0.5)
            {
                analogReset1 = false;
                moveSelection(4);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 horizontal axis")) > 0.5)
            {
                analogReset1 = false;
                moveSelection(-4);
            }
        }
        if (analogReset2)
        {
            if (Input.GetAxis(InputNames.GetName("p2 vertical axis")) < -0.5)
            {
                analogReset2 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 vertical axis")) > 0.5)
            {
                analogReset2 = false;
                moveSelection(-1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 horizontal axis")) < -0.5)
            {
                analogReset2 = false;
                moveSelection(4);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 horizontal axis")) > 0.5)
            {
                analogReset2 = false;
                moveSelection(-4);
            }
        }

        if (analogAltReset1)
        {
            if (Input.GetAxis(InputNames.GetName("p1 vertical axis alt")) < -0.5)
            {
                analogAltReset1 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 vertical axis alt")) > 0.5)
            {
                analogAltReset1 = false;
                moveSelection(-1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 horizontal axis alt")) < -0.5)
            {
                analogAltReset1 = false;
                moveSelection(4);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 horizontal axis alt")) > 0.5)
            {
                analogAltReset1 = false;
                moveSelection(-4);
            }
        }
        if (analogAltReset2)
        {
            if (Input.GetAxis(InputNames.GetName("p2 vertical axis alt")) < -0.5)
            {
                analogAltReset2 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 vertical axis alt")) > 0.5)
            {
                analogAltReset2 = false;
                moveSelection(-1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 horizontal axis alt")) < -0.5)
            {
                analogAltReset2 = false;
                moveSelection(4);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 horizontal axis alt")) > 0.5)
            {
                analogAltReset2 = false;
                moveSelection(-4);
            }
        }


        if (Input.GetButtonDown(InputNames.GetName("accept")))
        {
            switch (curSelection)
            {
            case 0:
                SceneManager.LoadScene(Level1);
                break;

            case 1:
                SceneManager.LoadScene(Level2);
                break;

            case 2:
                SceneManager.LoadScene(Level3);
                break;

            case 3:
                SceneManager.LoadScene(Level4);
                break;

            case 4:
                SceneManager.LoadScene(Level5);
                break;

            case 5:
                SceneManager.LoadScene(Level6);
                break;

            case 6:
                SceneManager.LoadScene(Level7);
                break;

            case 7:
                SceneManager.LoadScene(Level8);
                break;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetAxis(InputNames.GetName("p1 vertical key")) == 0)
        {
            buttonReset1 = true;
        }
        if (Input.GetAxis(InputNames.GetName("p2 vertical key")) == 0)
        {
            buttonReset2 = true;
        }

        if (Input.GetAxis(InputNames.GetName("p1 vertical axis")) == 0)
        {
            analogReset1 = true;
        }
        if (Input.GetAxis(InputNames.GetName("p2 vertical axis")) == 0)
        {
            analogReset2 = true;
        }

        if (Input.GetAxis(InputNames.GetName("p1 vertical axis alt")) == 0)
        {
            analogAltReset1 = true;
        }
        if (Input.GetAxis(InputNames.GetName("p2 vertical axis alt")) == 0)
        {
            analogAltReset2 = true;
        }

        if (buttonReset1)
        {
            if (Input.GetAxis(InputNames.GetName("p1 vertical key")) < -0.5)
            {
                buttonReset1 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 vertical key")) > 0.5)
            {
                buttonReset1 = false;
                moveSelection(-1);
            }
        }
        if (buttonReset2)
        {
            if (Input.GetAxis(InputNames.GetName("p2 vertical key")) < -0.5)
            {
                buttonReset2 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 vertical key")) > 0.5)
            {
                buttonReset2 = false;
                moveSelection(-1);
            }
        }

        if (analogReset1)
        {
            if (Input.GetAxis(InputNames.GetName("p1 vertical axis")) < -0.5)
            {
                analogReset1 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 vertical axis")) > 0.5)
            {
                analogReset1 = false;
                moveSelection(-1);
            }
        }
        if (analogReset2)
        {
            if (Input.GetAxis(InputNames.GetName("p2 vertical axis")) < -0.5)
            {
                analogReset2 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 vertical axis")) > 0.5)
            {
                analogReset2 = false;
                moveSelection(-1);
            }
        }

        if (analogAltReset1)
        {
            if (Input.GetAxis(InputNames.GetName("p1 vertical axis alt")) < -0.5)
            {
                analogAltReset1 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p1 vertical axis alt")) > 0.5)
            {
                analogAltReset1 = false;
                moveSelection(-1);
            }
        }
        if (analogAltReset2)
        {
            if (Input.GetAxis(InputNames.GetName("p2 vertical axis alt")) < -0.5)
            {
                analogAltReset2 = false;
                moveSelection(1);
            }
            else if (Input.GetAxis(InputNames.GetName("p2 vertical axis alt")) > 0.5)
            {
                analogAltReset2 = false;
                moveSelection(-1);
            }
        }


        if (Input.GetButtonDown(InputNames.GetName("accept")))
        {
            switch (curSelection)
            {
            case 0:
                //SceneManager.LoadScene(firstLevel.name);
                SceneManager.LoadScene("Intro1");
                break;

            case 1:
                //SceneManager.LoadScene(levelSelect.name);
                SceneManager.LoadScene("Level Select");
                break;

            case 2:
                //SceneManager.LoadScene(instructions.name);
                SceneManager.LoadScene("Instructions");
                break;

            case 3:
                Application.Quit();
                break;
            }
        }
    }
Example #7
0
    void Update()
    {
        if (canMove)
        {
            // Horizontal input
            float moveHorizontal;
            float moveHorizontalAnalog = Input.GetAxis(InputNames.GetName("p" + playerNumber.ToString() + " horizontal axis"));
            moveHorizontal = moveHorizontalAnalog;
            float moveHorizontalAnalogAlt = Input.GetAxis(InputNames.GetName("p" + playerNumber.ToString() + " horizontal axis alt"));
            if (Mathf.Abs(moveHorizontalAnalogAlt) >= Mathf.Abs(moveHorizontal))
            {
                moveHorizontal = moveHorizontalAnalogAlt;
            }
            float moveHorizontalButton = Input.GetAxis(InputNames.GetName("p" + playerNumber.ToString() + " horizontal key"));
            if (Mathf.Abs(moveHorizontalButton) >= Mathf.Abs(moveHorizontal))
            {
                moveHorizontal = moveHorizontalButton;
            }

            // Vertical input
            float moveVertical;
            float moveVerticalAnalog = Input.GetAxis(InputNames.GetName("p" + playerNumber.ToString() + " vertical axis"));
            moveVertical = moveVerticalAnalog;
            float moveVerticalAnalogAlt = Input.GetAxis(InputNames.GetName("p" + playerNumber.ToString() + " vertical axis alt"));
            if (Mathf.Abs(moveVerticalAnalogAlt) >= Mathf.Abs(moveVertical))
            {
                moveVertical = moveVerticalAnalogAlt;
            }
            float moveVerticalButton = Input.GetAxis(InputNames.GetName("p" + playerNumber.ToString() + " vertical key"));
            if (Mathf.Abs(moveVerticalButton) >= Mathf.Abs(moveVertical))
            {
                moveVertical = moveVerticalButton;
            }


            Vector3 movement = new Vector3(moveHorizontal, moveVertical, 0);
            controller.velocity = movement * speed;

            if (Input.GetButtonDown(InputNames.GetName("green")))
            {
                insideRen.sharedMaterial = Green;
            }
            else if (Input.GetButtonDown(InputNames.GetName("red")))
            {
                insideRen.sharedMaterial = Red;
            }
        }

        //Check color under player
        Debug.DrawRay(transform.position + new Vector3(0, 0, 0.4f), new Vector3(0, 0, 1));
        if (Physics.Raycast(transform.position + new Vector3(0, 0, 0.4f), new Vector3(0, 0, 1), out groundHit, 100))
        {
            if (groundHit.transform.gameObject.GetComponent <Renderer>().sharedMaterial == insideRen.sharedMaterial)
            {
                hidden = true;
                animator.SetBool("hidden", true);
            }
            else
            {
                hidden = false;
                animator.SetBool("hidden", false);
            }
        }

        if (Input.GetButtonDown(InputNames.GetName("menu")))
        {
            SceneManager.LoadScene("MainMenu");
        }
    }