Пример #1
0
        public void Test_000_FloorCheck()
        {
            try
            {
                Game1   game              = new Game1();
                Vector3 camEyeVector      = new Vector3(0, 0, 0);
                Vector3 camPositionVector = Vector3.Add(new Vector3(0, 0, 0), new Vector3(0, 1.6f, 0));
                Vector3 deltaVector       = new Vector3(0, 0, 0.001f);
                Vector3 AABBOffsetCamera  = new Vector3(0.5f, 0.25f, 0.5f);
                Matrix  theCamera         = Matrix.CreateLookAt(camPositionVector, camEyeVector, Vector3.Up);
                Camera  camera            = new Camera(theCamera, camPositionVector, camEyeVector, deltaVector, AABBOffsetCamera);

                string  modelPigeon      = "Models/SK_Pigeon";
                string  texturePigeon    = "Maya/sourceimages/pigeon_normal2";
                Vector3 predictedPigeon  = camPositionVector;
                Vector3 positionPigeon   = camPositionVector;
                Vector3 rotationPigeon   = new Vector3(-90, 0, 0) + deltaVector;
                Vector3 AABBOffsetPigeon = new Vector3(0.5f, 0.25f, 0.5f);
                float   scalePigeon      = 0.05f;
                Pigeon  pigeon           = new Pigeon(game.Content, modelPigeon, texturePigeon, predictedPigeon, positionPigeon, rotationPigeon,
                                                      scalePigeon, AABBOffsetPigeon, camera);
                Assert.Pass();
            }
            catch (Exception e)
            {
                Assert.Fail();
            }
        }
Пример #2
0
        public void CreatePigeonTest()
        {
            Pigeon pigeon = new Pigeon();

            Assert.AreEqual(pigeon.PowerPoints, 1);
            Assert.AreEqual(pigeon.SpeedPoints, 3);
        }
Пример #3
0
        public ActionResult Edit(PigeonDetailsViewModel viewModel)
        {
            int year;

            if (!int.TryParse(viewModel.Detail.Year, out year))
            {
                AddModelError(viewModel, m => m.Detail.Year, StyleContext.GetTranslation(Dom.Translation.Pigeon.IncorrectYear));
            }
            else
            {
                if (year < DateTime.Now.AddYears(-25).Year || year > DateTime.Now.Year)
                {
                    AddModelError(viewModel, m => m.Detail.Year, StyleContext.GetTranslation(Dom.Translation.Pigeon.IncorrectYear));
                }
            }
            if (ModelState.IsValid)
            {
                Pigeon pigeon = _pigeonRepository.Get <Pigeon>(viewModel.Detail.Id);
                pigeon.Year   = year;
                pigeon.Code   = viewModel.Detail.Code;
                pigeon.Number = viewModel.Detail.Number;
                pigeon.SexId  = viewModel.Detail.SexId;
                _pigeonRepository.UnitOfWork.SaveChanges();
                return(RedirectToAction(Mvc.Controller.Pigeon.Details, Mvc.Controller.Pigeon.Name, new { id = viewModel.Detail.Id }));
            }
            viewModel.Detail.SexItems = InitSexSelectListItems();

            return(View(Mvc.View.Pigeon.Edit, viewModel));
        }
Пример #4
0
        private void empAddButton_Click(object sender, EventArgs e)
        {
            try
            {
                var pigeon = new Pigeon
                {
                    PigeonId   = $"H{(DatabaseInstance.PigeonTable.Count + 1).ToString("00000")}",
                    PigeonName = psswordAddTextBox.Text,
                    PublicKey  = "ほげ",
                    StatusId   = "d"
                };
                DatabaseInstance.PigeonTable.Insert(pigeon);
                DatabaseInstance.PigeonTable.Sync();

                var emp = new Employee
                {
                    EmployeeId       = empId.Text,
                    Password         = psswordAddTextBox.Text,
                    EmployeeName     = empNameTextBox.Text,
                    EmployeeKatakana = empKanaTextBox.Text,
                    AffiliationId    = affiliationId.Text,
                    PhoneNumber      = empPhoneTextBox.Text,
                    PigeonId         = pigeon.PigeonId,
                    WorkingFlag      = true
                };
                DatabaseInstance.EmployeeTable.Insert(emp);
                DatabaseInstance.EmployeeTable.Sync();
            }
            catch
            {
                MessageBox.Show("社員の追加に失敗しました");
            }
        }
Пример #5
0
        public override void Deplacement(int dimX, int dimY, Pigeon unPerso)
        {
            if (unPerso.Y > 0 && unPerso.Y < 20 && unPerso.X > 0 && unPerso.X < 20)   //empeche de sortir du cadre
            {
                if (unPerso.target2.X != unPerso.X)
                {
                    if (unPerso.target2.X > unPerso.X)
                    {
                        unPerso.X--;
                    }
                    else
                    {
                        unPerso.X++;
                    }
                }

                if (unPerso.target2.Y != unPerso.Y)
                {
                    if (unPerso.target2.Y > unPerso.Y)
                    {
                        unPerso.Y--;
                    }
                    else
                    {
                        unPerso.Y++;
                    }
                }
            }
        }
Пример #6
0
        /*
         * public class Bird
         * {
         *  public string Name { get; private set; }
         *  public string Color { get; private set; }
         *
         *  public Bird(string name, string color)
         *  {
         *      Name = name;
         *      Color = color;
         *  }
         *
         *  public void Speak()
         *  {
         *      Console.WriteLine($"My name is {Name} and I am a {Color} bird.");
         *  }
         *
         *  public void Fly()
         *  {
         *      Console.WriteLine($"I'm {Name} and I can fly high in the blue sky!");
         *  }
         * }
         *
         * public class Pigeon : Bird
         * {
         *  //The Pigeon constructor calls the base class Bird constructor
         *  //The name and color parameters are passed to the Bird constructor
         *  public Pigeon(string name, string color) : base(name, color)
         *  {
         *  }
         *
         *  public void EatPizza()
         *  {
         *      Console.WriteLine("Delicious pizza!");
         *  }
         *  public void Sleep(string condition)
         *  {
         *      string Condition = condition;
         *      Console.WriteLine($"im a {Condition} sleepy bird :)");
         *  }
         *
         * }
         *
         */
        static void Main(string[] args)
        {
            Pigeon pippa = new Pigeon("Pippa", "Grey");

            pippa.Speak();
            pippa.Fly();
            pippa.EatPizza();
            pippa.Spin();
            pippa.DoTheCaterpillar();
            pippa.Jump();

            Penguin pingu = new Penguin("Pingu", "Black & White");

            pingu.Speak();
            pingu.Fly();
            pingu.Spin();

            Parrot rio = new Parrot("rio", "blue");

            rio.Speak();
            rio.Spin();
            pingu.Jump();

#if DEBUG
            Console.WriteLine("\nPress enter to close...");
            Console.ReadLine();
#endif
        }
Пример #7
0
    void Start()
    {
        pigeon = GameManager.scene.pigeon;
        SetTargets(pigeon.cam_follow_target, pigeon.cam_lookat_target);

        target_follow_speed = follow_lerp_speed;
        target_fov          = cam.fieldOfView;
    }
Пример #8
0
        public ViewResult Edit(int pigeonId)
        {
            Pigeon pigeon = repository.GetAllPigeons()
                            .FirstOrDefault(g => g.PigeonId == pigeonId);
            PigeonViewModel pigeonDTO = new PigeonViewModel(pigeon);

            return(View(pigeonDTO));
        }
    void SpawnPigeon()
    {
        Vector2 circlePos = Random.insideUnitCircle.normalized * 50;
        Vector3 pos       = new Vector3(circlePos.x, 30, circlePos.y);
        Pigeon  p         = Instantiate(pigeonPrefab, pos, Quaternion.identity, birdsPlayground);

        pigeons.Add(p);
    }
Пример #10
0
 void OnCollisionEnter(Collision col)
 {
     birbTouched = col.gameObject.GetComponent <Pigeon>();
     if (birbTouched != null)
     {
         birbTouched.addLetter(this);
     }
 }
Пример #11
0
 internal static void ReturnPigeon(Pigeon pigeon)
 {
     pigeon.StopMoving();
     Instance.bodies.ReturnToParent(pigeon.GetBodyPart());
     Instance.backWings.ReturnToParent(pigeon.GetBackWingPart());
     Instance.frontWings.ReturnToParent(pigeon.GetFrontWingPart());
     Instance.pigeons.Return(pigeon);
 }
Пример #12
0
        public static void Main(string[] args)
        {
            Dog    doggie    = new Dog();
            Cat    cattie    = new Cat();
            Pigeon pigeonnie = new Pigeon();

            Console.WriteLine(doggie.TalkToOwner());
            Console.WriteLine(cattie.TalkToOwner());
            Console.WriteLine(pigeonnie.TalkToOwner());
        }
Пример #13
0
 public PigeonViewModel(Pigeon pigeon)
 {
     PigeonId      = pigeon.PigeonId;
     PigeonName    = pigeon.PigeonName;
     Description   = pigeon.Description;
     Category      = pigeon.Category;
     BasicPrice    = pigeon.BasicPrice;
     ImageData     = pigeon.ImageData;
     ImageMimeType = pigeon.ImageMimeType;
 }
Пример #14
0
        static void Test3()
        {
            Console.WriteLine("Тест 3(Создание птиц):");
            var pigeon = new Pigeon();

            Info(pigeon);
            var penguin = new Penguin();

            Info(penguin);
        }
Пример #15
0
    public IEnumerator DrawPigeonEvent() //mainn function that draws new event and does it
    {
        while (true)
        {
            yield return(new WaitForSeconds(pigeonTimer));

            Pigeon pigeon = PigeonFactory.GetInstance();
            pigeon.StartMoving();
        }
    }
Пример #16
0
        public ActionResult Add(PigeonAddViewModel viewModel)
        {
            int year;

            if (!int.TryParse(viewModel.Year, out year))
            {
                AddModelError(viewModel, m => m.Year, StyleContext.GetTranslation(Dom.Translation.Pigeon.IncorrectYear));
            }
            else
            {
                if (year < DateTime.Now.AddYears(-25).Year || year > DateTime.Now.Year)
                {
                    AddModelError(viewModel, m => m.Year, StyleContext.GetTranslation(Dom.Translation.Pigeon.IncorrectYear));
                }
            }

            if (ModelState.IsValid)
            {
                Pigeon pigeon = Pigeon.Empty();
                pigeon.MemberId = viewModel.OwnerId.Value;
                pigeon.SexId    = viewModel.SexId;
                pigeon.Year     = year;
                pigeon.Code     = viewModel.Code;
                pigeon.Number   = viewModel.Number;

                var member         = _memberRepository.Get <Member>(pigeon.MemberId);
                var organizationId = member.EntityInfo.EntityOrganizations.First().OrganizationId;
                EntityContext.AddEntityProgress(
                    pigeon.EntityInfo,
                    new EntityProgress
                {
                    OrganizationId     = organizationId,
                    EntityStateAfterId = Dom.EntityType.Pigeon.State.Created
                }
                    );
                EntityContext.AddEntityOrganization(
                    pigeon.EntityInfo,
                    organizationId,
                    Dom.EntityType.Pigeon.State.Created
                    );
                _pigeonRepository.AddOrUpdate(pigeon);
                _pigeonRepository.UnitOfWork.SaveChanges();

                return(RedirectToAction(Mvc.Controller.Pigeon.List, Mvc.Controller.Pigeon.Name));
            }

            ICollection <SelectListItemCount> owners = _memberRepository.GetMembers(
                UserContext.User.Id,
                UserContext.User.OrganizationId
                );

            viewModel.SexItems   = InitSexSelectListItems();
            viewModel.OwnerItems = Mapper.Map <ICollection <SelectListItem> >(owners);
            return(View(Mvc.View.Pigeon.Add, viewModel));
        }
Пример #17
0
        static void Main(string[] args)
        {
            Console.Title = "Capability";
            Pigeon  joey = new Pigeon();
            Chicken lola = new Chicken();
            Caller  call = new Caller();

            call.Describe(joey);
            call.Describe(lola);
            Console.ReadKey();
        }
Пример #18
0
        static void Main(string[] args)
        {
            Console.Title = "Override";

            Pigeon  joey = new Pigeon();
            Chicken lola = new Chicken();

            Describe(joey);
            Describe(lola);
            Console.ReadKey();
        }
Пример #19
0
        public ActionResult Delete(int pigeonId)
        {
            Pigeon deletedPigeon = repository.DeletePigeon(pigeonId);

            if (deletedPigeon != null)
            {
                TempData["message"] = string.Format("Pigeon \"{0}\" was deleted",
                                                    deletedPigeon.PigeonName);
            }
            return(RedirectToAction("Index"));
        }
Пример #20
0
        public RedirectToRouteResult RemoveFromCart(Cart cart, int PigeonId, string returnUrl)
        {
            Pigeon Pigeon = repository.GetAllPigeons()
                            .FirstOrDefault(g => g.PigeonId == PigeonId);

            if (Pigeon != null)
            {
                cart.RemoveLine(Pigeon);
            }
            return(RedirectToAction("Index", new { returnUrl }));
        }
Пример #21
0
 public void EatFruitsTestEatPeaFail()
 {
     Point point = new Point() { X = 1, Y = 1 };
     Pigeon warior = new Pigeon() { Position = point };
     Fruit fruit = new Pear() { Position = new Point() { X = 0, Y = 0 } };
     List<Figure> fruits = new List<Figure>() { fruit };
     int wariorSpeed = warior.SpeedPoints;
     _playersManager.EatFruits(warior, fruits);
     Assert.AreEqual(wariorSpeed, warior.SpeedPoints);
     CollectionAssert.Contains(fruits, fruit);
 }
Пример #22
0
 public void EatFruitsTestEatAppleSuccess()
 {
     Point point = new Point() { X = 1, Y = 1 };
     Pigeon warior = new Pigeon() { Position = point };
     Fruit fruit = new Apple() { Position = point };
     List<Figure> fruits = new List<Figure>() { fruit };
     int wariorPower = warior.PowerPoints;
     _playersManager.EatFruits(warior, fruits);
     Assert.AreEqual(++wariorPower, warior.PowerPoints);
     CollectionAssert.DoesNotContain(fruits, fruit);
 }
Пример #23
0
 public void SpawnCar()
 {
     if (active)
     {
         GameObject pigeonClone       = Pigeon.Instantiate(pigeon, this.transform.position, this.transform.rotation);
         var        pigeonCloneScript = pigeonClone.GetComponent <Pigeon>();
         pigeonCloneScript.direction = direction;
         pigeonCloneScript.lifetime  = lifetime;
         pigeonCloneScript.speed     = speed;
         pigeonClone.tag             = "car";
     }
 }
Пример #24
0
        public void WarriorMovingOutsideTheGameFieldThrowsIndexOutOfRangeException()
        {
            // Arrange
            var pigeon = new Pigeon('1')
            {
                Position = new Position(0, 0)
            };

            // Act and Assert
            Assert.Throws <IndexOutOfRangeException>(() =>
                                                     pigeon.Move(Direction.Up));
        }
 public Pigeon DeletePigeon(int pigeonId)
 {
     using (EFDbContext context = new EFDbContext())
     {
         Pigeon dbEntry = context.Pigeons.Find(pigeonId);
         if (dbEntry != null)
         {
             context.Pigeons.Remove(dbEntry);
             context.SaveChanges();
         }
         return(dbEntry);
     }
 }
Пример #26
0
        public Pigeon ToPigeon()
        {
            Pigeon pigeon = new Pigeon();

            pigeon.PigeonId      = PigeonId;
            pigeon.PigeonName    = PigeonName;
            pigeon.Description   = Description;
            pigeon.Category      = Category;
            pigeon.BasicPrice    = BasicPrice;
            pigeon.ImageData     = ImageData;
            pigeon.ImageMimeType = ImageMimeType;
            return(pigeon);
        }
        public static void InitializeEntitiesAndDTOs(TestContext testContext)
        {
            animalDTOBase = new PigeonDTO()
            {
                Name        = "Pidgey",
                MaxAltitude = 100,
                IsReal      = true,
                Skill       = SpecialSkill.FLY
            };
            animalBase = new Pigeon("Pidgey", 100, true, 0, SpecialSkill.FLY);

            foreach (int value in Enumerable.Range(1, 10))
            {
                Animal pigeon      = new Pigeon($"PidgeyNo.{value}", value * 100, false, value - 1, SpecialSkill.FLY);
                Animal hawk        = new Hawk($"FearowNo.{value}", value * 200, false, value - 1, SpecialSkill.FLY, (Bird)pigeon);
                Animal rattlesnake = new Rattlesnake($"RattlesnakeNo.{value}", value * 10, true, SpecialSkill.BITE);

                animalsBase.Add(pigeon);
                animalsBase.Add(hawk);
                animalsBase.Add(rattlesnake);

                AnimalDTO pigeonDTO = new PigeonDTO()
                {
                    Name        = $"PidgeyNo.{value}",
                    MaxAltitude = value * 100,
                    IsReal      = false,
                    Skill       = SpecialSkill.FLY
                };

                AnimalDTO hawkDTO = new HawkDTO()
                {
                    Name          = $"FearowNo.{value}",
                    MaxAltitude   = value * 200,
                    IsReal        = false,
                    Skill         = SpecialSkill.FLY,
                    FlyingPartner = (Bird)pigeon
                };

                AnimalDTO rattlesnakeDTO = new RattlesnakeDTO()
                {
                    Name        = $"RattlesnakeNo.{value}",
                    Length      = value * 10,
                    IsPoisonous = true,
                    Skill       = SpecialSkill.BITE
                };

                animalDTOsBase.Add(pigeonDTO);
                animalDTOsBase.Add(hawkDTO);
                animalDTOsBase.Add(rattlesnakeDTO);
            }
        }
Пример #28
0
    public static Pigeon GetInstance()
    {
        int     direction = UnityEngine.Random.Range(0, 2);
        Vector3 startPos  = Vector3.zero;

        if (direction == 0)
        {
            direction = -1;
            startPos  = new Vector3(
                GameManager.CameraXBound.Right + EnemyFactory.GetSpawnOffsetX(GameManager.CurrentDifficulty),
                UnityEngine.Random.Range(GameManager.CameraYBound.Left + Instance.yOffset, GameManager.CameraYBound.Right - Instance.yOffset));
        }
        else
        {
            startPos = new Vector3(
                GameManager.CameraXBound.Left - EnemyFactory.GetSpawnOffsetX(GameManager.CurrentDifficulty),
                UnityEngine.Random.Range(GameManager.CameraYBound.Left + Instance.yOffset, GameManager.CameraYBound.Right - Instance.yOffset));
        }

        Pigeon pigeon = Instance.pigeons.Get();

        pigeon.transform.position = startPos;

        Transform body      = Instance.bodies.GetRandom().transform;
        Transform backWing  = Instance.backWings.GetRandom().transform;
        Transform frontWing = Instance.frontWings.GetRandom().transform;

        pigeon.Direction = direction;

        Vector3 oldScale = pigeon.transform.localScale;

        pigeon.transform.localScale = new Vector3(-direction * Instance.scale, oldScale.y, oldScale.z);

        body.transform.parent      = pigeon.bodyJoint.transform;
        backWing.transform.parent  = pigeon.backWingJoint.transform;
        frontWing.transform.parent = pigeon.frontWingJoint.transform;

        body.localScale      = Vector3.one;
        backWing.localScale  = Vector3.one;
        frontWing.localScale = Vector3.one;

        body.transform.localPosition      = Vector3.zero;
        backWing.transform.localPosition  = Vector3.zero;
        frontWing.transform.localPosition = Vector3.zero;

        pigeon.head.sprite = ColdCry.Graphic.Graphics.GetRandomHead();
        pigeon.MoveSpeed   = GetPigeonSpeed(GameManager.CurrentDifficulty);

        return(pigeon);
    }
    int PigeonHappiness(Pigeon pigeon)
    {
        // TBD - Final interface with GamwObject Pigeon
        // temp random indication

        if (Time.realtimeSinceStartup > cycleTimeNewPigeons)// happiness checks starts in delay
        {
            int happiness = Random.Range(1, 11);
            return(happiness);
        }
        else
        {
            return(5);//normal
        }
    }
Пример #30
0
        public FileContentResult GetImage(int pigeonId)
        {
            Pigeon pigeon = repository.GetPigeon(pigeonId);



            if (pigeon != null)
            {
                return(File(pigeon.ImageData, pigeon.ImageMimeType));
            }
            else
            {
                return(null);
            }
        }