Exemplo n.º 1
0
        public void SetGameColour(Colour colour)
        {
            Colour = colour;
            LoadBullets();
            Boat = Boat.InitializeFromColour(colour, content,screenWidth,screenHeight);
            Island = Island.InitializeFromColour(colour, content);

            // initially hostile to all players except self
            HostileToPlayer = new bool[] { true, true, true, true };
            HostileToPlayer[(int)Colour] = false;

            // default bullet delay
            bulletDelay = new TimeSpan(8000000); // 0.5s
            bulletTimeElapsed = TimeSpan.Zero;

            bulletType = Bullet.BulletType.Normal;

            CollectedResources = new Resource[] { null, null, null, null };
        }
Exemplo n.º 2
0
        public void CollectResource(Resource resource)
        {
            CollectedResources[(int)resource.Colour] = resource;
            score += RETURN_RESOURCE;

            switch (resource.islandType)
            {
                case(Island.IslandType.Trident):
                    bulletType = Bullet.BulletType.Trident;
                    break;
                case (Island.IslandType.Bubble):
                    bulletType = Bullet.BulletType.Bubble;
                    break;
                case (Island.IslandType.Razor):
                    bulletType = Bullet.BulletType.Razor;
                    break;
                case (Island.IslandType.Magnet):
                    bulletType = Bullet.BulletType.Magnet;
                    break;
            }
        }
Exemplo n.º 3
0
        protected void BoatIslandCollision(Boat boat, Island island)
        {
            if (boat.Colour == island.Colour)
            {
                if (boat.carriedResources.Count > 0)//(boat.CarriedResource != null) // if carrying a resource
                {
                    //Plays the collect resource sound. This should maybe be in the CollectResource method
                    scoreCargo.Play();

                    foreach (Resource r in boat.carriedResources)
                    {
                        PlayersByColour[(int)boat.Colour].CollectResource(r);
                        island.AddResource(r);
                    }
                    //PlayersByColour[(int)boat.Colour].CollectResource(boat.CarriedResource);
                    //island.AddResource(boat.CarriedResource);

                   // if(boat.CarriedResource.Colour != boat.Colour)
                     //   PlayersByColour[(int)boat.Colour].score += RETURN_RESOURCE;

                    //boat.CarriedResource = null;
                    boat.carriedResources.Clear();
                }
            }
            else
            {
                if(!boat.CheckResourceIsCarried(island.ResourceType.islandType))//!boat.carriedResources.Contains(island.ResourceType))//if (boat.CarriedResource == null) // if not carrying a resource
                {
                    //PLAY THE SOUND
                    takeCargo.Play();
                    PlayersByColour[(int)island.Colour].score -= 200;
                    Resource r = new Resource(island.ResourceType);
                    boat.carriedResources.Add(r);
                    r.IsCarried = true;
                    r.position = boat.position;
                    //boat.CarriedResource = new Resource(island.ResourceType);
                    //boat.CarriedResource.IsCarried = true;
                }
            }
        }
Exemplo n.º 4
0
        protected void BoatResourceCollision(Boat boat, Resource resource, List<Resource> collectedResources)
        {
            if (boat.Colour == resource.Colour)
            {
                takeCargo.Play(); // should be returnCargo
                PlayersByColour[(int)boat.Colour].score += 200;
                collectedResources.Add(resource);
            }
            else
            {
                //if (boat.CarriedResource == null) // if not carrying a resource
                //{
                    //PLAY THE SOUND
                    takeCargo.Play();
                    boat.carriedResources.Add(resource);
                    resource.IsCarried = true;
                    collectedResources.Add(resource);

                    //boat.CarriedResource = resource;
                    //boat.CarriedResource.IsCarried = true;
                    //collectedResources.Add(resource);
                //}
            }
        }
Exemplo n.º 5
0
 public ActionResult Upload()
 {
     try
     {
         var resourceList = new List<Resource>();
         var entityId = Request["entityid"];//TODO CAST
         var entityType = Request["entitytype"].ToLower();
         var clientName = Request["clientname"];
         var orderTitle = Request["ordertitle"];
         var orderType = Request["ordertype"];
         var date = Convert.ToDateTime(Request["date"]);
         var folder = "";
         switch (entityType)
         {
             case "task":
                 folder = "Works";
                 break;
             case "order":
                 folder = orderType;
                 break;
         }
         var resourcePath = string.Format("{0}\\{1}\\{2}\\{3}\\{4}", _fileSystemPath, clientName, date.Year,
             folder, orderTitle);
         if (!Directory.Exists(resourcePath))
         {
             Directory.CreateDirectory(resourcePath);
         }
         for (var i = 0; i < Request.Files.Count; i++)
         {
             var file = Request.Files[i];
             var fileName = Path.GetFileName(file.FileName);
             var path = Path.Combine(resourcePath, fileName);
             var resource = new Resource
             {
                 Name = Request.Files.AllKeys[i],
                 Url = path
             };
             switch (entityType)
             {
                 case "task":
                     resource.TaskId = Convert.ToInt32(entityId);
                     break;
                 case "order":
                     resource.OrderId = Convert.ToInt32(entityId);
                     break;
             }
             _service.Save(resource);
             resourceList.Add(resource);
             file.SaveAs(path);
         }
         return Json(new { success = true, data = resourceList, message = "Correct" }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception exc)
     {
         throw;
     }
 }