Ejemplo n.º 1
0
    private void Awake()
    {
        GridMap.SetNodeSize(1, 1);
        TSRandom.Init();
        _pfm = new PathFindingManager(1);
        //_pm = PathManager.Instance;
        _gridGraph._mapSizeX = 50;
        _gridGraph._mapSizeZ = 50;
        _gridGraph._startPos = TSVector.zero;
        _gridGraph.SetUpMap();

        _map = _gridGraph._map;    //GridMapManager.Instance.CreateGridMap(50, 50, TSVector.zero, 0, this.IsTileUnWalkable);
        PathFindingAgentBehaviour.C_DESIRED_DELTATIME = 18;
        s_AstarAgent = new SingleObjectPool <PathFindingAgentBehaviour>(10);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Create access to CloudTables. If the table does not exist, it will automatically be created.
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="cloudTableClient"></param>
        /// <remarks>As of the new azure.cosmos.table client sdk v2, pooling and locking isn't necessary anymore. So we provide easy access to tables and reuse a single instance.
        /// https://github.com/Azure/azure-cosmos-dotnet-v2/issues/629
        /// </remarks>
        public CloudTablePool(string tableName, CloudTableClient cloudTableClient)
        {
            TableName = tableName;
            _pool     = new SingleObjectPool <CloudTable>(GetNewTableReference());
            _createTableIfNotExistsTask = Pool.ExecuteOnAvailableObject(table => table.CreateIfNotExistsAsync());
            _createTableIfNotExistsTask.ContinueWith(task =>
            {
                _createTableIfNotExistsTask.Dispose();
            });

            CloudTable GetNewTableReference()
            {
                return(cloudTableClient.GetTableReference(tableName));
            }
        }
Ejemplo n.º 3
0
        public void SingleObjectPooling()
        {
            var pool = new SingleObjectPool <ArrayList>();

            ArrayList arrayList1 = pool.Acquire();

            CheckArrayListIsNew(arrayList1);
            pool.Release(arrayList1);

            // After the object is released, it can be re-acquired
            ArrayList arrayList2 = pool.Acquire();

            CheckArrayListIsNew(arrayList2);
            Assert.AreSame(arrayList1, arrayList2);

            // Before the object is released, the next Acquire() call will create a new object
            ArrayList arrayList3 = pool.Acquire();

            CheckArrayListIsNew(arrayList2);
            Assert.AreNotSame(arrayList2, arrayList3);
        }
Ejemplo n.º 4
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 5
0
 internal CloudTablePool(string tableName, CloudTable table)
 {
     TableName = tableName;
     _pool     = new SingleObjectPool <CloudTable>(table);
     _createTableIfNotExistsTask = table.CreateIfNotExistsAsync().ContinueWith(t => t.Dispose());
 }