Example #1
0
 public static void Main()
 {
     DynamicArray<string> arrey = new DynamicArray<string>();
     arrey.Add("Pesho");
     arrey.Add("Gosho");
     Console.WriteLine(arrey.IndexOf("Pesho"));
     Console.WriteLine(arrey.Contains("Gosho"));
     Console.WriteLine(arrey.Contains("Ivan"));
     arrey.Remove("Pesho");
     arrey.InsertAt(1, "Pesho");
     arrey.Clear();
     Console.WriteLine(arrey.Capacity);
     Console.WriteLine(arrey.Count);
     arrey.Add("Ivo");
     arrey[0] = "Gosho";
     var newArrey = arrey.ToArray();
     Console.WriteLine();
     foreach (var item in arrey)
     {
         Console.WriteLine(item);
     }
     Console.WriteLine();
     foreach (var item in newArrey)
     {
         Console.WriteLine(item);
     }
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathingAStar"/> class.
 /// </summary>
 /// <param name="heapInitialSize">Initial size of the heap.</param>
 /// <param name="moveCostProvider">The move cost provider.</param>
 /// <param name="pathSmoother">The path smoother to use.</param>
 public PathingAStar(int heapInitialSize, IMoveCost moveCostProvider, ICellCostStrategy cellCostStrategy, ISmoothPaths pathSmoother)
     : base(moveCostProvider, cellCostStrategy, pathSmoother)
 {
     _openSet = new BinaryHeap<IPathNode>(heapInitialSize, new PathNodeComparer());
     _expandedSet = new List<IPathNode>();
     _successorArray = new DynamicArray<IPathNode>(15);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridManager"/> class.
 /// </summary>
 public GridManager()
 {
     _grids = new List<IGrid>();
     _gridComponents = new List<GridComponent>();
     _portals = new DynamicArray<GridPortal>(0);
     _portalsLookup = new Dictionary<string, GridPortal>(StringComparer.Ordinal);
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathingAStar"/> class.
 /// </summary>
 /// <param name="heapInitialSize">Initial size of the heap.</param>
 public PathingAStar(int heapInitialSize)
     : base(new DiagonalDistance(10), new DefaultCellCostStrategy(), new PathSmoother())
 {
     _openSet = new BinaryHeap<IPathNode>(heapInitialSize, new PathNodeComparer());
     _expandedSet = new List<IPathNode>();
     _successorArray = new DynamicArray<IPathNode>(15);
 }
 public void CustomCapacityConstructorTest()
 {
     int ActualCapacity = 5;
     DynamicArray<int> Arr = new DynamicArray<int>(ActualCapacity);
     Assert.AreEqual(Arr.Capacity, ActualCapacity);
     Assert.AreEqual(Arr.Length, 0);
 }
 public void TestIEnum()
 {
     int[] arr = new[] { 1, 2, 3, 4, 5 };
     DynamicArray<int> m3 = new DynamicArray<int>(arr);
     foreach (var elem in m3)
         Console.WriteLine(elem);
 }
Example #7
0
        static void Main(string[] args)
        {
            var array = new DynamicArray<string>();
            array.Add("Georgi");
            array.Add("Nikolai");
            Console.WriteLine(array.IndexOf("Nikolai"));
            Console.WriteLine(array.Cointains("Kiril"));
            array.Remove("Georgi");
            array.InsertAt(1, "Ivan");
            array.Clear();
            Console.WriteLine(array.Capacity);
            Console.WriteLine(array.Count);

            array.Add("Stefan");
            array.Add("Krum");
            var arr = array.ToArray();
            Console.WriteLine();
            foreach (var item in array)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();

            foreach (var item in arr)
            {
                Console.WriteLine(item);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FullGridVectorField"/> class.
        /// </summary>
        /// <param name="group">The transient unit group.</param>
        /// <param name="path">The path.</param>
        /// <param name="options">The vector field options.</param>
        public FullGridVectorField(TransientGroup<IUnitFacade> group, Path path, VectorFieldOptions options)
        {
            Ensure.ArgumentNotNull(group, "group");
            this.group = group;

            _currentPath = path;

            var modelUnit = group.modelUnit;
            _unitProperties = modelUnit;
            var pathOptions = modelUnit.pathFinderOptions;

            // cache options locally
            _obstacleStrengthFactor = options.obstacleStrengthFactor;
            _allowCornerCutting = pathOptions.allowCornerCutting;
            _allowDiagonals = !pathOptions.preventDiagonalMoves;
            _announceAllNodes = modelUnit.pathNavigationOptions.announceAllNodes;

            _builtInContainment = options.builtInContainment;
            _updateInterval = options.updateInterval;

            // pre-allocate lists
            _openSet = new SimpleQueue<Cell>(31);
            _tempWalkableNeighbours = new DynamicArray<Cell>(8);
            _extraTempWalkableNeighbours = new DynamicArray<Cell>(8);

            _grid = GridManager.instance.GetGrid(group.modelUnit.position);
            if (_grid != null)
            {
                _fastMarchedCells = new PlaneVector[_grid.sizeX, _grid.sizeZ];
                _cellDirs = new VectorFieldCell[_grid.sizeX, _grid.sizeZ];
            }
        }
 public static void ToArray()
 {
     DynamicArray<int> darray = new DynamicArray<int>(1);
     darray.Insert(Data, 0, 0);
     Assert.That(darray, Is.EqualTo((int[])darray.ToArray()));
     Assert.That(darray, Is.EqualTo((int[])darray));
 }
Example #10
0
 public void RandomOperation()
 {
     var r = new Random();
     const int totalOperations = 10000;
     var target = new DynamicArray<int>();
     for (var i = 0; i < totalOperations; i++)
     {
         int oldCount = target.Count;
         switch (r.Next(3))
         {
             case 0: // Add
                 var newItem = r.Next();
                 target.Add(newItem);
                 Assert.AreEqual(oldCount + 1, target.Count);
                 Assert.AreEqual(newItem, target[oldCount]);
                 break;
             case  1: // Remove by index
                 if(oldCount == 0) goto case 0;
                 var indexToRemove = r.Next(oldCount - 1);
                 target.RemoveAt(indexToRemove);
                 Assert.AreEqual(oldCount - 1, target.Count);
                 break;
             case 2: // Remove by element
                 if (oldCount == 0) goto case 0;
                 var itemToRemove = target[r.Next(oldCount - 1)];
                 target.Remove(itemToRemove);
                 Assert.AreEqual(oldCount - 1, target.Count);
                 break;
         }
     }
 }
 public void AddTest()
 {
     DynamicArray<int> Arr = new DynamicArray<int>();
     Arr.Add(23);
     Assert.AreEqual(Arr.Length, 1);
     Assert.AreEqual(Arr[0], 23);
 }
        public void AsGenericCollection()
        {
            var data = new[] { 3, 2, 4, 5, 7, -3, -2, -4, -5, -7 };
            var darray = new DynamicArray<int>(1);
            darray.Insert(data, 0, 0);

            Assert.That(darray, Is.EqualTo(data));
        }
Example #13
0
        private HeightQuadTree(int startX, int startZ, int sizeX, int sizeZ, int depth, int maxDepth)
        {
            _bounds = new MatrixBounds(startX, startZ, startX + (sizeX - 1), startZ + (sizeZ - 1));
            _depth = depth;
            _maxDepth = maxDepth;

            _indexes = new DynamicArray<VectorXZ>(10);
        }
Example #14
0
        private HeightQuadTree(MatrixBounds bounds, int depth, int maxDepth)
        {
            _bounds = bounds;
            _depth = depth;
            _maxDepth = maxDepth;

            _indexes = new DynamicArray<VectorXZ>(10);
        }
 public void AddPaymentOption(PaymentOption option)
 {
     if (option != null)
     {
         DynamicArray<PaymentOption> dynamicArray = new DynamicArray<PaymentOption>();
         PaymentOptions = dynamicArray.AddToArray(PaymentOptions, option);
     }
 }
 public void AddPaymentOptionRange(ICollection<PaymentOption> options)
 {
     if (options != null)
     {
         DynamicArray<PaymentOption> dynamicArray = new DynamicArray<PaymentOption>();
         PaymentOptions = dynamicArray.AddToArrayRange(PaymentOptions, options);
     }
 }
 public void DefConstr()
 {
     DynamicArray<int> m1 = new DynamicArray<int>();
     var a = m1.Length;
     Assert.AreEqual(a, 0);
     var b = m1.Capacity;
     Assert.AreEqual(b, 8);
 }
 public static void GenericCopyTo()
 {
     DynamicArray<int> darray = new DynamicArray<int>(1);
     DynamicArray<int> dcopy = new DynamicArray<int>(1);
     darray.Insert(Data, 0, 0);
     darray.CopyTo(dcopy, 0);
     Assert.That(darray, Is.EqualTo(dcopy));
 }
 public void ConstrOneParam()
 {
     DynamicArray<int> m2 = new DynamicArray<int>(9);
     var a = m2.Length;
     Assert.AreEqual(a, 0);
     var b = m2.Capacity;
     Assert.AreEqual(b, 9);
 }
 public static void NonGenericCopyTo()
 {
     DynamicArray<int> darray = new DynamicArray<int>(1);
     int[] copy = new int[Data.Length];
     darray.Insert(Data, 0, 0);
     ((ICollection)darray).CopyTo(copy, 0);
     Assert.That(Data, Is.EqualTo(copy));
 }
Example #21
0
 public void InsertTest()
 {
     int[] A = new int[] { 1, 2, 3, 4 };
     DynamicArray<int> testArr = new DynamicArray<int>(A);
     testArr.Insert(42, 3);
     Assert.AreEqual(testArr[3], 42);
     testArr.Insert(42, testArr.Capacity);
     Assert.AreEqual(testArr[testArr.Capacity - 1], 42);
 }
Example #22
0
 public void RemoveTest()
 {
     int[] A = new int[] { 1, 2, 3, 4 };
     DynamicArray<int> testArr = new DynamicArray<int>(A);
     testArr.Remove(2);
     bool testBool = testArr.Remove(10);
     Assert.AreEqual(testArr[1], 3);
     Assert.AreEqual(testBool, false);
 }
 public void AddMoreThanCapacityTest()
 {
     DynamicArray<int> Arr = new DynamicArray<int>(2);
     Arr.Add(65);
     Arr.Add(16);
     Arr.Add(76);
     Assert.AreEqual(Arr.Length, 3);
     Assert.AreEqual(Arr.Capacity, 4);
     Assert.AreEqual(Arr[2], 76);
 }
 public static void ExceptionOnCopyToOfMultiDim()
 {
     Assert.Throws<RankException>(
         () =>
             {
                 var dynArray = new DynamicArray<object>(2);
                 var copyActual = new object[dynArray.Count];
                 ((ICollection)dynArray).CopyTo(copyActual, 0);
             });
 }
        public void ConstrCollect()
        {
            int[] arr = new[] { 1, 2, 3, 4, 5 };
            DynamicArray<int> m3 = new DynamicArray<int>(arr);

            var a = m3.Length;
            Assert.AreEqual(a, 5);
            var b = m3.Capacity;
            Assert.AreEqual(b, 5);
        }
Example #26
0
 public void ConstrucTest2()
 {
     List<int> A = new List<int> { 1, 2, 3, 4 };
     DynamicArray<int> testArr = new DynamicArray<int>(A);
     Assert.AreEqual(testArr.Length, 4);
     Assert.AreEqual(testArr[0], 1);
     Assert.AreEqual(testArr[1], 2);
     Assert.AreEqual(testArr[2], 3);
     Assert.AreEqual(testArr[3], 4);
 }
 public void AddRangeMoreThanCapacity()
 {
     int[] a = { 28, 98, 89, 25, 43 };
     DynamicArray<int> Arr = new DynamicArray<int>(2);
     Arr.Add(68);
     Arr.Add(73);
     Arr.AddRange(a);
     Assert.AreEqual(Arr.Length, 7);
     Assert.AreEqual(Arr.Capacity, 8);
     Assert.AreEqual(Arr[2], 28);
     Assert.AreEqual(Arr[6], 43);
 }
Example #28
0
 public void TestInsertMethod()
 {
     DynamicArray<int> m3 = new DynamicArray<int>(9);
     int[] arr = new[] { 1, 2, 3, 4, 5 };
     foreach (var elem in arr)
     {
         m3.Add(elem);
     }
     m3.Insert(2, 9);
     var a1 = m3[2];
     Assert.AreEqual(a1, 9);
 }
Example #29
0
        public void TestMethod1()
        {
            try
            {
                DynamicArray<int> m1 = new DynamicArray<int>();
                DynamicArray<int> m2 = new DynamicArray<int>(9);

                int[] arr = new[] { 1, 2, 3, 4, 5 };
                DynamicArray<int> m3 = new DynamicArray<int>(arr);

                var a = m3.Length;
                Assert.AreEqual(a, 5);
                var b = m3.Capacity;
                Assert.AreEqual(b, 5);

                m3.Add(6);
                var a1 = m3.Length;
                Assert.AreEqual(a1, 6);
                var b1 = m3.Capacity;
                Assert.AreEqual(b1, 10);

                int[] arr1 = new[] { 7, 8, 9, 10, 11, 12 };
                m3.AddRange(arr1);
                var a3 = m3.Length;
                Assert.AreEqual(a3, 12);
                var b3 = m3.Capacity;
                Assert.AreEqual(b3, 20);

                var flag1 = m3.Remove(7);
                var a4 = m3.Length;
                Assert.AreEqual(a4, 11);
                Assert.AreEqual(flag1, true);

                //m3.Insert(26,14); //Попытка вставить вне границ массива
                m3.Insert(6, 7);
                var b4 = m3[6];
                Assert.AreEqual(b4, 7);

                int k = 1;
                foreach (var elem in m3)
                {
                    var a5 = elem;
                    Assert.AreEqual(a5, k);
                    k++;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Assert.AreEqual(0, 1);

            }
        }
        public void AsNonGenericCollection()
        {
            var data = new[] { 3, 2, 4, 5, 7, -3, -2, -4, -5, -7 };
            var darray = new DynamicArray<int>(1);
            darray.Insert(data, 0, 0);

            int i = 0;
            foreach (int element in (IEnumerable)darray)
            {
                Assert.AreEqual(data[i++], element);
            }
        }
Example #31
0
 public DebuggerView(DynamicArray <T> array)
 {
     this._array = array;
 }
Example #32
0
        public async Task Can_project_in_map_reduce()
        {
            using (var store = GetDocumentStore())
            {
                using (var session = store.OpenAsyncSession())
                {
                    await session.StoreAsync(new Address()
                    {
                        City = "Torun"
                    });

                    await session.StoreAsync(new Address()
                    {
                        City = "Torun"
                    });

                    await session.StoreAsync(new Address()
                    {
                        City = "Hadera"
                    });

                    await session.SaveChangesAsync();
                }

                using (var commands = store.Commands())
                {
                    // create auto map reduce index
                    var command = new QueryCommand(commands.Session, new IndexQuery
                    {
                        Query = "FROM Addresses GROUP BY City SELECT count() as TotalCount ",
                        WaitForNonStaleResults = true
                    });

                    commands.RequestExecutor.Execute(command, commands.Context);

                    // retrieve only City field
                    command = new QueryCommand(commands.Session, new IndexQuery
                    {
                        Query = "FROM Addresses GROUP BY City SELECT City ",
                        WaitForNonStaleResults = true
                    });

                    commands.RequestExecutor.Execute(command, commands.Context);

                    var indexDefinitions = store.Maintenance.Send(new GetIndexesOperation(0, 10));

                    Assert.Equal(1, indexDefinitions.Length); // the above queries should be handled by the same auto index

                    var result  = command.Result;
                    var results = new DynamicArray(result.Results);

                    var cities = new List <string> {
                        "Torun", "Hadera"
                    };
                    Assert.Equal(2, results.Count());
                    foreach (dynamic r in results)
                    {
                        var json = (DynamicBlittableJson)r;
                        Assert.Equal(2, json.BlittableJson.Count);
                        Assert.True(json.ContainsKey("City"));
                        Assert.True(json.ContainsKey(Constants.Documents.Metadata.Key));

                        var city = r.City;
                        Assert.True(cities.Remove(city));
                    }
                }
            }
        }
 public DynamicPathListSegments(Allocator allocator)
 {
     this.points   = new DynamicArray <Vector2>(0, allocator);
     this.layouts  = new DynamicArray <PathLayout>(0, allocator);
     this.segments = new DynamicArray <Segment>(0, allocator);
 }
Example #34
0
        static ChemicalBlock()
        {
            var list = new DynamicArray <IChemicalItem>(new IChemicalItem[] {
                new Cylinder("H₂"),
                new Cylinder("O₂"),
                new Cylinder("CO₂"),
                new Cylinder("CO"),
                new Cylinder("Cl₂"),
                new Cylinder("N₂"),
                new Cylinder("NH₃"),
                new Cylinder("NO₂"),
                new Cylinder("NO"),
                new Cylinder("N₂O"),
                new Cylinder("HCl"),
                new Cylinder("SO₂"),
                new Cylinder("H₂S"),
                new Cylinder("HF"),
                new Cylinder("PH₃"),
                new Cylinder("C₂H₂"),
                new Cylinder("(CN)₂"),
                new Cylinder("Cl₂O"),
                new Cylinder("ClO₂"),
                new PurePowder("Na₂O"),
                new PurePowder("Na₂O₂", Color.LightYellow),
                new PurePowder("MgO"),
                new PurePowder("Al₂O₃"),
                new PurePowder("K₂O"),
                new PurePowder("CaO"),
                new PurePowder("Cr₂O₃", Color.DarkGreen),
                new PurePowder("MnO", Color.Black),
                new PurePowder("MnO₂", Color.Black),
                new PurePowder("Fe₂O₃", Color.DarkRed),
                new PurePowder("Fe₃O₄", Color.Black),
                new PurePowder("CuO", Color.Black),
                new PurePowder("Cu₂O", Color.Red),
                new PurePowder("CuCl"),
                new PurePowder("ZnO"),
                new PurePowder("Ag₂O"),
                new PurePowder("HgO", new Color(227, 23, 13)),
                new PurePowder("PbO", Color.Yellow),
                new PurePowder("PbO₂", Color.Black),
                new PurePowder("CaC₂", new Color(25, 25, 25)),
                new PurePowder("Mg₃N₂", Color.LightYellow),
                new PurePowder("SiO₂"),
                new PurePowder("SiC", new Color(25, 25, 25)),
                new PurePowder("P₂O₅"),
                new PurePowder("P₄O₆"),
                new PurePowder("PCl₃"),
                new PurePowder("PCl₅"),
            });

            for (int i = 0; i < Cations.Length; i++)
            {
                AtomKind atom  = Cations[i].Array[0].Atom;
                Color    color = atom == AtomKind.Fe
                                        ? Cations[i].Charge == 2 ? Color.LightGreen : Color.DarkRed
                                        : atom == AtomKind.Cu ? Color.Blue : Color.White;
                for (int j = atom == AtomKind.Ag || Cations[i].Count == 2 ? 1 : 0; j < Anions.Length; j++)
                {
                    list.Add(new PurePowder(Cations[i] + Anions[j], color));
                }
            }
            list.Add(new PurePowder("H₂(SiO₃)"));
            list.Add(new PurePowder("Na₂(SiO₃)"));
            list.Add(new PurePowder("Mg(SiO₃)"));
            list.Add(new PurePowder("Ca(SiO₃)"));
            list.Add(new PurePowder("Na(HCO₃)"));
            list.Add(new PurePowder("Na₂S₂O₃"));
            list.Add(new PurePowder("Ca(ClO)₂"));
            list.Add(new PurePowder("Na(ClO₂)"));
            list.Add(new PurePowder("Mg(ClO₂)₂"));
            list.Add(new PurePowder("K(ClO₂)"));
            list.Add(new PurePowder("Ca(ClO₂)₂"));
            list.Add(new PurePowder("Ba(ClO₂)₂"));
            list.Add(new PurePowder("Na(ClO₃)"));
            list.Add(new PurePowder("Mg(ClO₃)₂"));
            list.Add(new PurePowder("K(ClO₃)"));
            list.Add(new PurePowder("Ca(ClO₃)₂"));
            list.Add(new PurePowder("Ba(ClO₃)₂"));
            list.Add(new PurePowder("Na(ClO₄)"));
            list.Add(new PurePowder("Mg(ClO₄)₂"));
            list.Add(new PurePowder("K(ClO₄)"));
            list.Add(new PurePowder("Ca(ClO₄)₂"));
            list.Add(new PurePowder("Ba(ClO₄)₂"));
            list.Add(new PurePowder("Na(CN)"));
            list.Add(new PurePowder("K(CN)"));
            list.Add(new PurePowder("Ca(CN)"));
            list.Add(new PurePowder("K₂(HPO₄)"));
            list.Add(new PurePowder("K(H₂PO₄)"));
            list.Add(new PurePowder("Na₂(HPO₄)"));
            list.Add(new PurePowder("Na(H₂PO₄)"));
            list.Add(new PurePowder("Na₂Cr₂O₇"));
            list.Add(new PurePowder("K₂Cr₂O₇"));
            list.Add(new PurePowder("Cu₃P"));
            list.Add(new PurePowder("NH₄H"));
            list.Add(new PurePowder("LiH"));
            list.Add(new PurePowder("NaH"));
            list.Add(new PurePowder("MgH₂"));
            //list.Add(new PurePowder("AlH₃"));
            list.Add(new PurePowder("KH"));
            list.Add(new PurePowder("CaH₂"));
            list.Add(new PurePowder("Na₃P"));
            //list.Add(new Cylinder("B₂H₆"));
            list.Add(new Cylinder("C₂H₄"));
            list.Capacity = list.m_count;
            Items         = list.Array;
        }
Example #35
0
 public static IEnumerator GetDynamicArrayIEnumerator(DynamicArray dynamicArray)
 {
     finalDynamic = GetDynamicArray(dynamicArray);
     yield return(new WaitForSeconds(0.1f));
 }
 public Arrangement(DynamicArray <string> dynamicArray)
 {
     SUT = dynamicArray;
 }
Example #37
0
        public Grouping(IEnumerable <TransientGroup <T> > members)
        {
            Ensure.ArgumentNotNull(members, "members");

            _members = new DynamicArray <TransientGroup <T> >(members);
        }
 public ArrangementBuilder WithCapacity(int capacity)
 {
     dynamicArray = new DynamicArray <string>(capacity);
     return(this);
 }
Example #39
0
 public void SetUp()
 {
     _array = new DynamicArray <string>();
 }
Example #40
0
 public GraphBase(bool directed)
 {
     _Nodes   = new DynamicArray <Node <TNode> >(_AverageEdges);
     Directed = directed;
 }
Example #41
0
        private void CreateCameraEventsAndBorders(Identity identity)
        {
            //Right side
            List <GameEventCommand> rightBorderEventCommands = new List <GameEventCommand>();

            rightBorderEventCommands.Add(new GameEventCommand("Game", null, "PauseLogic", DynamicArray.ObjectArray(1), 0));
            rightBorderEventCommands.Add(new GameEventCommand("Camera", null, "MoveBy", DynamicArray.ObjectArray(new Vector2(1280.0f, 0), 2000), 0));
            rightBorderEventCommands.Add(new GameEventCommand("Game", null, "ResumeLogic", DynamicArray.ObjectArray(1), 2000));
            GameEvent rightBorderEvent = new GameEvent(rightBorderEventCommands);

            Trigger rightCameraBorder = new Trigger(new Vector2(1330, 400), new Rectangle(0, 0, 50, 2000), "Right Camera Object", GameEventCondition.RightCameraBorderId, identity, this.world, 0, true);

            GameEventCondition rightCameraBorderCondition = new GameEventCondition(GameEventCondition.RightCameraBorderId, rightBorderEvent);

            base.AddEventCondition(rightCameraBorderCondition);

            //Left side
            List <GameEventCommand> leftBorderEventCommands = new List <GameEventCommand>();

            leftBorderEventCommands.Add(new GameEventCommand("Game", null, "PauseLogic", DynamicArray.ObjectArray(1), 0));
            leftBorderEventCommands.Add(new GameEventCommand("Camera", null, "MoveBy", DynamicArray.ObjectArray(new Vector2(-1280.0f, 0), 2000), 0));
            leftBorderEventCommands.Add(new GameEventCommand("Game", null, "ResumeLogic", DynamicArray.ObjectArray(1), 2000));
            GameEvent leftBorderEvent = new GameEvent(leftBorderEventCommands);

            Trigger leftCameraBorder = new Trigger(new Vector2(-50, 400), new Rectangle(0, 0, 50, 2000), "Left Camera Object", GameEventCondition.LeftCameraBorderId, identity, this.world, 0, true);

            GameEventCondition leftCameraBorderCondition = new GameEventCondition(GameEventCondition.LeftCameraBorderId, leftBorderEvent);

            base.AddEventCondition(leftCameraBorderCondition);

            //Unlock Horizontally
            GameEvent          unlockCameraHorizontallyEvent     = new GameEvent(new GameEventCommand("Camera", null, "UnlockHorizontally", DynamicArray.ObjectArray(50), 0));
            GameEventCondition unlockCameraHorizontallyCondition = new GameEventCondition(GameEventCondition.UnlockCameraHorizontallyId, unlockCameraHorizontallyEvent);

            base.AddEventCondition(unlockCameraHorizontallyCondition);

            //Lock Horizontally
            GameEvent          lockCameraHorizontallyEvent     = new GameEvent(new GameEventCommand("Camera", null, "LockHorizontally", DynamicArray.ObjectArray(1), 0));
            GameEventCondition lockCameraHorizontallyCondition = new GameEventCondition(GameEventCondition.LockCameraHorizontallyId, lockCameraHorizontallyEvent);

            base.AddEventCondition(lockCameraHorizontallyCondition);

            //Unlock Vertically
            GameEvent          unlockCameraVerticallyEvent     = new GameEvent(new GameEventCommand("Camera", null, "UnlockVertically", DynamicArray.ObjectArray(50), 0));
            GameEventCondition unlockCameraVerticallyCondition = new GameEventCondition(GameEventCondition.UnlockCameraVerticallyId, unlockCameraVerticallyEvent);

            base.AddEventCondition(unlockCameraVerticallyCondition);

            //Lock Vertically
            GameEvent          lockCameraVerticallyEvent     = new GameEvent(new GameEventCommand("Camera", null, "LockVertically", DynamicArray.ObjectArray(1), 0));
            GameEventCondition lockCameraVerticallyCondition = new GameEventCondition(GameEventCondition.LockCameraVerticallyId, lockCameraVerticallyEvent);

            base.AddEventCondition(lockCameraVerticallyCondition);

            //Test unlocker
            //CameraObject co = new CameraObject(1280, 2, new Vector2(640, 300), CameraObject.UnlockWhenPlayerMovesRight, "TestCameraObject");
        }
Example #42
0
 public Grouping(int capacity)
 {
     _members = new DynamicArray <TransientGroup <T> >(capacity);
 }
 public ArrangementBuilder WithDefault()
 {
     dynamicArray = new DynamicArray <string>();
     return(this);
 }
Example #44
0
        public void ExceptionOnInsertArrayWithANullLength()
        {
            var dynArray = new DynamicArray <int>(2);

            Assert.Throws <ArgumentException>(() => dynArray.Insert(new int[5, 0], 0, 0, 0));
        }
Example #45
0
        public float CalculateSmoothRisePushBack(BoundingBox normalBox, BoundingBox smoothRiseBox, int axis, DynamicArray <CollisionBox> collisionBoxes, out CollisionBox pushingCollisionBox)
        {
            pushingCollisionBox = default(CollisionBox);
            float num = 0f;

            for (int i = 0; i < collisionBoxes.Count; i++)
            {
                float num2 = (!BlocksManager.Blocks[Terrain.ExtractContents(collisionBoxes.Array[i].BlockValue)].NoSmoothRise) ? CalculateBoxBoxOverlap(ref smoothRiseBox, ref collisionBoxes.Array[i].Box, axis) : CalculateBoxBoxOverlap(ref normalBox, ref collisionBoxes.Array[i].Box, axis);
                if (MathUtils.Abs(num2) > MathUtils.Abs(num))
                {
                    num = num2;
                    pushingCollisionBox = collisionBoxes.Array[i];
                }
            }
            return(num);
        }
Example #46
0
 /// <summary>
 /// Gets the walkable successors of the specified node.
 /// </summary>
 /// <param name="current">The current node.</param>
 /// <param name="successorArray">The array to fill with successors.</param>
 /// <returns>All walkable successors of the node.</returns>
 protected virtual void GetWalkableSuccessors(IPathNode current, DynamicArray <IPathNode> successorArray)
 {
     current.GetWalkableNeighbours(successorArray, _unitProps, _cutCorners, _preventDiagonalMoves);
 }
Example #47
0
        public static void Insert2D()
        {
            const int O_ROWS = 4;
            const int O_COLS = 2;
            const int A_ROWS = 4;
            const int A_COLS = 3;
            const int B_ROWS = 2;
            const int B_COLS = 2;

            // Arrays O, A and B
            object[,] oarray = ArrayHelper.New().NewArray <object>(O_ROWS, O_COLS).FillWith("O").As <object[, ]>();
            object[,] aarray = ArrayHelper.New().NewArray <object>(A_ROWS, A_COLS).FillWith("A").As <object[, ]>();
            object[,] barray = ArrayHelper.New().NewArray <object>(B_ROWS, B_COLS).FillWith("B").As <object[, ]>();

            // NOTE capacities are set to the minimum to force buffer resize
            DynamicArray <object> dynArray = new DynamicArray <object>(2, 1, 1);

            // Insert O at (O_ROW_POS, O_COL_POS)
            const int O_ROW_POS = 0;
            const int O_COL_POS = 2;

            dynArray.Insert(oarray, 0, O_ROW_POS, O_COL_POS);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, oarray, O_ROW_POS, O_COL_POS);
            DynamicArrayAssert.CountsEqual(dynArray, O_ROW_POS + O_ROWS, O_COL_POS + O_COLS);

            // Insert A at (A_ROW_POS, A_COL_POS) in dim 0
            // Must have: (A_ROW_POS > O_ROW_POS) && (A_ROW_POS < O_ROW_POS + O_ROWS)
            // in order to insert A "within" O
            const int A_ROW_POS = 1;
            const int A_COL_POS = 1;

            Assert.IsTrue(A_ROW_POS > O_ROW_POS);
            Assert.IsTrue(A_ROW_POS < O_ROW_POS + O_ROWS);
            dynArray.Insert(aarray, 0, A_ROW_POS, A_COL_POS);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, aarray, A_ROW_POS, A_COL_POS);
            DynamicArrayAssert.Included(
                dynArray,
                oarray,
                new int[] { O_ROW_POS, O_COL_POS },
                Zero2DIdx,
                new int[] { A_ROW_POS - O_ROW_POS, O_COLS });
            DynamicArrayAssert.Included(
                dynArray,
                oarray,
                new int[] { A_ROW_POS + A_ROWS, O_COL_POS },
                new int[] { A_ROW_POS - O_ROW_POS, 0 },
                new int[] { O_ROWS, O_COLS });

            // Insert B at (B_ROW_POS, B_COL_POS) in dim 1
            const int B_ROW_POS = 2;
            const int B_COL_POS = 1;

            dynArray.Insert(barray, 1, B_ROW_POS, B_COL_POS);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, barray, B_ROW_POS, B_COL_POS);
            DynamicArrayAssert.Included(
                dynArray,
                aarray,
                new int[] { B_ROW_POS, B_COL_POS + B_COLS },
                new int[] { B_ROW_POS - A_ROW_POS, B_COL_POS - A_COL_POS },
                new int[] { B_ROW_POS - A_ROW_POS + B_ROWS, A_COLS });
        }
Example #48
0
        public void FindSneakCollisionBoxes(Vector3 position, Vector2 overhang, DynamicArray <CollisionBox> result)
        {
            int num  = Terrain.ToCell(position.X);
            int num2 = Terrain.ToCell(position.Y);
            int num3 = Terrain.ToCell(position.Z);

            if (BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num, num2 - 1, num3)].IsCollidable)
            {
                return;
            }
            bool         num4 = position.X < (float)num + 0.5f;
            bool         flag = position.Z < (float)num3 + 0.5f;
            CollisionBox item;

            if (num4)
            {
                if (flag)
                {
                    bool isCollidable  = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num, num2 - 1, num3 - 1)].IsCollidable;
                    bool isCollidable2 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num - 1, num2 - 1, num3)].IsCollidable;
                    bool isCollidable3 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num - 1, num2 - 1, num3 - 1)].IsCollidable;
                    if ((isCollidable && !isCollidable2) || ((!isCollidable && !isCollidable2) & isCollidable3))
                    {
                        item = new CollisionBox
                        {
                            Box        = new BoundingBox(new Vector3(num, num2, (float)num3 + overhang.Y), new Vector3(num + 1, num2 + 1, num3 + 1)),
                            BlockValue = 0
                        };
                        result.Add(item);
                    }
                    if ((!isCollidable && isCollidable2) || ((!isCollidable && !isCollidable2) & isCollidable3))
                    {
                        item = new CollisionBox
                        {
                            Box        = new BoundingBox(new Vector3((float)num + overhang.X, num2, num3), new Vector3(num + 1, num2 + 1, num3 + 1)),
                            BlockValue = 0
                        };
                        result.Add(item);
                    }
                    if (isCollidable && isCollidable2)
                    {
                        item = new CollisionBox
                        {
                            Box        = new BoundingBox(new Vector3((float)num + overhang.X, num2, (float)num3 + overhang.Y), new Vector3(num + 1, num2 + 1, num3 + 1)),
                            BlockValue = 0
                        };
                        result.Add(item);
                    }
                }
                else
                {
                    bool isCollidable4 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num, num2 - 1, num3 + 1)].IsCollidable;
                    bool isCollidable5 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num - 1, num2 - 1, num3)].IsCollidable;
                    bool isCollidable6 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num - 1, num2 - 1, num3 + 1)].IsCollidable;
                    if ((isCollidable4 && !isCollidable5) || ((!isCollidable4 && !isCollidable5) & isCollidable6))
                    {
                        item = new CollisionBox
                        {
                            Box        = new BoundingBox(new Vector3(num, num2, num3), new Vector3(num + 1, num2 + 1, (float)(num3 + 1) - overhang.Y)),
                            BlockValue = 0
                        };
                        result.Add(item);
                    }
                    if ((!isCollidable4 && isCollidable5) || ((!isCollidable4 && !isCollidable5) & isCollidable6))
                    {
                        item = new CollisionBox
                        {
                            Box        = new BoundingBox(new Vector3((float)num + overhang.X, num2, num3), new Vector3(num + 1, num2 + 1, num3 + 1)),
                            BlockValue = 0
                        };
                        result.Add(item);
                    }
                    if (isCollidable4 && isCollidable5)
                    {
                        item = new CollisionBox
                        {
                            Box        = new BoundingBox(new Vector3((float)num + overhang.X, num2, num3), new Vector3(num + 1, num2 + 1, (float)(num3 + 1) - overhang.Y)),
                            BlockValue = 0
                        };
                        result.Add(item);
                    }
                }
            }
            else if (flag)
            {
                bool isCollidable7 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num, num2 - 1, num3 - 1)].IsCollidable;
                bool isCollidable8 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num + 1, num2 - 1, num3)].IsCollidable;
                bool isCollidable9 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num + 1, num2 - 1, num3 - 1)].IsCollidable;
                if ((isCollidable7 && !isCollidable8) || ((!isCollidable7 && !isCollidable8) & isCollidable9))
                {
                    item = new CollisionBox
                    {
                        Box        = new BoundingBox(new Vector3(num, num2, (float)num3 + overhang.Y), new Vector3(num + 1, num2 + 1, num3 + 1)),
                        BlockValue = 0
                    };
                    result.Add(item);
                }
                if ((!isCollidable7 && isCollidable8) || ((!isCollidable7 && !isCollidable8) & isCollidable9))
                {
                    item = new CollisionBox
                    {
                        Box        = new BoundingBox(new Vector3(num, num2, num3), new Vector3((float)(num + 1) - overhang.X, num2 + 1, num3 + 1)),
                        BlockValue = 0
                    };
                    result.Add(item);
                }
                if (isCollidable7 && isCollidable8)
                {
                    item = new CollisionBox
                    {
                        Box        = new BoundingBox(new Vector3(num, num2, (float)num3 + overhang.Y), new Vector3((float)(num + 1) - overhang.X, num2 + 1, num3 + 1)),
                        BlockValue = 0
                    };
                    result.Add(item);
                }
            }
            else
            {
                bool isCollidable10 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num, num2 - 1, num3 + 1)].IsCollidable;
                bool isCollidable11 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num + 1, num2 - 1, num3)].IsCollidable;
                bool isCollidable12 = BlocksManager.Blocks[m_subsystemTerrain.Terrain.GetCellContents(num + 1, num2 - 1, num3 + 1)].IsCollidable;
                if ((isCollidable10 && !isCollidable11) || ((!isCollidable10 && !isCollidable11) & isCollidable12))
                {
                    item = new CollisionBox
                    {
                        Box        = new BoundingBox(new Vector3(num, num2, num3), new Vector3(num + 1, num2 + 1, (float)(num3 + 1) - overhang.Y)),
                        BlockValue = 0
                    };
                    result.Add(item);
                }
                if ((!isCollidable10 && isCollidable11) || ((!isCollidable10 && !isCollidable11) & isCollidable12))
                {
                    item = new CollisionBox
                    {
                        Box        = new BoundingBox(new Vector3(num, num2, num3), new Vector3((float)(num + 1) - overhang.X, num2 + 1, num3 + 1)),
                        BlockValue = 0
                    };
                    result.Add(item);
                }
                if (isCollidable10 && isCollidable11)
                {
                    item = new CollisionBox
                    {
                        Box        = new BoundingBox(new Vector3(num, num2, num3), new Vector3((float)(num + 1) - overhang.X, num2 + 1, (float)(num3 + 1) - overhang.Y)),
                        BlockValue = 0
                    };
                    result.Add(item);
                }
            }
        }
Example #49
0
        public static void Resize2D()
        {
            // Should have B_COLS < A_COLS
            const int A_ROWS = 4;
            const int A_COLS = 3;
            const int B_ROWS = 5;
            const int B_COLS = 2;

            // Arrays O, A and B
            object[,] arrA = ArrayHelper.New().NewArray <object>(A_ROWS, A_COLS).FillWith("A").As <object[, ]>();
            object[,] arrB = ArrayHelper.New().NewArray <object>(B_ROWS, B_COLS).FillWith("B").As <object[, ]>();

            // NOTE capacities are set to the minimum to force buffer resize
            DynamicArray <object> dynArray = new DynamicArray <object>(2, 1, 1);

            // Insert B at 0,0
            dynArray.Insert(arrB, 0, 0, 0);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.AreElementsEqual(dynArray, arrB);

            // Insert A right before B in dim 1
            dynArray.Insert(arrA, 0, 0, 0);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, arrA, 0, 0);
            DynamicArrayAssert.Included(dynArray, arrB, A_ROWS, 0);
            DynamicArrayAssert.CountsEqual(dynArray, A_ROWS + B_ROWS, A_COLS);

            // Remove B_ROWS lines and add NCols columns
            const int NCols = 5;

            dynArray.Resize(A_ROWS, A_COLS + NCols);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, arrA, 0, 0);
            DynamicArrayAssert.AreElementsDefault(dynArray, new int[] { A_ROWS, NCols }, 0, A_COLS);
            DynamicArrayAssert.CountsEqual(dynArray, A_ROWS, A_COLS + NCols);

            // Add NRows rows
            const int NRows = 10;

            dynArray.ResizeDim(0, A_ROWS + NRows);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.CountsEqual(dynArray, A_ROWS + NRows, A_COLS + NCols);
            DynamicArrayAssert.Included(dynArray, arrA, 0, 0);
            DynamicArrayAssert.AreElementsDefault(dynArray, new int[] { NRows, A_COLS + NCols }, A_ROWS, 0);
            DynamicArrayAssert.AreElementsDefault(dynArray, new int[] { A_ROWS + NRows, NCols }, 0, A_COLS);

            // Shrink to (NFewRows, NFewCols)
            const int NFewCols = 2;
            const int NFewRows = 3;

            dynArray.Resize(NFewRows, NFewCols);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, arrA, Zero2DIdx, Zero2DIdx, new int[] { NFewRows, NFewCols });

            // Enlarge to (NManyRows, NManyCols)
            const int NManyRows = 10;
            const int NManyCols = 7;

            dynArray.Resize(NManyRows, NManyCols);
            ArrayHelper.Print(dynArray);
            DynamicArrayAssert.Included(dynArray, arrA, Zero2DIdx, Zero2DIdx, new int[] { NFewRows, NFewCols });
            DynamicArrayAssert.AreElementsDefault(dynArray, new[] { NManyRows, NManyCols - NFewCols }, 0, NFewCols);
            DynamicArrayAssert.AreElementsDefault(dynArray, new[] { NManyRows - NFewRows, NFewCols }, NFewRows, 0);
        }
Example #50
0
 /// <summary>
 /// Creates a new instance of <see cref="RuntimeScopeStack"/>.
 /// </summary>
 /// <param name="initialCapacity">The initial capacity of the stack.</param>
 /// <param name="parentScope">The scope stack which the new scope stack should extend,
 /// or null if the new scope stack should not extend an enclosing scope.</param>
 public RuntimeScopeStack(int initialCapacity = 0, RuntimeScopeStack?parentScope = null)
 {
     m_items       = new DynamicArray <Item>(initialCapacity);
     m_parentScope = parentScope;
 }
Example #51
0
 public static Dynamic[] GetDynamicArray(DynamicArray dynamicArray)
 {
     Dynamic[] dynamics = new Dynamic[0];
     return(dynamics);
 }
Example #52
0
 public DynamicPlainShape(NativeArray <IntVector> points, NativeArray <PathLayout> layouts)
 {
     this.points  = new DynamicArray <IntVector>(points);
     this.layouts = new DynamicArray <PathLayout>(layouts);
 }
Example #53
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            TerrainGeometrySubset[] alphaTestSubsetsByFace = geometry.AlphaTestSubsetsByFace;
            int data   = Terrain.ExtractData(value);
            int value2 = (y + 1 < 256) ? generator.Terrain.GetCellValueFast(x, y + 1, z) : 0;
            int num    = Terrain.ExtractContents(value2);
            int data2  = Terrain.ExtractData(value2);
            int value3 = (y + 2 < 256) ? generator.Terrain.GetCellValueFast(x, y + 2, z) : 0;
            int num2   = Terrain.ExtractContents(value3);
            int data3  = Terrain.ExtractData(value3);

            if (HasFireOnFace(data, 0))
            {
                int value4 = (y + 1 < 256) ? generator.Terrain.GetCellValueFast(x, y + 1, z + 1) : 0;
                int num3   = Terrain.ExtractContents(value4);
                int data4  = Terrain.ExtractData(value4);
                int value5 = (y + 2 < 256) ? generator.Terrain.GetCellValueFast(x, y + 2, z + 1) : 0;
                int num4   = Terrain.ExtractContents(value5);
                int data5  = Terrain.ExtractData(value5);
                int num5   = DefaultTextureSlot;
                if ((num == 104 && HasFireOnFace(data2, 0)) || (num3 == 104 && HasFireOnFace(data4, 2)))
                {
                    num5 += 16;
                    if ((num2 == 104 && HasFireOnFace(data3, 0)) || (num4 == 104 && HasFireOnFace(data5, 2)))
                    {
                        num5 += 16;
                    }
                }
                DynamicArray <TerrainVertex> vertices = alphaTestSubsetsByFace[0].Vertices;
                DynamicArray <ushort>        indices  = alphaTestSubsetsByFace[0].Indices;
                int count = vertices.Count;
                vertices.Count += 4;
                BlockGeometryGenerator.SetupLitCornerVertex(x, y, z + 1, Color.White, num5, 0, ref vertices.Array[count]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y, z + 1, Color.White, num5, 1, ref vertices.Array[count + 1]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y + 1, z + 1, Color.White, num5, 2, ref vertices.Array[count + 2]);
                BlockGeometryGenerator.SetupLitCornerVertex(x, y + 1, z + 1, Color.White, num5, 3, ref vertices.Array[count + 3]);
                indices.Add((ushort)count);
                indices.Add((ushort)(count + 1));
                indices.Add((ushort)(count + 2));
                indices.Add((ushort)(count + 2));
                indices.Add((ushort)(count + 1));
                indices.Add((ushort)count);
                indices.Add((ushort)(count + 2));
                indices.Add((ushort)(count + 3));
                indices.Add((ushort)count);
                indices.Add((ushort)count);
                indices.Add((ushort)(count + 3));
                indices.Add((ushort)(count + 2));
            }
            if (HasFireOnFace(data, 1))
            {
                int value6 = (y + 1 < 256) ? generator.Terrain.GetCellValueFast(x + 1, y + 1, z) : 0;
                int num6   = Terrain.ExtractContents(value6);
                int data6  = Terrain.ExtractData(value6);
                int value7 = (y + 2 < 256) ? generator.Terrain.GetCellValueFast(x + 1, y + 2, z) : 0;
                int num7   = Terrain.ExtractContents(value7);
                int data7  = Terrain.ExtractData(value7);
                int num8   = DefaultTextureSlot;
                if ((num == 104 && HasFireOnFace(data2, 1)) || (num6 == 104 && HasFireOnFace(data6, 3)))
                {
                    num8 += 16;
                    if ((num2 == 104 && HasFireOnFace(data3, 1)) || (num7 == 104 && HasFireOnFace(data7, 3)))
                    {
                        num8 += 16;
                    }
                }
                DynamicArray <TerrainVertex> vertices2 = alphaTestSubsetsByFace[1].Vertices;
                DynamicArray <ushort>        indices2  = alphaTestSubsetsByFace[1].Indices;
                int count2 = vertices2.Count;
                vertices2.Count += 4;
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y, z, Color.White, num8, 0, ref vertices2.Array[count2]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y + 1, z, Color.White, num8, 3, ref vertices2.Array[count2 + 1]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y + 1, z + 1, Color.White, num8, 2, ref vertices2.Array[count2 + 2]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y, z + 1, Color.White, num8, 1, ref vertices2.Array[count2 + 3]);
                indices2.Add((ushort)count2);
                indices2.Add((ushort)(count2 + 1));
                indices2.Add((ushort)(count2 + 2));
                indices2.Add((ushort)(count2 + 2));
                indices2.Add((ushort)(count2 + 1));
                indices2.Add((ushort)count2);
                indices2.Add((ushort)(count2 + 2));
                indices2.Add((ushort)(count2 + 3));
                indices2.Add((ushort)count2);
                indices2.Add((ushort)count2);
                indices2.Add((ushort)(count2 + 3));
                indices2.Add((ushort)(count2 + 2));
            }
            if (HasFireOnFace(data, 2))
            {
                int value8 = (y + 1 < 256) ? generator.Terrain.GetCellValueFast(x, y + 1, z - 1) : 0;
                int num9   = Terrain.ExtractContents(value8);
                int data8  = Terrain.ExtractData(value8);
                int value9 = (y + 2 < 256) ? generator.Terrain.GetCellValueFast(x, y + 2, z - 1) : 0;
                int num10  = Terrain.ExtractContents(value9);
                int data9  = Terrain.ExtractData(value9);
                int num11  = DefaultTextureSlot;
                if ((num == 104 && HasFireOnFace(data2, 2)) || (num9 == 104 && HasFireOnFace(data8, 0)))
                {
                    num11 += 16;
                    if ((num2 == 104 && HasFireOnFace(data3, 2)) || (num10 == 104 && HasFireOnFace(data9, 0)))
                    {
                        num11 += 16;
                    }
                }
                DynamicArray <TerrainVertex> vertices3 = alphaTestSubsetsByFace[2].Vertices;
                DynamicArray <ushort>        indices3  = alphaTestSubsetsByFace[2].Indices;
                int count3 = vertices3.Count;
                vertices3.Count += 4;
                BlockGeometryGenerator.SetupLitCornerVertex(x, y, z, Color.White, num11, 0, ref vertices3.Array[count3]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y, z, Color.White, num11, 1, ref vertices3.Array[count3 + 1]);
                BlockGeometryGenerator.SetupLitCornerVertex(x + 1, y + 1, z, Color.White, num11, 2, ref vertices3.Array[count3 + 2]);
                BlockGeometryGenerator.SetupLitCornerVertex(x, y + 1, z, Color.White, num11, 3, ref vertices3.Array[count3 + 3]);
                indices3.Add((ushort)count3);
                indices3.Add((ushort)(count3 + 2));
                indices3.Add((ushort)(count3 + 1));
                indices3.Add((ushort)(count3 + 1));
                indices3.Add((ushort)(count3 + 2));
                indices3.Add((ushort)count3);
                indices3.Add((ushort)(count3 + 2));
                indices3.Add((ushort)count3);
                indices3.Add((ushort)(count3 + 3));
                indices3.Add((ushort)(count3 + 3));
                indices3.Add((ushort)count3);
                indices3.Add((ushort)(count3 + 2));
            }
            if (!HasFireOnFace(data, 3))
            {
                return;
            }
            int value10 = (y + 1 < 256) ? generator.Terrain.GetCellValueFast(x - 1, y + 1, z) : 0;
            int num12   = Terrain.ExtractContents(value10);
            int data10  = Terrain.ExtractData(value10);
            int value11 = (y + 2 < 256) ? generator.Terrain.GetCellValueFast(x - 1, y + 2, z) : 0;
            int num13   = Terrain.ExtractContents(value11);
            int data11  = Terrain.ExtractData(value11);
            int num14   = DefaultTextureSlot;

            if ((num == 104 && HasFireOnFace(data2, 3)) || (num12 == 104 && HasFireOnFace(data10, 1)))
            {
                num14 += 16;
                if ((num2 == 104 && HasFireOnFace(data3, 3)) || (num13 == 104 && HasFireOnFace(data11, 1)))
                {
                    num14 += 16;
                }
            }
            DynamicArray <TerrainVertex> vertices4 = alphaTestSubsetsByFace[3].Vertices;
            DynamicArray <ushort>        indices4  = alphaTestSubsetsByFace[3].Indices;
            int count4 = vertices4.Count;

            vertices4.Count += 4;
            BlockGeometryGenerator.SetupLitCornerVertex(x, y, z, Color.White, num14, 0, ref vertices4.Array[count4]);
            BlockGeometryGenerator.SetupLitCornerVertex(x, y + 1, z, Color.White, num14, 3, ref vertices4.Array[count4 + 1]);
            BlockGeometryGenerator.SetupLitCornerVertex(x, y + 1, z + 1, Color.White, num14, 2, ref vertices4.Array[count4 + 2]);
            BlockGeometryGenerator.SetupLitCornerVertex(x, y, z + 1, Color.White, num14, 1, ref vertices4.Array[count4 + 3]);
            indices4.Add((ushort)count4);
            indices4.Add((ushort)(count4 + 2));
            indices4.Add((ushort)(count4 + 1));
            indices4.Add((ushort)(count4 + 1));
            indices4.Add((ushort)(count4 + 2));
            indices4.Add((ushort)count4);
            indices4.Add((ushort)(count4 + 2));
            indices4.Add((ushort)count4);
            indices4.Add((ushort)(count4 + 3));
            indices4.Add((ushort)(count4 + 3));
            indices4.Add((ushort)count4);
            indices4.Add((ushort)(count4 + 2));
        }
Example #54
0
 public DynamicPlainShape(NativeSlice <IntVector> points, bool isClockWise, Allocator allocator)
 {
     this.points  = new DynamicArray <IntVector>(points, allocator);
     this.layouts = new DynamicArray <PathLayout>(1, allocator);
     this.layouts.Add(new PathLayout(0, points.Length, isClockWise));
 }
 public DynamicPathListSegments(int minimumPointsCapacity, int minimumLayoutsCapacity, int minimumSegmentsCapacity, Allocator allocator)
 {
     this.points   = new DynamicArray <Vector2>(minimumPointsCapacity, allocator);
     this.layouts  = new DynamicArray <PathLayout>(minimumLayoutsCapacity, allocator);
     this.segments = new DynamicArray <Segment>(minimumSegmentsCapacity, allocator);
 }
Example #56
0
 public DynamicPlainShape(int pointsCapacity, int layoutsCapacity, Allocator allocator)
 {
     this.points  = new DynamicArray <IntVector>(pointsCapacity, allocator);
     this.layouts = new DynamicArray <PathLayout>(layoutsCapacity, allocator);
 }
        public void EmptyArrayToString()
        {
            DynamicArray array = new DynamicArray();

            Assert.AreEqual("[]", array.ToString());
        }
Example #58
0
 public DynamicPlainShape(Allocator allocator)
 {
     this.points  = new DynamicArray <IntVector>(allocator);
     this.layouts = new DynamicArray <PathLayout>(allocator);
 }
Example #59
0
 public DynamicPlainShapeList(int minimumPointsCapacity, int minimumLayoutsCapacity, int minimumSegmentsCapacity, Allocator allocator)
 {
     this.points   = new DynamicArray <IntVector>(minimumPointsCapacity, allocator);
     this.layouts  = new DynamicArray <PathLayout>(minimumLayoutsCapacity, allocator);
     this.segments = new DynamicArray <Segment>(minimumSegmentsCapacity, allocator);
 }
Example #60
0
 internal Enumerator(DynamicArray <T> list)
 {
     this.list = list;
     index     = 0;
     Current   = default(T);
 }