示例#1
0
文件: Motor.cs 项目: tgjones/apesharp
        public Motor(AbstractParticle attach, float radius, int color)
        {
            wheel = new WheelParticle(attach.PX, attach.PY - .01f, radius);
            wheel.SetStyle(0, 0, Color.FromArgb(255 / 2, 255, 0, 0).ToArgb());
            SpringConstraint axle = new SpringConstraint(wheel, attach);

            _rimA = new CircleParticle(0, 0, 2, true);
            _rimB = new CircleParticle(0, 0, 2, true);
            _rimC = new CircleParticle(0, 0, 2, true);

            wheel.Collidable = false;
            _rimA.Collidable = false;
            _rimB.Collidable = false;
            _rimC.Collidable = false;

            this.Particles.Add(_rimA);
            this.Particles.Add(_rimB);
            this.Particles.Add(_rimC);
            this.Particles.Add(wheel);
            this.Constraints.Add(axle);

            this.color = color;
            this.radius = radius;

            // run it once to make sure the rim particles are in the right place
            run();
        }
示例#2
0
文件: Car.cs 项目: tgjones/apesharp
        public Car(int colC, int colE)
            : base(false)
        {
            wheelParticleA = new WheelParticle(140, 10, 14, false, 2, 0.3f, 0, 1);
            wheelParticleA.SetStyle(1, colC, colE);
            this.Particles.Add(wheelParticleA);

            wheelParticleB = new WheelParticle(200, 10, 14, false, 2, 0.3f, 0, 1);
            wheelParticleB.SetStyle(1, colC, colE);
            this.Particles.Add(wheelParticleB);

            SpringConstraint wheelConnector = new SpringConstraint(wheelParticleA, wheelParticleB,
                    0.5f, true, 8, 1, false);
            wheelConnector.SetStyle(1, colC, colE);
            this.Constraints.Add(wheelConnector);
        }