Beispiel #1
0
        public void PartRepository_CreatePlane(PlanePart part)
        {
            repository.CreatePlanePart(part);
            var createdPart = repository.GetAll().FirstOrDefault(u => u.Name == part.Name);

            part = createdPart;
        }
 public void TearDown()
 {
     mapper          = null;
     planeRepository = null;
     part            = null;
     partDto         = null;
     userRepository  = null;
     partService     = null;
 }
Beispiel #3
0
 void defineVariables()
 {
     plane         = GetComponent <AeroPlane>();
     elevator      = plane.getPart("elevator");
     gear          = plane.getPart("gear");
     propeller     = plane.getPart("propeller");
     flap          = plane.getPart("flap");
     throttleTimer = new Timers.CooldownTimer(0.01f);
     shootingTimer = new Timers.CooldownTimer(0.08f);
     state         = PlaneState.common;
 }
Beispiel #4
0
    void OnJointBreak2D()
    {
        jointIsActive = false;
        PlanePart part = GetComponent <PlanePart>();

        part.IsBroken = true;
        if (!transform.parent.GetComponent <PlaneBehaviour>().IsPlayer)
        {
            return;
        }
        Timers.timeout(5, () =>
        {
            Game.Instance.gameOver("plane is broken");
        });
    }
Beispiel #5
0
 public void SetUp()
 {
     repository = new PlanePartRepository(new BoengServiceWebSiteContext());
     part       = new PlanePart()
     {
         Name              = "New Part",
         Description       = "Part Description",
         Manufacturer      = "Rolls-Royce",
         Price             = 2000,
         SerialNumber      = "0000000",
         PlaneModelId      = 2002,
         ManufacturingDate = DateTime.UtcNow
     };
     PartRepository_CreatePlane(part);
 }
Beispiel #6
0
        private static void DoOverlapTest(CollisionFunctor cf, PolyhedronPart a, PlanePart b, float offset)
        {
            Vector3 normalNeg;

            Vector3.Negate(ref b.Plane.Normal, out normalNeg);
            int vIndex = a.ExtremeVertex(ref normalNeg).Index;

            float   ax, bx;
            Vector3 p = b.Plane.P;

            if (offset > 0f)
            {
                Vector3.Multiply(ref b.Plane.Normal, offset, out p);
                Vector3.Add(ref b.Plane.P, ref p, out p);
            }

            Vector3.Dot(ref b.Plane.Normal, ref p, out bx);

            for (int i = 0; i < a.FaceCount; i++)
            {
                var  face = a.Face(i);
                bool skip = true;
                for (int j = 0; j < face.Length; j++)
                {
                    if (face[j] == vIndex)
                    {
                        skip = false;
                        break;
                    }
                }
                if (skip)
                {
                    continue;
                }

                for (int j = 0; j < face.Length; j++)
                {
                    Vector3 pa, pb;
                    a.World(face[j], out pa);
                    Vector3.Dot(ref b.Plane.Normal, ref pa, out ax);
                    if (ax - bx < Constants.Epsilon)
                    {
                        b.Plane.ClosestPointTo(ref pa, out pb);
                        cf.WritePoint(ref pa, ref pb, ref b.Plane.Normal);
                    }
                }
            }
        }
 public void SetUp()
 {
     partDto = new PlanePartDto()
     {
         Id                = 1,
         Description       = "Some discription",
         Manufacturer      = "The Boeing Company",
         ManufacturingDate = DateTime.UtcNow,
         Name              = "Boeing 777 MAX",
         Price             = 300
     };
     mapper          = new DtoProfile().GetMapper();
     part            = mapper.Map <PlanePart>(partDto);
     planeRepository = new Mock <IPlaneModelRepository>();
     userRepository  = new Mock <IUserRepository>();
 }
		private static void DoOverlapTest(CollisionFunctor cf, PolyhedronPart a, PlanePart b, float offset)
		{
			Vector3 normalNeg;
			Vector3.Negate(ref b.Plane.Normal, out normalNeg);
			int vIndex = a.ExtremeVertex(ref normalNeg).Index;

			float ax, bx;
			Vector3 p = b.Plane.P;
			if(offset > 0f)
			{
				Vector3.Multiply(ref b.Plane.Normal, offset, out p);
				Vector3.Add(ref b.Plane.P, ref p, out p);
			}

			Vector3.Dot(ref b.Plane.Normal, ref p, out bx);

			for (int i = 0; i < a.FaceCount; i++)
			{
				var face = a.Face(i);
				bool skip = true;
				for (int j = 0; j < face.Length; j++)
				{
					if (face[j] == vIndex)
					{
						skip = false;
						break;
					}
				}
				if (skip)
					continue;

				for (int j = 0; j < face.Length; j++)
				{
					Vector3 pa, pb;
					a.World(face[j], out pa);
					Vector3.Dot(ref b.Plane.Normal, ref pa, out ax);
					if (ax - bx < Constants.Epsilon)
					{
						b.Plane.ClosestPointTo(ref pa, out pb);
						cf.WritePoint(ref pa, ref pb, ref b.Plane.Normal);
					}
				}
			}
		}
 public void UpdatePlanePart(PlanePart planePart)
 {
     _context.PlaneParts.Update(planePart);
     Save();
 }
 public void DeletePlanePart(PlanePart planePart)
 {
     _context.PlaneParts.Remove(planePart);
     Save();
 }
 public void CreatePlanePart(PlanePart planePart)
 {
     _context.PlaneParts.Add(planePart);
     Save();
 }