Example #1
0
        private void DetectSelectedItem()
        {
            bool NearCoralForSelect = false;
            bool NearOreForSelect   = false;
            bool NearFishForSelect  = false;

            TypeCommon Coral = Common.ListCorals.Find(coral => NearCoralForSelect = Ray.IntersectsWithObject(objectAABB: coral.Mesh.BoundingBox, distance: 500));
            TypeCommon Ore   = Common.ListOres.Find(ore => NearOreForSelect = Ray.IntersectsWithObject(objectAABB: ore.Mesh.BoundingBox, distance: 500));

            if (Character.CanFish && Coral.Mesh is null && Ore.Mesh is null)
            {
                Fish itemFish = Fishes.Find(fish => NearFishForSelect = Ray.IntersectsWithObject(objectAABB: fish.BoundingBox, distance: 500));
                if (NearFishForSelect)
                {
                    SelectItem(itemFish);
                }
            }

            NearObjectForSelect = NearCoralForSelect || NearOreForSelect || NearFishForSelect;

            if (NearCoralForSelect)
            {
                SelectItem(Coral);
            }
            else if (NearOreForSelect)
            {
                SelectItem(Ore);
            }
        }
Example #2
0
        public async Task <ActionResult <Fishes> > PostFishes(Fishes fishes)
        {
            _context.Fishes.Add(fishes);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFishes", new { id = fishes.FishId }, fishes));
        }
Example #3
0
        public async Task <IActionResult> PutFishes(int id, Fishes fishes)
        {
            if (id != fishes.FishId)
            {
                return(BadRequest());
            }

            _context.Entry(fishes).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FishesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #4
0
 public void OnFishCaught(Fishes fish)
 {
     Debug.Log("OnFishCaught: " + fish);
     CATCHABLE_FISH.Remove(fish);
     if (CATCHABLE_FISH.Count == 0)
     {
         CATCHABLE_FISH.Add(Fishes.DAD);
     }
 }
Example #5
0
        public void RemoveFish(int fishId)
        {
            Fish fish = Fishes.FirstOrDefault(i => i.Id == fishId);

            if (fish != null)
            {
                Fishes.ToList().Remove(fish);
                AvailableCapacity += fish.Size;
            }
        }
Example #6
0
 private void SelectItem(Fish item)
 {
     if (Input.keyPressed(Key.E))
     {
         SoundManager.Collect.play();
         ShowInfoItemCollect = true;
         ItemSelected        = item.Mesh.Name;
         Fishes.Remove(item);
         Common.ListFishes.Remove(item.Mesh);
     }
 }
Example #7
0
 public void Dispose()
 {
     Skybox.Dispose();
     Terrain.Dispose();
     Water.Dispose();
     Ship.Dispose();
     Shark.Dispose();
     Character.Dispose();
     Fishes.ForEach(fish => fish.Dispose());
     Vegetation.Dispose();
     Common.Dispose();
     Weapon.Dispose();
     Bubble.Dispose();
 }
Example #8
0
    public Node GetConversation(Fishes fish)
    {
        switch (fish)
        {
        case Fishes.BOOT: return(rootConversations[0]);

        case Fishes.JIM: return(rootConversations[1]);

        case Fishes.KAT: return(rootConversations[2]);

        case Fishes.DAD: return(rootConversations[3]);
        }

        return(null);
    }
Example #9
0
        private void LoadNorthData()
        {
            Fishes.Clear();
            BookCount   = 0;
            MuseumCount = 0;

            var normalAnimals = CommonDataService.GetAllFishes(out int bookCount, out int museumCount, CommonDataService.Hemisphere.North);

            BookCount   = bookCount;
            MuseumCount = museumCount;
            foreach (var item in normalAnimals)
            {
                Fishes.Add(item);
            }
        }
Example #10
0
        private async Task LoadNorthData()
        {
            Fishes.Clear();
            BookCount   = 0;
            MuseumCount = 0;

            var normalAnimals = await CommonDataService.GetAllFishes(CommonDataService.Hemisphere.North);

            //BookCount = bookCount;
            //MuseumCount = museumCount;
            foreach (var item in normalAnimals)
            {
                Fishes.Add(item);
            }
        }
Example #11
0
        public override void AddFishes()
        {
            var p = @"C:\Users\Programmer\Desktop\Projects\MVPFish — копия — копия\Fishing.BL\Model\Waters"
                    + Path.DirectorySeparatorChar
                    + Game.Game.GetGame().CurrentWater.Name
                    + Path.DirectorySeparatorChar + Name;
            string line;
            var    file =
                new StreamReader(p + "Болото\\" + "FishesList");

            while ((line = file.ReadLine()) != null)
            {
                var fs = new FishString(line);
                Fishes.Add((Fish)fs);
            }
            file.Close();
        }
Example #12
0
 public void Update(float elapsedTime, float timeBeetweenUpdate)
 {
     Timer += elapsedTime;
     FogShader.SetValue("time", Timer);
     SoundManager.PlayMusicAmbient(Character.Submerge);
     Character.Update(Ray, Shark.Mesh, elapsedTime);
     PhysicalWorld.dynamicsWorld.StepSimulation(elapsedTime, maxSubSteps: 10, timeBeetweenUpdate);
     Fishes.ForEach(fish => fish.Update(elapsedTime, Camera));
     Skybox.Update();
     Shark.Update(elapsedTime);
     Water.Update(elapsedTime, Camera.Position);
     Terrain.Update(elapsedTime, Camera.Position);
     Character.LooksAtTheHatch = Ray.IntersectsWithObject(objectAABB: Ship.Plane.BoundingBox, distance: 500);
     Character.CanAttack       = Ray.IntersectsWithObject(objectAABB: Shark.Mesh.BoundingBox, distance: 150);
     Character.NearShip        = Ray.IntersectsWithObject(objectAABB: Ship.OutdoorMesh.BoundingBox, distance: 500);
     Character.IsNearSkybox    = Skybox.IsNearSkybox;
     Bubble.Update(elapsedTime, MeshBuilder, Skybox);
     DetectSelectedItem();
 }
Example #13
0
    public static void Main()
    {
        ConsoleKeyInfo key;
        bool           finished = false;
        Fishes         myFish   = new Fishes();
        Environment    myEnv    = new Environment();
        Coral          myCoral  = new Coral();
        SeaWeed        myWeed   = new SeaWeed();
        Rocks          myRock   = new Rocks();
        Bubbles        myBubble = new Bubbles();

        while (!finished)
        {
            Console.Clear();

            myFish.Draw();
            myFish.Move();

            myEnv.Draw();
            myCoral.Draw();
            myWeed.Draw();
            myRock.Draw();
            myBubble.Draw();

            Thread.Sleep(100);

            if (Console.KeyAvailable)
            {
                key = Console.ReadKey();
                if (key.Key == ConsoleKey.Escape)
                {
                    finished = true;
                }
            }
        }

        Console.Clear();
        Console.SetCursorPosition(35, 12);
        Console.ForegroundColor = ConsoleColor.White;
        Console.WriteLine("Bye Bye!");
        Console.ReadKey();
    }
Example #14
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ItemParameter = await _context.ItemParameter.FirstOrDefaultAsync(m => m.Id == id);

            Fishes    = (await _context.Fish.ToListAsync()).Select(x => new SelectListItem(x.Species.ToString(), x.Id.ToString())).ToList();
            Aquariums = (await _context.Aquarium.ToListAsync()).Select(x => new SelectListItem(x.Id.ToString(), x.Id.ToString())).ToList();
            Fishes.Insert(0, new SelectListItem("", ""));
            Aquariums.Insert(0, new SelectListItem("", ""));


            if (ItemParameter == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #15
0
        public void AddFish(Fish fish)
        {
            if (AvailableCapacity < fish.Size)
            {
                throw new NotEnoughCapacityException();
            }

            // Check to see if incompatible fish exists in our tank
            // note: Should avoid magic strings
            switch (fish.Breed.Name)
            {
            case "Yellow lo":
                if (Fishes.Any(f => f.Breed.Name == "Red Ganymede"))
                {
                    throw new IncompatibleFishInTankException();
                }
                break;

            case "Red Ganymede":
                if (Fishes.Any(f => f.Breed.Name == "Yellow lo" || f.Breed.Name == "Purple Callisto"))
                {
                    throw new IncompatibleFishInTankException();
                }
                break;

            case "Purple Callisto":
                if (Fishes.Any(f => f.Breed.Name == "Red Ganymede"))
                {
                    throw new IncompatibleFishInTankException();
                }
                break;

            default:
                break;
            }

            AvailableCapacity -= fish.Size;
            Fishes.Append(fish);
        }
Example #16
0
        public void Render(TgcFrustum frustum)
        {
            Character.Render();

            if (Character.IsInsideShip)
            {
                Ship.RenderIndoorShip();
            }
            else
            {
                FogShader.SetValue("CameraPos", TGCVector3.TGCVector3ToFloat4Array(Camera.Position));
                FogShader.SetValue("eyePosition", TGCVector3.TGCVector3ToFloat4Array(Camera.Position));
                Ship.RenderOutdoorShip();
                Skybox.Render(Terrain.SizeWorld());
                Terrain.Render();
                Shark.Render();
                QuadTree.Render(frustum, false);
                Fishes.ForEach(fish => fish.Render());
                Water.Render();
                Bubble.Render();
            }
        }
Example #17
0
        public bool UpdateFishes()
        {
            try
            {
                var fishes = Fish.GetFishesByUserId(App.user.IdUser);

                if (fishes != null)
                {
                    Fishes.Clear();
                    foreach (var fish in fishes)
                    {
                        Fishes.Add(fish);
                    }
                }
                UpdatePins();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }