Example #1
0
    /// <summary>
    /// Spawns the ball for the game
    /// </summary>
    private void SpawnBall()
    {
        GameObject       obj = Instantiate(_prefabs[0], new Vector3(0f, 0f, 0f), Quaternion.identity);
        NetworkingObject networkingObject = obj.GetComponent <NetworkingObject>();

        networkingObject.SetNetworkID(_networkID++);
        networkingObject.SetPlayerNetworkID(-1);

        _networkingObjects.Add(networkingObject);
    }
Example #2
0
    /// <summary>
    /// Creates a player object
    /// </summary>
    /// <param name="side"> The side of the player object determined by -1 or 1</param>
    /// <param name="clientID"> The client ID that this object belongs to</param>
    private void SpawnPlayerObject(int side, int clientID)
    {
        //create a new object
        GameObject       obj = Instantiate(_prefabs[1], new Vector3(10.5f * side, 0f, 0f), Quaternion.identity);
        NetworkingObject networkingObject = obj.GetComponent <NetworkingObject>();

        networkingObject.SetNetworkID(_networkID++);
        networkingObject.SetPlayerNetworkID(clientID);

        //add the object to the list of objects
        _networkingObjects.Add(networkingObject);
    }