Example #1
0
        public void SetViewMethod()
        {
            Fractal   fractal = ((App)Application.Current).Fractal;
            double    h       = W / fractal.AspectRatio;
            PlaneView view    = new PlaneView(CenterX - W / 2, CenterY + h / 2, W, h);

            fractal.SetNewView(view);
            fractal.RenderBitmap();
        }
        private void RenderPlaceMethod(object sender)
        {
            Fractal   fractal = ((App)Application.Current).Fractal;
            Place     place   = (Place)(sender as ListBoxItem).DataContext;
            PlaneView view    = place.ToView(fractal.AspectRatio);

            fractal.IterationsCount = place.IterationsCount;
            fractal.SetNewView(view);
            fractal.RenderBitmap();
        }
Example #3
0
    public void Setup(PlaneCard card)
    {
        var viewTrf = (Transform)Instantiate(ViewPrefab, transform.position, transform.rotation);

        viewTrf.parent  = transform;
        View            = viewTrf.GetComponent <PlaneView>();
        View.Controller = this;

        UseCard(card);
    }
Example #4
0
        public IActionResult Put([FromBody] PlaneView item)
        {
            if (item == null || !ModelState.IsValid)
            {
                return(BadRequest());
            }

            var resp = _Service.Update(item);

            return(Ok(resp));
        }
        public PlaneNodeAnimationManager(float currentTime, PlaneView planeView)
            : base(currentTime)
        {
            this.planeView = planeView;
            foreach (string name in Enum.GetNames(typeof(AnimationType)))
            {
                AnimationType type = (AnimationType)Enum.Parse(typeof(AnimationType), name);



                register(type, 0);
            }
        }
        private void SavePlaceMethod()
        {
            Fractal   fractal = ((App)Application.Current).Fractal;
            PlaneView view    = fractal.View;
            Place     place   = new Place(view);

            place.Name            = Name;
            place.CreationTime    = DateTime.Now;
            place.IterationsCount = fractal.IterationsCount;

            using (AppDbContext db = new AppDbContext())
            {
                db.Places.Add(place);
                db.SaveChanges();

                MessageBox.Show("Место успешно добавлено", "Инфо");
            }
        }
Example #7
0
        public static void Plot(GameObject parent, List <Point> points, Material material,
                                PlaneView view)
        {
            switch (view)
            {
            case PlaneView.Top:
                AddAction(parent, points, material, false);
                break;

            case PlaneView.Bottom:
                AddAction(parent, points, material, true);
                break;

            case PlaneView.Both:
                AddAction(parent, points, material, false);
                AddAction(parent, points, material, true);
                break;
            }
        }
    ////////////////////////////////////////////

    public void Setup(PlaneCard card)
    {
        var viewTrf = Instantiate(ViewPrefab, transform.position, transform.rotation);

        viewTrf.parent  = transform;
        View            = viewTrf.GetComponent <PlaneView>();
        View.Controller = this;

        // here we take a reference to the card; the card object will get
        // updated automatically for us if the config hotloads, so we don't
        // have to have special hotloading logic in this class
        Card = card;

        // do this after assigning to Card b/c MaxHitPoints depends on Card
        HitPoints = MaxHitPoints;
        lastFiredTimes.Clear();

        // display the view; this has to be after HitPoints is assigned
        // or the view will show the wrong thing
        View.Card = card;
    }
Example #9
0
        private IList <GunBullet> PlaneFireGun(float angle, bool isTurningAround, MissileBase.CollisionDirectionLocation fireDirection)
        {
            //dzwiek strzalu.
            Plane plane = ammunitionOwner as Plane;

            refToLevel.Controller.OnFireGun(plane);
            IList <GunBullet> bullets = new List <GunBullet>();

            if (Environment.TickCount - lastFireTick >= GameConsts.Gun.FireInterval * 1)
            {
                PlaneView pv       = refToLevel.Controller.FindPlaneView(plane);           // na razie hardkod przez DelayedControllerFacade
                GunBullet bullet   = null;
                PointD    position = null;

                //startowa pozycja pocisku
                position = new PointD(ammunitionOwner.Center.X, ammunitionOwner.Center.Y);


                //nowy pocisk

                Quaternion q = pv.InnerNode._getDerivedOrientation();

                if (fireDirection == MissileBase.CollisionDirectionLocation.FORWARD || fireDirection == MissileBase.CollisionDirectionLocation.BOTH)
                {
                    // forward
                    bullet = new GunBullet(position.X, position.Y, q, refToLevel, ammunitionOwner, false, true);

                    bullet.SetZRotationPerSecond(0.09f);
                    bullets.Add(bullet);

                    refToLevel.Controller.OnRegisterGunBullet(bullet);
                    RegisterWeaponToModelEvent(bullet);
                }

                if (fireDirection == MissileBase.CollisionDirectionLocation.BACKWARD || fireDirection == MissileBase.CollisionDirectionLocation.BOTH)
                {
                    // backward
                    float tailShift = 4.0f;
                    q = q * new Quaternion(new Radian(new Degree(180)), Vector3.UNIT_X);
                    Vector3 displacement = q * new Vector3(0, 0, -tailShift);


                    bullet = new GunBullet(position.X + displacement.x, position.Y + displacement.y, q, refToLevel, ammunitionOwner, true, false);
                    bullet.SetZRotationPerSecond(0.09f);
                    bullets.Add(bullet);
                    RegisterWeaponToModelEvent(bullet);
                    refToLevel.Controller.OnRegisterGunBullet(bullet);
                }

                //zwieksza liczbe uzytych rakiet
                if (!this.ammunitionOwner.IsEnemy && !isTurningAround)
                {
                    this.refToLevel.Statistics.GunCount++;
                    if (fireDirection == MissileBase.CollisionDirectionLocation.BOTH)
                    {
                        this.refToLevel.Statistics.GunCount++;
                    }
                }

                //ustawiam nowy czas
                lastFireTick = Environment.TickCount;

                return(bullets);
            }

            return(null);
        }