void Start()
    {
        GameObject realPhone = GameObject.Find("PhoneData_RotationServer");

        // Mode for the real game where no demo assets exist
        if(realPhone == null)
        {
            GameObject phone = new GameObject("PhoneData_RotationServer");
            phoneTransform = phone.transform;
            GameObject ls = new GameObject("LightSaberData_RotationServer");
            ls.transform.eulerAngles = new Vector3(0f, 0f, -90f);
            ls.transform.parent = phoneTransform;
            lightSaberTransform = ls.transform;
        }
        // Mode for the demo game where demo assets exist
        else
        {
            phoneTransform = realPhone.GetComponent<Transform>();
            lightSaberTransform = GameObject.Find("LightSaberData_RotationServer").transform;
        }
        accelerationData = Vector3.zero;
        gyroAttitude = Quaternion.identity;
        realRotation = Quaternion.identity;
        initialYAngle = transform.eulerAngles.y;

        IP = Network.player.ipAddress;
        connected = false;
        StartListening();
        server = this;
    }
Example #2
0
    void Awake()
    {
        longIntro = GameObject.Find("LongIntro");
        fadingText = longIntro.GetComponent<FadeObjectInOut>();
        introBackground = GameObject.Find("IntroBackground");
        introBackground.SetActive(false);
        introText = GameObject.Find ("IntroText");
        introText.SetActive(false);
        winText = (GameObject)Instantiate (winTextPrefab, new Vector3 (0f, -1f, 33f), Quaternion.identity);
        winText.SetActive (false);
        scoreText = GameObject.Find ("ScoreText").GetComponent<Text> ();
        highScoreText = GameObject.Find ("HighScore").GetComponent<Text> ();
        timeText = GameObject.Find ("TimeText").GetComponent<Text> ();
        rotServer = GameObject.Find("RotationServer").GetComponent<RotationServer>();
        networkManager = GameObject.Find ("MyNetworkManager").GetComponent<MyNetworkManager> ();
        _usedDevice = Device.Android;

        _gameState = State.NetworkSetup;
        OnStateEntering ();
    }