예제 #1
0
        void computeTriangleIndices(int totalTris = 20)
        {
            _indices.reset();

            // compute the indices to form triangles
            for (var i = 0; i < totalTris; i += 2)
            {
                _indices.add(0);
                _indices.add((short)(i + 2));
                _indices.add((short)(i + 1));
            }
        }
예제 #2
0
        /// <summary>
        /// adds a curve to the bezier
        /// </summary>
        /// <param name="start">Start.</param>
        /// <param name="firstControlPoint">First control point.</param>
        /// <param name="secondControlPoint">Second control point.</param>
        public void addCurve(Vector2 start, Vector2 firstControlPoint, Vector2 secondControlPoint, Vector2 end)
        {
            // we only add the start point if this is the first curve. For all other curves the previous end should equal the start of the new curve.
            if (_points.length == 0)
            {
                _points.add(start);
            }

            _points.add(firstControlPoint);
            _points.add(secondControlPoint);
            _points.add(end);

            _curveCount = (_points.length - 1) / 3;
        }
예제 #3
0
        void IUpdatableManager.update()
        {
            _isUpdating = true;

            // loop backwards so we can remove completed tweens
            for (var i = _activeTweens.length - 1; i >= 0; --i)
            {
                var tween = _activeTweens.buffer[i];
                if (tween.tick())
                {
                    _tempTweens.add(tween);
                }
            }

            _isUpdating = false;

            // kill the dead Tweens
            for (var i = 0; i < _tempTweens.length; i++)
            {
                _tempTweens.buffer[i].recycleSelf();
                _activeTweens.remove(_tempTweens[i]);
            }

            _tempTweens.clear();
        }
예제 #4
0
 /// <summary>
 /// adds a Constraint to the Composite
 /// </summary>
 /// <returns>The constraint.</returns>
 /// <param name="constraint">Constraint.</param>
 /// <typeparam name="T">The 1st type parameter.</typeparam>
 public T addConstraint <T>(T constraint)
     where T : Constraint
 {
     _constraints.add(constraint);
     constraint.composite = this;
     return(constraint);
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void randomizedTest()
        internal virtual void RandomizedTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int count = 10000 + rnd.nextInt(1000);
            int count = 10000 + _rnd.Next(1000);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.eclipse.collections.api.tuple.primitive.ObjectLongPair<org.neo4j.values.storable.Value>> valueRefPairs = new java.util.ArrayList<>();
            IList <ObjectLongPair <Value> > valueRefPairs = new List <ObjectLongPair <Value> >();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.list.MutableList<org.eclipse.collections.api.tuple.primitive.ObjectLongPair<org.neo4j.values.storable.Value>> toRemove = new org.eclipse.collections.impl.list.mutable.FastList<>();
            MutableList <ObjectLongPair <Value> > toRemove = new FastList <ObjectLongPair <Value> >();

            for (int i = 0; i < count; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value value = rnd.randomValues().nextValue();
                Value value = _rnd.randomValues().nextValue();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long ref = container.add(value);
                long @ref = _container.add(value);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.tuple.primitive.ObjectLongPair<org.neo4j.values.storable.Value> pair = pair(value, ref);
                ObjectLongPair <Value> pair = pair(value, @ref);
                if (_rnd.nextBoolean())
                {
                    toRemove.add(pair);
                }
                else
                {
                    valueRefPairs.Add(pair);
                }
            }

            toRemove.shuffleThis(_rnd.random());
            foreach (ObjectLongPair <Value> valueRefPair in toRemove)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value removed = container.remove(valueRefPair.getTwo());
                Value removed = _container.remove(valueRefPair.Two);
                assertEquals(valueRefPair.One, removed);
                assertThrows(typeof(System.ArgumentException), () => _container.remove(valueRefPair.Two));
                assertThrows(typeof(System.ArgumentException), () => _container.get(valueRefPair.Two));
            }

            foreach (ObjectLongPair <Value> valueRefPair in valueRefPairs)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value actualValue = container.get(valueRefPair.getTwo());
                Value actualValue = _container.get(valueRefPair.Two);
                assertEquals(valueRefPair.One, actualValue);
            }
        }
예제 #6
0
 /// <summary>
 /// adds a Particle to the Composite
 /// </summary>
 /// <returns>The particle.</returns>
 /// <param name="particle">Particle.</param>
 public Particle addParticle(Particle particle)
 {
     particles.add(particle);
     return(particle);
 }
예제 #7
0
 /// <summary>
 /// adds a Composite to the simulation
 /// </summary>
 /// <returns>The composite.</returns>
 /// <param name="composite">Composite.</param>
 /// <typeparam name="T">The 1st type parameter.</typeparam>
 public T addComposite <T>(T composite) where T : Composite
 {
     _composites.add(composite);
     return(composite);
 }