예제 #1
0
 /// <summary>
 /// Funkcja odpowiedzialna za atak drugiej armii
 /// </summary>
 /// <param name="enemyArmy"></param>
 /// <param name="random"></param>
 public void Attack(Army enemyArmy, Random random)
 {
     if (InfantryList.Any())
     {
         foreach (Infantry infantry in InfantryList)
         {
             infantry.Attack(enemyArmy, random);
             enemyArmy.Sort();
         }
     }
     if (TankList.Any())
     {
         foreach (Tank tank in TankList)
         {
             tank.Attack(enemyArmy, random);
             enemyArmy.Sort();
         }
     }
     if (PlaneList.Any())
     {
         foreach (Plane plane in PlaneList)
         {
             plane.Attack(enemyArmy, random);
             enemyArmy.Sort();
         }
     }
 }
예제 #2
0
        public void CheckForEvent_NewPlanesMultiple_CorrectNumberOfEvents()
        {
            EnterPlanes(PlaneList.Take(2), true);
            EnterPlanes(PlaneList.Skip(2).Take(2), true);
            ShowActiveEvents();

            Assert.That(uut.ActiveAtmEvents.Count(), Is.EqualTo(PlaneList.Count));
        }
예제 #3
0
        public void CheckForEvent_NewPlanesMultiple_AllTagsAreCorrect()
        {
            EnterPlanes(PlaneList.Take(2), true);
            EnterPlanes(PlaneList.Skip(2).Take(2), true);
            ShowActiveEvents();

            Assert.That(uut.ActiveAtmEvents.Select(p => p.Tags[0]), Is.EquivalentTo(PlaneList.Select(p => p.Tag)));
        }
예제 #4
0
        void RefreshItems()
        {
            PlaneList _plist = PlaneList.GetDefaultPlanesList();

            if (_plist == null)
            {
                MessageBox.Show("Виникла помилка при підключенні до БД.", "Внутрішня помилка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = _plist;
                //dataGridView1.AllowUserToOrderColumns = true;
                if (_plist.Count == 0)
                {
                    editButton.Visible   = false;
                    deleteButton.Visible = false;
                }
                else
                {
                    editButton.Visible   = true;
                    deleteButton.Visible = true;

                    if (Config.HasUserAccess("GetPlane"))
                    {
                        editButton.Visible = true;
                    }
                    else
                    {
                        editButton.Visible = false;
                    }

                    if (Config.HasUserAccess("DeletePlane"))
                    {
                        deleteButton.Visible = true;
                    }
                    else
                    {
                        deleteButton.Visible = false;
                    }
                }
                if (Config.HasUserAccess("InsertPlane"))
                {
                    addButton.Visible = true;
                }
                else
                {
                    addButton.Visible = false;
                }
            }
        }
예제 #5
0
        public void Alloc()
        {
            PointList.Alloc();
            internalStruct.pointList = PointList.internalStruct;

            PlaneList.Alloc();
            internalStruct.planeList = PlaneList.internalStruct;

            EdgeList.Alloc();
            internalStruct.edgeList = EdgeList.internalStruct;

            internalStructPtr = StructMarshal.StructToIntPtr(internalStruct);
        }
예제 #6
0
        public void Free()
        {
            PointList?.Free();
            PointList = new Point3FVector(internalStruct.pointList);

            PlaneList?.Free();
            PlaneList = new PlaneFVector(internalStruct.planeList);

            EdgeList?.Free();
            EdgeList = new EdgeVector(internalStruct.edgeList);

            if (internalStructPtr != IntPtr.Zero)
            {
                StructMarshal.FreeStructPtr <InternalStruct>(internalStructPtr);
            }
            internalStructPtr = IntPtr.Zero;
        }
예제 #7
0
        public void CheckForEvent_NewPlanesMultiple_FirstIsRemovedAfterTime()
        {
            var earlyarrivers = 2;

            Console.WriteLine("Correct Timout: {0}", EnterEventHandler.Timeout);

            var allowedDeviatedTime = (int)(EnterEventHandler.Timeout * (1 - Deviation));

            Console.WriteLine("Allowed Timout: {0}", allowedDeviatedTime);

            EnterPlanes(PlaneList.Take(earlyarrivers));

            Thread.Sleep(EnterEventHandler.Timeout / 2);

            EnterPlanes(PlaneList);

            Assert.That(() => uut.ActiveAtmEvents.Count(), Is.EqualTo(PlaneList.Count - earlyarrivers).After(allowedDeviatedTime));
        }
예제 #8
0
        public void CheckForEvent_NewPlanesMultiple_AllIsRemovedAfterTime()
        {
            const int earlyarrivers = 2;

            Console.WriteLine("Correct Timout: {0}", EnterEventHandler.Timeout);

            var allowedDeviatedTime = (int)(EnterEventHandler.Timeout * (1 + Deviation));

            Console.WriteLine("Allowed Timout: {0}", allowedDeviatedTime);

            var pollingInterval = EnterEventHandler.Timeout / 100;

            Console.WriteLine("Polling Interval: {0}", pollingInterval);

            EnterPlanes(PlaneList.Take(earlyarrivers));

            Thread.Sleep(EnterEventHandler.Timeout / 2);

            EnterPlanes(PlaneList);

            Assert.That(() => uut.ActiveAtmEvents, Is.Empty.After(allowedDeviatedTime, pollingInterval));
        }
예제 #9
0
    private void UpdateSelectPlane()
    {
        if (!CanMove)
        {
            return;
        }

        Vector3 dir = TargetPos - _View.AirPlane.localPosition;

        if (dir.magnitude > 0.25f && Vector3.Angle(dir, OldDir) < 150)
        {
            dir.Normalize();
            _View.AirPlane.localPosition += dir * Time.deltaTime * 25;
        }
        else
        {
            _View.AirPlane.localPosition = TargetPos;
            CanMove = false;
            //CurIndex = TargetIndex;
            if (isRight)
            {
                isRight = false;
                _View.PlaneList[PlaneList[0]].transform.localPosition += Step * 3 * Vector3.left;

                PlaneList.Add(PlaneList[0]);
                PlaneList.RemoveAt(0);
            }

            if (isLeft)
            {
                isLeft = false;
                _View.PlaneList[PlaneList[2]].transform.localPosition += Step * 3 * Vector3.right;

                PlaneList.Insert(0, PlaneList[2]);
                PlaneList.RemoveAt(PlaneList.Count - 1);
            }
        }
    }
예제 #10
0
파일: ATM.cs 프로젝트: skjesp/SWT_20-ATM
        public void UpdatePlaneList(List <IPlane> newPlaneList)
        {
            List <IPlane> updatedPlaneList = new List <IPlane>();

            // Only select planes present in ObservableAirspace
            foreach (var plane in newPlaneList)
            {
                // Check if plane is within airspace
                bool planeInAirspace = ObservableAirspace.IsWithinArea(plane.XCoordinate, plane.YCoordinate, plane.Altitude);
                PlaneList.Add(plane);
                // Add plane to list if it's within the airspace
                if (planeInAirspace)
                {
                    updatedPlaneList.Add(plane);
                }
            }


            UpdateViolatingPlanes(updatedPlaneList);    // Update violating planes

            PlaneList = updatedPlaneList;

            RenditionOutputter.RenderPlanes(PlaneList);
        }
예제 #11
0
 /// <summary>
 /// Funkcja sortujaca wszystkie listy
 /// </summary>
 public void Sort()
 {
     InfantryList.Sort(new UnitListComparer());
     TankList.Sort(new UnitListComparer());
     PlaneList.Sort(new UnitListComparer());
 }
예제 #12
0
        private void EditFlightForm_Load(object sender, EventArgs e)
        {
            //для всіх
            PlaneList _PlaneList = PlaneList.GetRefPlanesList();

            planecomboBox.DataSource    = _PlaneList;
            planecomboBox.DisplayMember = "PlaneNumber";
            planecomboBox.ValueMember   = "PlaneID";

            AircompaniesList _AircompaniesList = AircompaniesList.GetRefAircompaniesList();

            aircompanycomboBox.DataSource    = _AircompaniesList;
            aircompanycomboBox.DisplayMember = "AirCompanyName";
            aircompanycomboBox.ValueMember   = "AirCompanyID";

            if (act == Action.Insert)
            {
                //для вставки
                CountriesList _countriesList = CountriesList.GetRefCountriesList();
                countrycomboBox.DataSource    = _countriesList;
                countrycomboBox.DisplayMember = "CountryName";
                countrycomboBox.ValueMember   = "CountryID";

                int _selectedCountry = (int)countrycomboBox.SelectedValue;

                CitiesList _citiesList = CitiesList.GetCitiesListByCountry(_selectedCountry);
                citycomboBox.DataSource    = _citiesList;
                citycomboBox.DisplayMember = "CityName";
                citycomboBox.ValueMember   = "CityID";

                int _selectedCity = (int)citycomboBox.SelectedValue;

                AirPortList _airportList = AirPortList.GetRefAirportListByCity(_selectedCity);
                airportcomboBox.DataSource    = _airportList;
                airportcomboBox.DisplayMember = "AirportName";
                airportcomboBox.ValueMember   = "AirportID";

                flightTypecomboBox.SelectedIndex = 0;

                _loaded = true;
            }

            if (act == Action.Update)
            {
                //для оновлення
                try
                {
                    aircompanycomboBox.SelectedValue = Flight.FlightAircompanyID;
                    planecomboBox.SelectedValue      = Flight.FlightPlaneID;

                    AirPort _apinfo = new AirPort();
                    _apinfo.GetAirport(Flight.FlightAirPortID);
                    City _City = new City();
                    _City.GetCity(_apinfo.AirPortCityID);

                    CountriesList _countriesList = CountriesList.GetRefCountriesList();
                    countrycomboBox.DataSource    = _countriesList;
                    countrycomboBox.DisplayMember = "CountryName";
                    countrycomboBox.ValueMember   = "CountryID";
                    countrycomboBox.SelectedValue = _City.CountryID;

                    CitiesList _citiesList = CitiesList.GetCitiesListByCountry(_City.CountryID);
                    citycomboBox.DataSource    = _citiesList;
                    citycomboBox.DisplayMember = "CityName";
                    citycomboBox.ValueMember   = "CityID";
                    citycomboBox.SelectedValue = _apinfo.AirPortCityID;

                    AirPortList _airportList = AirPortList.GetRefAirportListByCity(_apinfo.AirPortCityID);
                    airportcomboBox.DataSource    = _airportList;
                    airportcomboBox.DisplayMember = "AirportName";
                    airportcomboBox.ValueMember   = "AirportID";
                    airportcomboBox.SelectedValue = _apinfo.AirPortID;

                    if (Flight.FlightType == "Вхідний")
                    {
                        flightTypecomboBox.SelectedIndex = 0;
                    }
                    else if (Flight.FlightType == "Вихідний")
                    {
                        flightTypecomboBox.SelectedIndex = 1;
                    }

                    startdateTimePicker.Value = Flight.FlightDateTimeStart;
                    DateTime _tempDuration = Convert.ToDateTime("1900-01-01 " + Flight.FlightDuration);
                    economnumericUpDown.Value   = Flight.FlightPriceEconom;
                    businessnumericUpDown.Value = Flight.FlightPriceBusiness;
                    firstnumericUpDown.Value    = Flight.FlightPriceFirst;

                    numOfFlishgslabel.Visible = false;
                    periodicitylabel.Visible  = false;

                    numOfFlightsnumericUpDown.Visible = false;
                    periodicitydateTimePicker.Visible = false;

                    if (Config.HasUserAccess("UpdateFlight"))
                    {
                        okButton.Visible = true;
                    }
                    else
                    {
                        okButton.Visible = false;
                    }

                    _loaded = true;
                }
                catch (Exception)
                {
                    _error = true;
                }
            }
        }
예제 #13
0
 public BspBrush(PlaneList planes, SceneQuery.WorldFragment fragment)
 {
     this.planes = planes;
     this.fragment = fragment;
 }
예제 #14
0
 public BspBrush()
 {
     planes = new PlaneList();
     fragment = new SceneQuery.WorldFragment();
 }
 public BspBrush(PlaneList planes, SceneQuery.WorldFragment fragment)
 {
     this.planes   = planes;
     this.fragment = fragment;
 }
 public BspBrush()
 {
     planes   = new PlaneList();
     fragment = new SceneQuery.WorldFragment();
 }
예제 #17
0
        public Coct CreateCoct()
        {
            var coct = new Coct();

            coct.CollisionMeshGroupList.AddRange(
                CollisionMeshGroupList
                .Select(
                    collision1 =>
            {
                var newCollision1 = Ummap1(collision1);

                newCollision1.CollisionMeshStart = Convert.ToUInt16(
                    coct.CollisionMeshList.Count
                    );

                coct.CollisionMeshList.AddRange(
                    collision1.Meshes
                    .Select(
                        collision2 =>
                {
                    var newCollision2 = Unmap2(collision2);

                    newCollision2.CollisionStart = Convert.ToUInt16(
                        coct.CollisionList.Count
                        );

                    coct.CollisionList.AddRange(
                        collision2.Items
                        .Select(
                            collision3 =>
                    {
                        var newCollision3 = Unmap3(collision3);

                        return(newCollision3);
                    }
                            )
                        );

                    newCollision2.CollisionEnd = Convert.ToUInt16(
                        coct.CollisionList.Count
                        );

                    return(newCollision2);
                }
                        )
                    );

                newCollision1.CollisionMeshEnd = Convert.ToUInt16(
                    coct.CollisionMeshList.Count
                    );

                return(newCollision1);
            }
                    )
                );

            coct.VertexList.AddRange(
                VertexList
                .Select(Unmap4)
                );

            coct.PlaneList.AddRange(
                PlaneList
                .Select(Unmap5)
                );

            coct.BoundingBoxList.AddRange(
                BoundingBoxList
                .Select(Unmap6)
                );

            coct.SurfaceFlagsList.AddRange(
                SurfaceFlagsList
                .Select(Unmap7)
                );

            return(coct);
        }
예제 #18
0
		/// <summary>
		/// Internal method used to set the underlying clip planes when needed
		/// </summary>
		protected override void SetClipPlanesImpl(PlaneList clipPlanes)
		{
			Debug.WriteLine("In XNA4 SetClipPlanesImpl needs to be done with shaders");
			// TODO: from http://forums.create.msdn.com/forums/p/56786/346433.aspx
			// How to replace ClipPlanes[n].Plane in XNA 4.0
			// In the vertex shader:
			// Compute distance from vertex position to clip plane (assuming your plane and vertex are in the same coordinate system, just dot the float4 plane vector with the float4 extended (x,y,z,1) version of the position coordinate)
			// Pack up to 4 such distances into a float4 vector
			// Output as a texture coordinate interpolator
			// If you need more than 4 clip planes, you will need two such interpolators
			// In the pixel shader:
			// Pass the interpolated distance-from-plane texcoord value to the clip() HLSL intrinsic
		}
예제 #19
0
 public static void Remove(PlaneVertexArray plane)
 {
     PlaneList.Remove(plane);
 }
예제 #20
0
 public static void Add(PlaneVertexArray plane)
 {
     PlaneList.Add(plane);
 }
예제 #21
0
 public static void Clear()
 {
     PlaneList.Clear();
     BoxList.Clear();
 }
예제 #22
0
        protected override void SetClipPlanesImpl( PlaneList clipPlanes )
	    {
	        // A note on GL user clipping:
		    // When an ARB vertex program is enabled in GL, user clipping is completely
		    // disabled. There is no way around this, it's just turned off.
		    // When using GLSL, user clipping can work but you have to include a 
		    // glClipVertex command in your vertex shader. 
		    // Thus the planes set here may not actually be respected.

		    int i;
		    var clipPlane = _tempPlane;

		    // Save previous modelview
		    Gl.glMatrixMode(Gl.GL_MODELVIEW);
		    Gl.glPushMatrix();
		    // just load view matrix (identity world)
		    var mat = _tempMatrix;
            MakeGLMatrix(ref viewMatrix, mat);
		    Gl.glLoadMatrixf(mat);

		    var numClipPlanes = clipPlanes.Count;
		    for (i = 0; i < numClipPlanes; ++i)
		    {
			    var clipPlaneId = Gl.GL_CLIP_PLANE0 + i;
			    var plane = clipPlanes[i];

			    if (i >= 6/*GL_MAX_CLIP_PLANES*/)
			    {
			        throw new AxiomException( "Unable to set clip plane" );
			    }

			    clipPlane[0] = plane.Normal.x;
			    clipPlane[1] = plane.Normal.y;
			    clipPlane[2] = plane.Normal.z;
			    clipPlane[3] = plane.D;

                Gl.glClipPlane(clipPlaneId, clipPlane);
                Gl.glEnable(clipPlaneId);
		    }

		    // disable remaining clip planes
		    for ( ; i < 6/*GL_MAX_CLIP_PLANES*/; ++i)
		    {
                Gl.glDisable(Gl.GL_CLIP_PLANE0 + i);
		    }

		    // restore matrices
            Gl.glPopMatrix();
	    }