// Use this for initialization
 void Start()
 {
     nm = GameObject.FindObjectOfType<JOB_NetworkManager>();
     scoreText = GameObject.Find("Score").GetComponent<Text>();
     if (cam == null)
     {
         cam = Camera.main;
     }
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        gameOverCalled = false;
        nm = GameObject.FindObjectOfType<JOB_NetworkManager>();
        timerText = GameObject.Find("Timer").GetComponent<Text>();
        photonView = gameObject.GetComponent<PhotonView>();

        //get a spawn position on the screen within the bounds
        if (cam == null)
        {
            cam = Camera.main;
        }
        float circleWidth = objectToSpawn.GetComponent<Renderer>().bounds.extents.x;
        float circleHeight = objectToSpawn.GetComponent<Renderer>().bounds.extents.y;
        Vector3 upperCorner = new Vector3(Screen.width, Screen.height, 0.0f);
        Vector3 targetPos = cam.ScreenToWorldPoint(upperCorner);
        maxWidth = targetPos.x - circleWidth;
        maxHeight = targetPos.y- circleHeight;

        spawnPosition = new Vector3(Random.Range(-maxWidth, maxWidth), Random.Range(-maxHeight, maxHeight), 0.0f);
        spawnPositionSquare = new Vector3(Random.Range(-maxWidth, maxWidth), Random.Range(-maxHeight, maxHeight), 0.0f);
        spawnRotation = Quaternion.identity;
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     nm = GameObject.FindObjectOfType<JOB_NetworkManager>();
     GameOvertext.SetActive(false);
     ExitButton.SetActive(false);
 }