예제 #1
0
    //----------------------------------------------------------
    //                    INSTANCE METHODS
    //----------------------------------------------------------
    /**
     * Initialisation and setup. This is only used internally.
     */
    private void init()
    {
        internalEntityRegistry = new Dictionary<long, GameObject>();
        externalEntityRegistry = new Dictionary<long, LVCPair<LVCGame.EntityData, GameObject>>();
        gameObjectToLvcIdMap = new Dictionary<GameObject, long>();

        pendingExternalCreates = new List<LVCGame.EntityData>();
        pendingExternalUpdates = new List<LVCGame.EntityData>();
        pendingExternalDeletes = new List<long>();
        pendingExternalFires = new List<LVCGame.FireWeaponData>();
        pendingExternalDetonations = new List<LVCGame.DetonateMunitionData>();

        // TODO - these initialisation values should not be hard coded
        string lvcConfigPath = LVCUtils.GetLVCConfigPath();
        lvcClient = new LVCClient( LVCUtils.CLIENT_TYPE,
                                   LVCUtils.LocalizePath(lvcConfigPath+"/LVCGame.log") );
        lvcClient.Initialize( LVCUtils.LocalizePath(lvcConfigPath) );

        lvcClient.SetEventsHandlerCallbacks( this, false );

        lvcClient.Start();

        simTicker = new SimTicker( ref lvcClient, 1.0f/30.0f);
        simTickThread = new Thread( new ThreadStart( simTicker.ThreadProc ));
        simTickThread.Start ();
    }
예제 #2
0
    /**
     * Shut down the LVC Client instance.
     */
    public void ShutDown()
    {
        Debug.Log("Shutting down instance of LVC Game");

        if( simTickThread!= null )
        {
            simTicker.shutDown();
            simTickThread.Abort();
            simTickThread = null;
            simTicker = null;
        }

        if( lvcClient != null )
        {
            lvcClient.Tick(500);
            lvcClient.Stop();
            lvcClient = null;
        }
    }