public void ParticleFactoryCreateTestNotExisting()
        {
            EntityCreateArgs args = new EntityCreateArgs("random");

            SceneManager.Instance.LoadScene <MockScene>();
            ParticleFactory factory = new ParticleFactory();

            Assert.IsNull(factory.Create(args), "Sukurtas objektas kai turėjo gražinti null");
        }
        public void ParticleFactoryCreateTest()
        {
            EntityCreateArgs args = new EntityCreateArgs("explosion");

            SceneManager.Instance.LoadScene <MockScene>();
            ParticleFactory factory = new ParticleFactory();
            Entity          element = factory.Create(args);
            bool            deleted = SceneManager.Instance.CurrentScene.DestroyEntity(element);

            Assert.IsTrue(deleted, "Scenoje nerastas objektas");
        }
Ejemplo n.º 3
0
        private static List <IParticle> CreateParticles(PsoParameters parameters, IFitnessFunction <double[], double[]> function)
        {
            var particles = new List <IParticle>();

            foreach (var particle in parameters.Particles)
            {
                for (int i = 0; i < particle.Count; i++)
                {
                    var p = ParticleFactory.Create(particle.ParticleType, parameters.FunctionParameters.Dimension, 1, function, parameters.Epsilon, parameters.ParticleIterationsToRestart, parameters.FunctionParameters.SearchSpace);
                    particles.Add(p);
                }
            }
            return(particles);
        }
        public CircularParticleComponent(Size screenBounds)
        {
            _particleFactory = new ParticleFactory();
            _particles       = _particleFactory.Create(screenBounds).ToList();

            _particles.Sort((a, b) =>
            {
                var delta = a.Position.X - b.Position.X;
                return(Math.Abs(delta) < double.Epsilon ? 0 :
                       (delta > double.Epsilon ? 1 : -1));
            });

            _explodingState     = ExplodingState.NotExploding;
            _onExplodeCompleted = null;

            _leftHand  = null;
            _rightHand = null;
        }