Example #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 ();
    }