// Use this for initialization
 void Start()
 {
     cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
     lerpFract = 0.3f;
     angle     = Vector3.Angle(Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.parent.position, transform.position - transform.parent.position);
     controls  = controller.GetComponent <ControllerInputScript>();
 }
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        for (int i = 0; i < numPlayers; i++)
        {
            ControllerInputScript controls = controllers[i].GetComponent <ControllerInputScript>();
            controls.SetPlayerNumber(i);
        }
        round   = PlayerPrefs.GetInt("Round");
        p1Score = PlayerPrefs.GetInt("P1Score");
        p2Score = PlayerPrefs.GetInt("P2Score");

        roundText.text    = "Round " + round;
        p1Text.text       = "" + p1Score;
        p2Text.text       = "" + p2Score;
        maxScoreText.text = "First to " + maxScore + " wins!";

        //ready.fontSize = 22;
        //ready.text = "Ready?";
        //yield return new WaitForSeconds(1.0f);
        //float waitfor = 2.0f;
        //ready.fontSize = 35;
        //ready.text = "GO!";
        //yield return new WaitForSeconds(1.0f);
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);         //CHANGE MOUSE TO CONTROLLER INPUT
        lerpFract = 0.3f;

        angle = Vector3.Angle(Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.parent.position, transform.position - transform.parent.position);

        controls = GameObject.Find("ControllerInput").GetComponent <ControllerInputScript>();
    }
Exemple #4
0
    //  GameObject panel;

    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        ControllerInputScript controls = controller.GetComponent <ControllerInputScript>();
    }
    // Use this for initialization
    void Start()
    {
        cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        lerpFract = 0.3f;
        angle     = Vector3.Angle(Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.parent.position, transform.position - transform.parent.position);
        controls  = controller.GetComponent <ControllerInputScript>();
        player    = transform.parent.GetComponent <PlayerController>();

        GameObject softLineObject = Instantiate(softLinePrefab);

        softLine = softLineObject.GetComponent <Line>();
        softLine.UpdateLine(transform.position);

        glow         = (Light)GetComponent("Light");
        glow.enabled = false;
        glow.range   = 0;
    }
 // Use this for initialization
 void Start()
 {
     controls = GameObject.Find("ControllerInput").GetComponent <ControllerInputScript>();
 }
 // Start is called before the first frame update
 void Start()
 {
     controls = controller.GetComponent <ControllerInputScript>();
 }
    //private Ienumerator countdown();

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }
        for (int i = 0; i < numPlayers; i++)
        {
            ControllerInputScript controller = controllers[i].GetComponent <ControllerInputScript>();
            if (controller.getDPadDownDown())
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            }

            if (controller.getLeftBumperDown() && controller.getRightBumperDown())
            {
                Debug.Log("doing the reset thing");
                PlayerPrefs.SetInt("P1Score", 0);
                PlayerPrefs.SetInt("P2Score", 0);
                PlayerPrefs.SetInt("Round", 1);
                SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            }
        }

        if (roundOver)
        {
            //Check which player is still alive, increment scores accordingly
            if (loser == 0)
            {
                //Increment player2 score and restart
                Debug.Log("Player 2 wins");
                Debug.Log("Score before update: " + PlayerPrefs.GetInt("P2Score"));

                PlayerPrefs.SetInt("P2Score", p2Score + 1);
                Debug.Log("Score AFTER update: " + PlayerPrefs.GetInt("P2Score"));
            }
            else
            {
                //Increment player1 score
                Debug.Log("Player 1 wins");
                Debug.Log("Score before update: " + PlayerPrefs.GetInt("P1Score"));
                PlayerPrefs.SetInt("P1Score", p1Score + 1);
                Debug.Log("Score AFTER update: " + PlayerPrefs.GetInt("P1Score"));
            }
            PlayerPrefs.SetInt("Round", round++);
            if (p1Score >= maxScore - 1)
            {
                //Display "Congratulations p1!"
                //Buttons: Return to Menu, Play Again
                PlayerPrefs.SetInt("P1Score", 0);
                PlayerPrefs.SetInt("P2Score", 0);
                PlayerPrefs.SetInt("Round", 1);
                SceneManager.LoadScene("MainMenu"); // put this on some "restart" button
            }
            else if (p2Score >= maxScore - 1)
            {
                //Display "Congratulations p2!"
                //Buttons: Return to Menu, Play Again
                PlayerPrefs.SetInt("P1Score", 0);
                PlayerPrefs.SetInt("P2Score", 0);
                PlayerPrefs.SetInt("Round", 1);
                SceneManager.LoadScene("MainMenu"); // put this on some "restart" button
            }
            else
            {
                //Display "Winner: (winner)"
                //Display progress tokens
                //Set player scores

                PlayerPrefs.SetInt("Round", round++);
            }

            SceneManager.LoadScene(SceneManager.GetActiveScene().name); // put this on some "restart" button
        }
    }
 // Use this for initialization
 void Start()
 {
     cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); //CHANGE MOUSE TO CONTROLLER INPUT
     controls  = controller.GetComponent <ControllerInputScript>();
 }
 // Use this for initialization
 void Start()
 {
     controller = GameManager.instance.controller;
     controls   = controller.GetComponent <ControllerInputScript>();
 }
 // Start is called before the first frame update
 void Start()
 {
     controls = controller.GetComponent <ControllerInputScript>();
     StartCoroutine(displayTutorialButtons());
 }
Exemple #12
0
 // Start is called before the first frame update
 void Start()
 {
     flag     = 0;
     player   = GameObject.Find("Player");
     controls = controller.GetComponent <ControllerInputScript>();
 }
Exemple #13
0
 // Use this for initialization
 void Start()
 {
     controls = GameObject.Find("ControllerInput").GetComponent <ControllerInputScript>();
     rb2d     = gameObject.GetComponent <Rigidbody2D>();
 }
 // Use this for initialization
 void Start()
 {
     controller = GameManager.instance.GetController(transform.parent.GetComponent <PlayerController>().GetPlayerNumber());
     controls   = controller.GetComponent <ControllerInputScript>();
 }