Example #1
0
    // Use this for initialization
    void Start()
    {
        nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;
        // get server version
        serverVersion = nvs.serverVersion;
        // get NATmode
        NATmode = nvs.NATmode;

        // sudo make me a camera
        nvs.myCam = new GameObject("theCamera").AddComponent <Camera>() as Camera;
        nvs.myCam.gameObject.AddComponent <AudioListener>();
        nvs.myCam.gameObject.SetActive(false);          // disable it until we have joined a game

        // get them servers
        MasterServer.ClearHostList();
        MasterServer.RequestHostList(serverVersion);

        // check if we don't have a valid NATmode
        if (NATmode == -1)
        {
            // test the current setup rather than poll for the result
            connectionTestResult = Network.TestConnection(true);
            doneTesting          = false;
        }
        else
        {
            SetMessage();
            doneTesting = true;
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs    = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // add us to the player list
        nvs.players.Add(myInfo);

        // get server version
        serverVersion = nvs.serverVersion;              // maybe set the server version to the map name?
        // get server name
        string serverName = nvs.serverName + ": Lobby";

        // serverComment also holds extra info about the server
        serverComment         = new ServerComment();
        serverComment.NATmode = nvs.NATmode;
        serverComment.comment = "This is a comment about the server";
        serverComment.level   = "level_full";           // only use this one since it's the only one set up atm

        // Use NAT punchthrough if NATmode says to
        Network.InitializeServer(31, 11177, nvs.NATmode != 0);
        Debug.Log(serverComment.toString());
        //MasterServer.updateRate = 5; - not needed anymore since Unity doesn't understand networking
        MasterServer.RegisterHost(serverVersion, serverName, serverComment.toString());

        // get game state
        gameHasBegun = nvs.gameHasBegun;

        // go into the lobby
        gameObject.AddComponent <netLobby>();
    }
Example #3
0
 void Start()
 {
     // get variables we need
     nvs    = GetComponent("networkVariables") as networkVariables;
     myInfo = nvs.myInfo;
     pause  = GetComponent("netPause") as netPause;
 }
Example #4
0
    void Start()
    {
        // get variables we need
        networkVariables nvs = GetComponent("networkVariables") as networkVariables;

        myName = nvs.myInfo.name;
    }
    // Use this for initialization
    void Start()
    {
        nvs          = GetComponent("networkVariables") as networkVariables;
        nvs.gameMode = GameMode.Online;

        // set models
        nvs.myInfo.cartModel      = nvs.buggyModels[IcartModel];
        nvs.myInfo.ballModel      = nvs.ballModels[IballModel];
        nvs.myInfo.characterModel = nvs.characterModels[IballModel];

        // add chat
        gameObject.AddComponent <netChat>();

        //pause
        gameObject.AddComponent <netPause>();

        // add self to the list of people in this game
        currentList = nvs.myInfo.name;

        // copy the script on the previewCamera in main
        Orbit cao = nvs.myCam.gameObject.AddComponent <Orbit>() as Orbit;

        cao.Point = new Vector3(28, 12, 147);
        cao.Axis  = new Vector3(0, 1, 0);
        cao.Speed = 0.1f;
        nvs.myCam.transform.position = new Vector3(26, 64, 86);
        nvs.myCam.transform.rotation = Quaternion.Euler(32, Time.time * 0.1f, 0);       // the Time.time is for the rotation already

        //get colors
        colorKeys = new string[Config.colorsDictionary.Count];
        Config.colorsDictionary.Keys.CopyTo(colorKeys, 0);
        nvs.myInfo.color = colorKeys [0];
    }
 // Use this for initialization
 void Start()
 {
     nvs = GetComponent ("networkVariables") as networkVariables;
     playerNames = new Dictionary<PlayerInfo, GameObject> ();
     myCam = Camera.main;
     numPlayers = 1;
 }
Example #7
0
    void RemovePlayer(NetworkPlayer player)
    {
        PrintText("Someone left");

        // remove from array
        networkVariables nvs      = GetComponent("networkVariables") as networkVariables;
        PlayerInfo       toDelete = new PlayerInfo();

        if (myInfo.player == player)
        {
            Network.Disconnect();
        }

        foreach (PlayerInfo p in nvs.players)
        {
            if (p.player == player)
            {
                // remove from array
                toDelete = p;
            }
        }

        if (nvs.players.Contains(toDelete))
        {
            nvs.players.Remove(toDelete);
        }
    }
Example #8
0
 // Use this for initialization
 void Start()
 {
     nvs         = GetComponent("networkVariables") as networkVariables;
     playerNames = new Dictionary <PlayerInfo, GameObject> ();
     myCam       = nvs.myCam;
     numPlayers  = 1;
 }
Example #9
0
    void Start()
    {
        // get variables we need
        nvs    = GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        localBallAnalog = new GameObject();
    }
 //private Color originalColor = Color.grey;
 void Start()
 {
     //originalColor = ball.renderer.material.GetColor("_ColorTint");
     nvs = GetComponent ("networkVariables") as networkVariables;
     myInfo = nvs.myInfo;
     ball = nvs.myInfo.ballGameObject;
     cart = nvs.myInfo.cartGameObject;
 }
    // Use this for initialization
    void Start()
    {
        nvs = GetComponent("networkVariables") as networkVariables;

        // set models
        nvs.myInfo.cartModel      = nvs.buggyModels[0];
        nvs.myInfo.ballModel      = nvs.ballModels[0];
        nvs.myInfo.characterModel = nvs.characterModels[0];
    }
    public void initialize()
    {
        nvs = messageTarget.GetComponent ("networkVariables") as networkVariables;

        foreach(PlayerInfo player in nvs.players)
        {
            ballPlayerMap.Add(player.ballGameObject, player.player);
        }
    }
Example #13
0
 void Start()
 {
     // get variables we need
     nvs    = GetComponent("networkVariables") as networkVariables;
     myInfo = nvs.myInfo;
     pause  = GetComponent("netPause") as netPause;
     GameObject.Find("lobby_view").transform.FindChild("camera").gameObject.SetActive(false);
     myInfo.cartContainerObject.transform.FindChild("multi_buggy_cam").gameObject.SetActive(true);
 }
    void Start()
    {
        // get variables we need
        nvs    = GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;
        pin    = GameObject.Find("winningPole") as GameObject;

        localBallAnalog = new GameObject();
    }
    // Use this for initialization
    void Start()
    {
        nvs = GetComponent("networkVariables") as networkVariables;

        // set models
        nvs.myInfo.cartModel = nvs.buggyModels[0];
        nvs.myInfo.ballModel = nvs.ballModels[0];
        nvs.myInfo.characterModel = nvs.characterModels[0];
    }
 // Use this for initialization
 void Start()
 {
     // get variables we need
     nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;
     myInfo = nvs.myInfo;
     ed_pauseScreen = Instantiate (Resources.Load ("pauseScreen")) as GameObject;
     ed_pauseScreen.transform.parent = this.transform;
     //Hide the screen while it is inactive
     hideAllScreens ();
 }
 // Use this for initialization
 void Start()
 {
     // get variables we need
     nvs            = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;
     myInfo         = nvs.myInfo;
     ed_pauseScreen = Instantiate(Resources.Load("pauseScreen")) as GameObject;
     ed_pauseScreen.transform.parent = this.transform;
     //Hide the screen while it is inactive
     hideAllScreens();
 }
 // Use this for initialization
 void Start()
 {
     nvs                    = FindObjectOfType <networkVariables> ();
     myInfo                 = nvs.myInfo;
     cameraObject           = nvs.myCam.gameObject;  //may not be set yet
     meter                  = myInfo.characterGameObject.AddComponent <PowerMeter>() as PowerMeter;
     meter.m_objectToCircle = myInfo.characterGameObject;
     meter.m_markerPrefab   = Instantiate(Resources.Load("powerMeterPrefab")) as GameObject;         //	:(
     meter.m_swingScript    = this;
 }
    public List<PlayerInfo> m_players; //we don't want this list to include the player himself, so we'll have to account for that

    #endregion Fields

    #region Methods

    public virtual void AttemptInitialize()
    {
        m_nvs = FindObjectOfType<networkVariables>() as networkVariables;

        //confirm ability to get network variables, else return here without setting initialization flag
        if (m_nvs == null) {
            return;
        }

        Initialize();
    }
Example #20
0
    // Use this for initialization
    void Start()
    {
        // get variables we need
        nvs = GetComponent("networkVariables") as networkVariables;

        // lowest height can be set in netvars
        respawnThreshold = nvs.lowestHeight;

        // set the spawn location to that of the netobj
        spawnLocation = transform.position;
    }
    // Use this for initialization
    void Start()
    {
        // get variables we need
        nvs = GetComponent("networkVariables") as networkVariables;

        // lowest height can be set in netvars
        respawnThreshold = nvs.lowestHeight;

        // set the spawn location to that of the netobj
        spawnLocation = transform.position;
    }
Example #22
0
    // Use this for initialization
    void Start()
    {
        nvs = GetComponent("networkVariables") as networkVariables;

        // set models
        nvs.myInfo.cartModel      = nvs.buggyModels[0];
        nvs.myInfo.ballModel      = nvs.ballModels[0];
        nvs.myInfo.characterModel = nvs.characterModels[0];

        // add chat
        gameObject.AddComponent("netChat");
    }
Example #23
0
    public virtual void AttemptInitialize()
    {
        m_nvs = FindObjectOfType <networkVariables>() as networkVariables;

        //confirm ability to get network variables, else return here without setting initialization flag
        if (m_nvs == null)
        {
            return;
        }

        Initialize();
    }
    void AttemptInitialize()
    {
        m_nvs = FindObjectOfType<networkVariables>() as networkVariables;

        //confirm ability to get network variables, else return here without setting initialization flag
        if (m_nvs == null) {
            //Debug.Log("Unable to find network variables!");
            return;
        }

        Initialize();
    }
Example #25
0
    void AttemptInitialize()
    {
        m_nvs = FindObjectOfType <networkVariables>() as networkVariables;

        //confirm ability to get network variables, else return here without setting initialization flag
        if (m_nvs == null)
        {
            //Debug.Log("Unable to find network variables!");
            return;
        }

        Initialize();
    }
    // Use this for initialization
    void Start()
    {
        nvs = GetComponent("networkVariables") as networkVariables;

        // set models
        nvs.myInfo.cartModel = nvs.buggyModels[0];
        nvs.myInfo.ballModel = nvs.ballModels[0];
        nvs.myInfo.characterModel = nvs.characterModels[0];

        // add chat
        gameObject.AddComponent("netChat");

        currentList += nvs.myInfo.name;
    }
Example #27
0
    public void initialize()
    {
        // get a reference to NetworkObject
        messageTarget = GameObject.FindWithTag("NetObj");
        nvs           = messageTarget.GetComponent("networkVariables") as networkVariables;
        if (nvs.gameMode == GameMode.Local)
        {
            messageTarget = GameObject.Find(nvs.levelName).gameObject;
        }

        foreach (PlayerInfo player in nvs.players)
        {
            ballPlayerMap.Add(player.ballGameObject, player.player);
        }
    }
Example #28
0
    void Start()
    {
        nvs    = GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;
        ball   = nvs.myInfo.ballGameObject;
        cart   = nvs.myInfo.cartGameObject;

        //Create swing Icon for player
        swingIcon = Instantiate(Resources.Load("swing_icon")) as GameObject;

        //Get glow effect on ball
        ballGlow         = ball.GetComponent("Halo") as Behaviour;
        ballGlow.enabled = false;

        attemptInitialize();            //for connecting swingIcon to the in level HUD
    }
    void ThisOnesYours(NetworkViewID cartViewID, NetworkViewID ballViewID, NetworkViewID characterViewID)
    {
        networkVariables nvs = GetComponent("networkVariables") as networkVariables;

        foreach (PlayerInfo p in nvs.players)
        {
            if (p.cartViewIDTransform == cartViewID)
            {
                p.name     = nvs.myInfo.name;
                nvs.myInfo = p;
                myInfo     = nvs.myInfo;
            }
        }
        // call the functions that need them
        AddScripts();
    }
    void Start()
    {
        nvs = GetComponent ("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;
        ball = nvs.myInfo.ballGameObject;
        cart = nvs.myInfo.cartGameObject;

        //Create swing Icon for player
        swingIcon = Instantiate (Resources.Load ("swing_icon")) as GameObject;

        //Get glow effect on ball
        ballGlow = ball.GetComponent ("Halo") as Behaviour;
        ballGlow.enabled = false;

        attemptInitialize ();	//for connecting swingIcon to the in level HUD
    }
    /****************************************************
    *
    * DONT EDIT THIS SCRIPT UNLESS ITS TO ADD ANYTHING
    * IN THE "ANY CLIENT SIDE SCRIPTS GO HERE" SECTION
    *
    ****************************************************/

    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs    = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // get self
        myInfo.player = Network.player;

        // add us to the player list
        nvs.players.Add(myInfo);

        networkView.RPC("MyName", RPCMode.Server, nvs.myInfo.name);

        gameObject.AddComponent("netLobby");
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        UpdateCameraBounds();

        float size = (camMax.x - camMin.x) * iconScale;

        playerRect    = new Rect(0, 0, size, size);
        playerDirRect = new Rect(0, 0, size, size);
        ballRect      = new Rect(0, 0, size, size);
        flagRect      = new Rect(0, 0, size, size);

        playerAngle = 0;

        UpdateIconSize();

        nvs = FindObjectOfType <networkVariables>();
    }
    void AddPlayer(string cartModel, string ballModel, string characterModel, NetworkPlayer player, string name)
    {
        PlayerInfo newGuy = new PlayerInfo();
        newGuy.cartModel = cartModel;
        newGuy.ballModel = ballModel;
        newGuy.characterModel = characterModel;
        newGuy.currentMode = 2;
        newGuy.player = player;
        newGuy.name = name;

        // need to add this as sometimes AddPlayer is called BEFORE Start - should have used Awake thinking about it...
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;
        // add it to the list
        nvs.players.Add(newGuy);
        Debug.Log("added someone");
        Debug.Log(player.ToString());
    }
Example #34
0
    void AddPlayer(string cartModel, string ballModel, string characterModel, NetworkPlayer player, string name)
    {
        PlayerInfo newGuy = new PlayerInfo();

        newGuy.cartModel      = cartModel;
        newGuy.ballModel      = ballModel;
        newGuy.characterModel = characterModel;
        newGuy.currentMode    = 2;
        newGuy.player         = player;
        newGuy.name           = name;

        // need to add this as sometimes AddPlayer is called BEFORE Start - should have used Awake thinking about it...
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;
        // add it to the list
        nvs.players.Add(newGuy);
        Debug.Log("added someone");
        Debug.Log(player.ToString());
    }
Example #35
0
    void Awake()
    {
        networkVariables nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;

        switch (nvs.gameMode)
        {
        case GameMode.Local:
            GameObject.Find(nvs.levelName).AddComponent <LocalMultiplayerController>();
            break;

        case GameMode.Online:
            //Add Network level startup script here
            break;

        default:
            break;
        }
        Destroy(this);
    }
Example #36
0
    void SpawnPlayer(NetworkViewID cartViewIDTransform, NetworkViewID cartViewIDRigidbody, NetworkViewID ballViewID, NetworkViewID characterViewID, int mode, NetworkPlayer p)
    {
        PlayerInfo newGuy = new PlayerInfo();

        newGuy.cartViewIDTransform = cartViewIDTransform;
        newGuy.cartContainerObject = NetworkView.Find(cartViewIDTransform).gameObject;
        newGuy.cartViewIDRigidbody = cartViewIDRigidbody;
        // add another NetworkView for the rigidbody
        newGuy.cartGameObject = newGuy.cartContainerObject.transform.FindChild("buggy").gameObject;
        NetworkView cgr = newGuy.cartGameObject.AddComponent("NetworkView") as NetworkView;

        cgr.observed               = newGuy.cartGameObject.rigidbody;
        cgr.viewID                 = cartViewIDRigidbody;
        cgr.stateSynchronization   = NetworkStateSynchronization.Unreliable;
        newGuy.characterViewID     = characterViewID;
        newGuy.characterGameObject = NetworkView.Find(characterViewID).gameObject;
        newGuy.ballViewID          = ballViewID;
        newGuy.ballGameObject      = NetworkView.Find(ballViewID).gameObject;
        newGuy.currentMode         = mode;
        newGuy.player              = p;

        // ADD MORE SHIT HERE
        if (newGuy.currentMode == 0)
        {
            // set them inside the buggy
            newGuy.characterGameObject.transform.parent        = newGuy.cartGameObject.transform;
            newGuy.characterGameObject.transform.localPosition = new Vector3(0, 0, 0);
            newGuy.characterGameObject.transform.localRotation = Quaternion.identity;
        }
        else if (newGuy.currentMode == 1)
        {
            // set them inside the buggy
            newGuy.characterGameObject.transform.parent        = newGuy.ballGameObject.transform;
            newGuy.characterGameObject.transform.localPosition = new Vector3(0, 0, -2);
            newGuy.characterGameObject.transform.localRotation = Quaternion.identity;
        }

        // and let us have them aswell
        networkVariables nvs = GetComponent("networkVariables") as networkVariables;

        nvs.players.Add(newGuy);
    }
    /****************************************************
    *
    * DONT EDIT THIS SCRIPT UNLESS ITS TO ADD ANYTHING
    * IN THE "ANY SERVER SIDE SCRIPTS GO HERE" SECTION
    *
    ****************************************************/

    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs    = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // add us to the player list
        nvs.players.Add(myInfo);

        // get server version
        serverVersion = nvs.serverVersion;
        // get server name
        string serverName = nvs.serverName;

        // Use NAT punchthrough if no public IP present
        Network.InitializeServer(31, 11177, !Network.HavePublicAddress());
        MasterServer.RegisterHost(serverVersion, SystemInfo.deviceName, serverName);

        gameObject.AddComponent("netLobby");
    }
    IEnumerator Start()
    {
        // wait for the level to load before touching anything otherwise we can get bad references
        yield return(new WaitForSeconds(2));

        // get nvs before anything else
        nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;

        if (loaded)
        {
            // this gets called anyway in the coroutine?
            cfgLoadOptions();
            cfgLoadLevels();
            cfgLoadModels();
        }
        else
        {
            Debug.Log(Application.persistentDataPath);
            StartCoroutine(retrieveFileFromPath(Application.persistentDataPath));
        }
    }
    void Start()
    {
        if (sm == null)
        {
            this.Awake();
        }
        al  = FindObjectOfType <AudioListener> ();
        nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;

        // get the carcontroller ( this will not be null as we have require component)
        carController = GetComponent <CarController>();

        highAccel = addAudioSource(highAccelClip);
        if (engineSoundStyle == EngineAudioOptions.FourChannel)
        {
            lowAccel  = addAudioSource(lowAccelClip);
            lowDecel  = addAudioSource(lowDecelClip);
            highDecel = addAudioSource(highDecelClip);
        }
        skidSource = addAudioSource(skidClip);
    }
    // CLIENT SIDE SCRIPTS GO HERE
    // all scripts are called after we have a reference to the buggy and a NetworkViewID
    void AddScripts()
    {
        // updates network-sunk fiziks
        gameObject.AddComponent("controlClient");
        // chat
        gameObject.AddComponent("netChat");
        //pause
        gameObject.AddComponent("netPause");
        // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE
        networkVariables nvs = GetComponent("networkVariables") as networkVariables;
        CarAudio         mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio;

        mca.followCamera = nvs.myCam;                                                                                 // replace tmpCam with our one - this messes up sound atm
        (nvs.myCam.gameObject.AddComponent("SmoothFollow") as SmoothFollow).target = myInfo.cartGameObject.transform; // add smooth follow script
        // get self
        myInfo.player = Network.player;
        // get server
        myInfo.server = myInfo.cartViewIDTransform.owner;
        // show that we connected
        connected = true;
    }
Example #41
0
    // random names
    //string[] randomNames = new string[3] {"Leslie", "Test", "REPLACE ME"};

    /****************************************************
    *
    * DONT EDIT THIS SCRIPT
    *
    ****************************************************/

    // Use this for initialization
    void Start()
    {
        // change to custom master server
        MasterServer.ipAddress = "37.157.247.37";
        MasterServer.port      = 23466;
        // NAT punchthrough (finally)
        Network.natFacilitatorIP   = "37.157.247.37";
        Network.natFacilitatorPort = 50005;

        nvs = GetComponent("networkVariables") as networkVariables;
        // get server version
        serverVersion = nvs.serverVersion;

        // get them servers
        MasterServer.ClearHostList();
        MasterServer.RequestHostList(serverVersion);

        // set default player name
        nvs.myInfo.name = SystemInfo.deviceName;
        //nvs.myInfo.name = randomNames[Random.Range(0,randomNames.Length-1)];

        // set default server name
        nvs.serverName = nvs.myInfo.name + "'s Server";
    }
 // Use this for initialization
 void Start()
 {
     // get variables we need
     nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;
 }
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;

        // get server version
        serverVersion = nvs.serverVersion;

        // Use NAT punchthrough if no public IP present
        Network.InitializeServer(32, 11177, !Network.HavePublicAddress());
        MasterServer.RegisterHost(serverVersion, SystemInfo.deviceName, "Test server");

        // create server owners buggy
        GameObject cartContainerObject = (Instantiate(Resources.Load("multi_buggy"), new Vector3(0,5,0), Quaternion.identity) as GameObject);
        GameObject ballGameObject = Instantiate(Resources.Load("ball"), new Vector3(3,5,0), Quaternion.identity) as GameObject;
        GameObject characterGameObject = Instantiate(Resources.Load("lil_patrick"), new Vector3(0,4,0), Quaternion.identity) as GameObject;
        GameObject cartGameObject = cartContainerObject.transform.FindChild ("buggy").gameObject;
        // set buggy as characters parent
        characterGameObject.transform.parent = cartGameObject.transform;

        // networkview that shit
        NetworkViewID cartViewIDTransform = Network.AllocateViewID();
        NetworkView cgt = cartContainerObject.AddComponent("NetworkView") as NetworkView;
        cgt.observed = cartContainerObject.transform;
        cgt.viewID = cartViewIDTransform;
        cgt.stateSynchronization = NetworkStateSynchronization.Unreliable;
        NetworkViewID cartViewIDRigidbody = Network.AllocateViewID();
        NetworkView cgr = cartGameObject.AddComponent("NetworkView") as NetworkView;
        cgr.observed = cartGameObject.rigidbody;
        cgr.viewID = cartViewIDRigidbody;
        cgr.stateSynchronization = NetworkStateSynchronization.Unreliable;
        NetworkViewID ballViewID = Network.AllocateViewID();
        ballGameObject.networkView.viewID = ballViewID;
        NetworkViewID characterViewID = Network.AllocateViewID();
        characterGameObject.networkView.viewID = characterViewID;

        // turn it into a PlayerInfo
        nvs.myInfo.cartContainerObject = cartContainerObject;
        nvs.myInfo.cartGameObject = cartGameObject;
        nvs.myInfo.cartModel = "multi_buggy";
        nvs.myInfo.cartViewIDTransform = cartViewIDTransform;
        nvs.myInfo.cartViewIDRigidbody = cartViewIDRigidbody;
        nvs.myInfo.ballGameObject = ballGameObject;
        nvs.myInfo.ballModel = "ball";
        nvs.myInfo.ballViewID = ballViewID;
        nvs.myInfo.characterGameObject = characterGameObject;
        nvs.myInfo.characterModel = "lil_patrick";
        nvs.myInfo.characterViewID = characterViewID;
        nvs.myInfo.currentMode = 0;	// set in buggy

        // get self
        nvs.myInfo.player = Network.player;

        // keep a copy
        myInfo = nvs.myInfo;

        // add myInfo to the player list
        nvs.players = new ArrayList();
        nvs.players.Add(myInfo);

        // ANY SERVER SIDE SCRIPTS GO HERE
        //********************************************
        // receives all players inputs and handles fiziks
        gameObject.AddComponent("controlServer");
        // chat
        gameObject.AddComponent("netChat");
        //pause
        gameObject.AddComponent ("netPause");
        //********************************************
    }
 void Start()
 {
     // get variables we need
     nvs = GetComponent("networkVariables") as networkVariables;
     myInfo = nvs.myInfo;
     pause = GetComponent ("netPause") as netPause;
     // change camera
     //GameObject.Find ("lobby_view").transform.FindChild ("camera").gameObject.SetActive (false);
     //myInfo.cartContainerObject.transform.FindChild ("multi_buggy_cam").gameObject.SetActive (true);
 }
    /****************************************************
     *
     * DONT EDIT THIS SCRIPT UNLESS ITS TO ADD ANYTHING
     * IN THE "ANY CLIENT SIDE SCRIPTS GO HERE" SECTION
     *
     ****************************************************/
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // get self
        myInfo.player = Network.player;

        // add us to the player list
        nvs.players.Add(myInfo);

        networkView.RPC("MyName", RPCMode.Server, nvs.myInfo.name);

        // go into the lobby
        gameObject.AddComponent("netLobby");
    }
    /****************************************************
     *
     * DONT EDIT THIS SCRIPT UNLESS ITS TO ADD ANYTHING
     * IN THE "ANY SERVER SIDE SCRIPTS GO HERE" SECTION
     *
     ****************************************************/
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // add us to the player list
        nvs.players.Add(myInfo);

        // get server version
        serverVersion = nvs.serverVersion;	// maybe set the server version to the map name?
        // get server name
        string serverName = nvs.serverName + ": Lobby";
        string serverComment = "Add stuff like spectators here maybe?";

        // Use NAT punchthrough if no public IP present
        Network.InitializeServer(31, 11177, !Network.HavePublicAddress());
        MasterServer.updateRate = 5;
        MasterServer.RegisterHost(serverVersion, serverName, serverComment);

        // get game state
        gameHasBegun = nvs.gameHasBegun;

        // go into the lobby
        gameObject.AddComponent("netLobby");
    }
    /****************************************************
     *
     * DONT EDIT THIS SCRIPT UNLESS ITS TO ADD ANYTHING
     * IN THE "ANY SERVER SIDE SCRIPTS GO HERE" SECTION
     *
     ****************************************************/
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // add us to the player list
        nvs.players.Add(myInfo);

        // get server version
        serverVersion = nvs.serverVersion;
        // get server name
        string serverName = nvs.serverName;

        // Use NAT punchthrough if no public IP present
        Network.InitializeServer(31, 11177, !Network.HavePublicAddress());
        MasterServer.RegisterHost(serverVersion, SystemInfo.deviceName, serverName);

        gameObject.AddComponent("netLobby");
    }
    // random names
    //string[] randomNames = new string[3] {"Leslie", "Test", "REPLACE ME"};
    /****************************************************
     *
     * DONT EDIT THIS SCRIPT
     *
     ****************************************************/
    // Use this for initialization
    void Start()
    {
        // change to custom master server
        MasterServer.ipAddress = "37.157.247.37";
        MasterServer.port = 23466;
        // NAT punchthrough (finally)
        Network.natFacilitatorIP = "37.157.247.37";
        Network.natFacilitatorPort = 50005;

        nvs = GetComponent("networkVariables") as networkVariables;
        // get server version
        serverVersion = nvs.serverVersion;

        // get them servers
        MasterServer.ClearHostList();
        MasterServer.RequestHostList(serverVersion);

        // set default player name
        nvs.myInfo.name = SystemInfo.deviceName;
        //nvs.myInfo.name = randomNames[Random.Range(0,randomNames.Length-1)];

        // set default server name
        nvs.serverName = nvs.myInfo.name + "'s Server";
    }
    void Start()
    {
        // get variables we need
        nvs = GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;
        pin = GameObject.Find ("winningPole") as GameObject;

        localBallAnalog = new GameObject ();
    }
 // Use this for initialization
 void Start()
 {
     nvs = GetComponent ("networkVariables") as networkVariables;
     handledPlayers = new List<PlayerInfo> ();
     numPlayers = 0;
 }
 // Use this for initialization
 void Start()
 {
     nvs = FindObjectOfType<networkVariables> ();
     myInfo = nvs.myInfo;
     cameraObject = nvs.myCam.gameObject;	//may not be set yet
     meter = myInfo.characterGameObject.AddComponent ("PowerMeter") as PowerMeter;
     meter.m_objectToCircle = myInfo.characterGameObject;
     meter.m_markerPrefab = Instantiate (Resources.Load ("powerMeterPrefab")) as GameObject;	//	:(
     meter.m_swingScript = this;
 }
    // Use this for initialization
    void Start()
    {
        UpdateCameraBounds();

        float size = (camMax.x-camMin.x) * iconScale;

        playerRect       = new Rect(0,0,size,size);
        playerDirRect    = new Rect(0,0,size,size);
        ballRect         = new Rect(0,0,size,size);
        flagRect         = new Rect(0,0,size,size);

        playerAngle = 0;

        UpdateIconSize();

        nvs = FindObjectOfType<networkVariables>();
    }
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        // add us to the player list
        nvs.players.Add(myInfo);

        // get server version
        serverVersion = nvs.serverVersion;	// maybe set the server version to the map name?
        // get server name
        string serverName = nvs.serverName + ": Lobby";
        // serverComment also holds extra info about the server
        serverComment = new ServerComment();
        serverComment.NATmode = nvs.NATmode;
        serverComment.comment = "This is a comment about the server";
        serverComment.level = "level_full";	// only use this one since it's the only one set up atm

        // Use NAT punchthrough if NATmode says to
        Network.InitializeServer(31, 11177, nvs.NATmode!=0);
        Debug.Log(serverComment.toString());
        //MasterServer.updateRate = 5; - not needed anymore since Unity doesn't understand networking
        MasterServer.RegisterHost(serverVersion, serverName, serverComment.toString());

        // get game state
        gameHasBegun = nvs.gameHasBegun;

        // go into the lobby
        gameObject.AddComponent("netLobby");
    }
    void Start()
    {
        if(sm==null) this.Awake();
        al = FindObjectOfType<AudioListener> ();
        nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;

        // get the carcontroller ( this will not be null as we have require component)
        carController = GetComponent<CarController>();

        highAccel = addAudioSource(highAccelClip);
        if (engineSoundStyle == EngineAudioOptions.FourChannel) {
            lowAccel = addAudioSource(lowAccelClip);
            lowDecel = addAudioSource(lowDecelClip);
            highDecel = addAudioSource(highDecelClip);
        }
        skidSource = addAudioSource(skidClip);
    }
    // Use this for initialization
    void Start()
    {
        nvs = GetComponent("networkVariables") as networkVariables;
        nvs.gameMode = GameMode.Online;

        // set models
        nvs.myInfo.cartModel = nvs.buggyModels[IcartModel];
        nvs.myInfo.ballModel = nvs.ballModels[IballModel];
        nvs.myInfo.characterModel = nvs.characterModels[IballModel];

        // add chat
        gameObject.AddComponent("netChat");

        //pause
        gameObject.AddComponent ("netPause");

        // add self to the list of people in this game
        currentList = nvs.myInfo.name;

        // copy the script on the previewCamera in main
        Orbit cao = nvs.myCam.gameObject.AddComponent("Orbit") as Orbit;
        cao.Point = new Vector3(28,12,147);
        cao.Axis = new Vector3(0,1,0);
        cao.Speed = 0.1f;
        nvs.myCam.transform.position = new Vector3(26,64,86);
        nvs.myCam.transform.rotation = Quaternion.Euler(32,Time.time*0.1f,0);	// the Time.time is for the rotation already

        //get colors
        colorKeys = new string[Config.colorsDictionary.Count ];
        Config.colorsDictionary.Keys.CopyTo( colorKeys,0);
        nvs.myInfo.color = colorKeys [0];
    }
    void Start()
    {
        // get variables we need
        nvs = GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;

        localBallAnalog = new GameObject ();
    }
    void OnEnable()
    {
        nvs = GameObject.FindWithTag("NetObj").GetComponent("networkVariables") as networkVariables;
        winningPlayer = -1;

        currentView = new GameObject ("current_view");
        currentView.transform.parent = GameObject.Find ("level_full").transform;
        currentView.AddComponent<ControllerSupport> ();
        currentView.tag = "LocalMultiplayerView";

        //count up number of players
        int players = 0;

        if ( LocalMultiplayerLobbyController.keyboardIndex > -1)
        {
            players++;
        }

        players += LocalMultiplayerLobbyController.controllerDeviceIndexToPlayerIndexMap.Count;

        //This should be moved to after character selection is complete
        createPlayers();

        //convert the device map to something usable for this case
        int[] playerToControllerIndex = Enumerable.Repeat(-1, 4).ToArray();
        if ( LobbyControllerSupport.inputDeviceList != null )
        {
            playerToControllerIndex = Enumerable.Repeat(-1, Mathf.Max (4, LobbyControllerSupport.inputDeviceList.Length)).ToArray();
            foreach( KeyValuePair<int,int> kv in LocalMultiplayerLobbyController.controllerDeviceIndexToPlayerIndexMap)
            {
                playerToControllerIndex[kv.Value] = kv.Key;
            }
        }
        else
        {
            LocalMultiplayerLobbyController.keyboardIndex = 0;
            players = 1;
        }

        //do setup based on number of players & assign the correct devices to the correct prefab
        if ( players == 1 )
        {

            if ( LocalMultiplayerLobbyController.keyboardIndex != -1)
            {
                //Player is using keyboard
                currentView.GetComponent<ControllerSupport>().playerToControllerIndex[0] = -1;
                currentView.SetActive(true);
                currentView.GetComponent<ControllerSupport>().ready = true;
            }
            else
            {
                //Player is using gamepad
                int targetDevice = -1;
                foreach( int val in playerToControllerIndex )
                {
                    if ( val != -1)
                    {
                        targetDevice = val;
                    }
                }

                currentView.GetComponent<ControllerSupport>().ready = true;
                currentView.GetComponent<ControllerSupport>().playerToControllerIndex[0] = targetDevice;
                currentView.SetActive(true);
            }
        }
        else if ( players == 2)
        {
            foreach( int val in playerToControllerIndex )
            {
                if ( val != -1)
                {
                    for (int i = 0; i < currentView.GetComponent<ControllerSupport>().playerToControllerIndex.Length; i++)
                    {
                        if( currentView.GetComponent<ControllerSupport>().playerToControllerIndex[i] == -1)
                        {
                            currentView.GetComponent<ControllerSupport>().playerToControllerIndex[i] = val;
                            break;
                        }
                    }
                }
            }

            currentView.GetComponent<ControllerSupport>().ready = true;
            currentView.SetActive(true);

        }
        else if ( players > 2)
        {

            foreach( int val in playerToControllerIndex )
            {
                if ( val != -1)
                {
                    for (int i = 0; i < currentView.GetComponent<ControllerSupport>().playerToControllerIndex.Length; i++)
                    {
                        if( currentView.GetComponent<ControllerSupport>().playerToControllerIndex[i] == -1)
                        {
                            currentView.GetComponent<ControllerSupport>().playerToControllerIndex[i] = val;
                            break;
                        }
                    }
                }
            }

            currentView.GetComponent<ControllerSupport>().ready = true;
            currentView.SetActive(true);
        }

        //done setting gamepads above, now setup keyboard correctly, and tell certain components that care what they are controlled by
        currentView.GetComponent<ControllerSupport>().checkKeyboard();

        //done coloring
        GameObject.Find (nvs.levelName).AddComponent<netPlayerRespawn> ();
    }
    // Use this for initialization
    void Start()
    {
        // setup reference to networkVariables
        nvs = gameObject.GetComponent("networkVariables") as networkVariables;

        // get server version
        serverVersion = nvs.serverVersion;
        // get server name
        string serverName = nvs.serverName;

        // Use NAT punchthrough if no public IP present
        Network.InitializeServer(32, 11177, !Network.HavePublicAddress());
        MasterServer.RegisterHost(serverVersion, SystemInfo.deviceName, serverName);

        // create server owners buggy
        // This line will get changed at some point - no need to have the camera and the marker in the prefab - they should be in their own scripts
        GameObject cartGameObject = (Instantiate(Resources.Load("buggy_m"), new Vector3(0,5,0), Quaternion.identity) as GameObject);
        // ****************************
        GameObject ballGameObject = Instantiate(Resources.Load("ball"), new Vector3(3,5,0), Quaternion.identity) as GameObject;
        GameObject characterGameObject = Instantiate(Resources.Load("lil_patrick"), new Vector3(0,4,0), Quaternion.identity) as GameObject;
        // set buggy as characters parent
        characterGameObject.transform.parent = cartGameObject.transform;

        // networkview that shit
        NetworkViewID cartViewIDTransform = Network.AllocateViewID();
        NetworkView cgt = cartGameObject.GetComponent("NetworkView") as NetworkView;
        cgt.observed = cartGameObject.transform;
        cgt.viewID = cartViewIDTransform;
        cgt.stateSynchronization = NetworkStateSynchronization.Unreliable;
        NetworkViewID cartViewIDRigidbody = Network.AllocateViewID();
        NetworkView cgr = cartGameObject.AddComponent("NetworkView") as NetworkView;
        cgr.observed = cartGameObject.rigidbody;
        cgr.viewID = cartViewIDRigidbody;
        cgr.stateSynchronization = NetworkStateSynchronization.Unreliable;
        NetworkViewID ballViewID = Network.AllocateViewID();
        ballGameObject.networkView.viewID = ballViewID;
        NetworkViewID characterViewID = Network.AllocateViewID();
        characterGameObject.networkView.viewID = characterViewID;

        // turn it into a PlayerInfo
        nvs.myInfo.cartGameObject = cartGameObject;
        nvs.myInfo.cartModel = "buggy_m";
        nvs.myInfo.cartViewIDTransform = cartViewIDTransform;
        nvs.myInfo.cartViewIDRigidbody = cartViewIDRigidbody;
        nvs.myInfo.ballGameObject = ballGameObject;
        nvs.myInfo.ballModel = "ball";
        nvs.myInfo.ballViewID = ballViewID;
        nvs.myInfo.characterGameObject = characterGameObject;
        nvs.myInfo.characterModel = "lil_patrick";
        nvs.myInfo.characterViewID = characterViewID;
        nvs.myInfo.currentMode = 0;	// set in buggy

        // get self
        nvs.myInfo.player = Network.player;

        // keep a copy
        myInfo = nvs.myInfo;

        // add myInfo to the player list
        nvs.players = new ArrayList();
        nvs.players.Add(myInfo);

        // ANY SERVER SIDE SCRIPTS GO HERE
        //********************************************
        // receives all players inputs and handles fiziks
        gameObject.AddComponent("controlServer");
        // chat
        gameObject.AddComponent("netChat");
        //pause
        gameObject.AddComponent ("netPause");
        // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE
        CarAudio mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio;
        mca.followCamera = nvs.myCam;	// replace tmpCam with our one - this messes up sound atm
        (nvs.myCam.gameObject.AddComponent("SmoothFollow") as SmoothFollow).target = myInfo.cartGameObject.transform;	// add smooth follow script
        //********************************************
    }
 void Start()
 {
     // get variables we need
     nvs = GetComponent("networkVariables") as networkVariables;
     myInfo = nvs.myInfo;
     pause = GetComponent ("netPause") as netPause;
 }
    void Start()
    {
        // get variables we need
        nvs = GetComponent("networkVariables") as networkVariables;
        myInfo = nvs.myInfo;
        pin = GameObject.Find ("winningPole") as GameObject;
        if(pin!=null)(pin.GetComponent ("netWinCollider") as netWinCollider).initialize (); //setup the pin while we have a reference to it.

        localBallAnalog = new GameObject ();
    }