public void Test_Get_Velocity_Initial_South()
        {
            var    motion         = new CircularMotion(0, 0, new Angle(Math.PI), new Angle(1), 1, Vector.Zero);
            Vector velocity       = new Vector(0, -1);
            Vector motionVelocity = motion.GetVelocity(0);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
        public void Test_Get_Velocity_Initial_West_Clockwise()
        {
            var    motion         = new CircularMotion(0, 0, new Angle(0), new Angle(-Math.PI / 2), 1, Vector.Zero);
            Vector velocity       = new Vector(-1, 0);
            Vector motionVelocity = motion.GetVelocity(1000);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
        public void Test_Get_Motion_Initial_North()
        {
            var    motion         = new CircularMotion(0, 1, new Angle(0), new Angle(0), 1, Vector.Zero);
            Vector velocity       = new Vector(0, 0);
            Vector motionVelocity = motion.GetMotion(0);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
        public void Test_Get_Motion_Initial_South_Clockwise()
        {
            var    motion         = new CircularMotion(0, 0, new Angle(0), new Angle(-Math.PI), 1, Vector.Zero);
            Vector velocity       = new Vector(0, 0);
            Vector motionVelocity = motion.GetMotion(2000);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
        public void Test_Get_Motion_Initial_South_Clockwise()
        {
            var motion = new CircularMotion(0, 0, new Angle(0), new Angle(-Math.PI), 1, Vector.Zero);
            Vector velocity = new Vector(0, 0);
            Vector motionVelocity = motion.GetMotion(2000);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
        public void Test_Get_Motion_Initial_North()
        {
            var motion = new CircularMotion(0, 1, new Angle(0), new Angle(0), 1, Vector.Zero);
            Vector velocity = new Vector(0, 0);
            Vector motionVelocity = motion.GetMotion(0);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
Exemplo n.º 7
0
    void Start()
    {
        for (int i = 0; i < NumberOfPlatforms; i++)
        {
            //instantiate the object and add circular motion
            GameObject     obj            = Instantiate(Platform, transform.Position2D(), Quaternion.identity, transform);
            CircularMotion circularMotion = obj.GetComponent <CircularMotion>();

            if (circularMotion == null)
            {
                circularMotion = obj.AddComponent <CircularMotion>();
            }

            //Resize sprite
            if (SetTilingWidth && obj.GetComponent <SpriteRenderer>() is SpriteRenderer spr && spr)
            {
                spr.size = spr.size.SetX(PlatformWidth);
            }


            //Add object to list
            circularMotionObjects.Add(circularMotion);

            //sets the angle
            circularMotion.SetAngle(360 / (NumberOfPlatforms + NumberOfBlankSpace) * i);

            //Set speed and radius for each ferris wheel object
            circularMotion.Radius = Radius;
            circularMotion.Speed  = Speed;

            //Set visual arm for circular motion
            if (Arm)
            {
                circularMotion.Arm = Arm;
            }
        }
    }
    // this is the button, just have some checks for position and a gravity force applied so it goes back up.

    void Start()
    {
        rb = GetComponent <Rigidbody2D>();
        cm = cam.GetComponent <CircularMotion>();
    }
        public void Test_Get_Velocity_Initial_West_Clockwise()
        {
            var motion = new CircularMotion(0, 0, new Angle(0), new Angle(-Math.PI / 2), 1, Vector.Zero);
            Vector velocity = new Vector(-1, 0);
            Vector motionVelocity = motion.GetVelocity(1000);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }
        public void Test_Get_Velocity_Initial_South()
        {
            var motion = new CircularMotion(0, 0, new Angle(Math.PI), new Angle(1), 1, Vector.Zero);
            Vector velocity = new Vector(0, -1);
            Vector motionVelocity = motion.GetVelocity(0);

            Assert.AreEqual(velocity.X, motionVelocity.X, 0.000000000001);
            Assert.AreEqual(velocity.Y, motionVelocity.Y, 0.000000000001);
        }