public void SeedDrop(Gathering gatherer) { int numOfSeedsToDrop = 0; // 0 and 1 float ran = Random.Range(0, 2); //Debug.Log(ran); if (ran <= 0.4) { return; } else { numOfSeedsToDrop = 1; } SpawnerData temp3; spawnerData.TryGetValue(gatherer.name, out temp3); try { Seed droppedSeed = rl.seeds[temp3.spawnedItem.name]; Inventory.Add(droppedSeed, numOfSeedsToDrop, true); } catch (KeyNotFoundException) { } }
private void createGatheringPallet(Gathering gathering, IDAL dal) { try { IUniParameter prmGathering = dal.CreateParameter("gatheringId", gathering.GatheringId.ToString()); List <int> palletArr = dal.List <GatheringDetail>("WHS_LST_GATHERINGDETAIL_SP", prmGathering).Distinct(gd => gd.PalletNo).Select(gd => gd.PalletNo).ToList(); palletArr.ForEach(pallet => { GatheringPallet gatheringPallet = new GatheringPallet(); gatheringPallet.Deleted = false; gatheringPallet.CreateDate = new DateTime(); gatheringPallet.CreateUser = OTApplication.Context.User.Id; gatheringPallet.Organization = OTApplication.Context.Organization.Id; gatheringPallet.Gathering = gathering.GatheringId; gatheringPallet.PalletNo = pallet; gatheringPallet.GatheringPalletStatus = 1; dal.Create <GatheringPallet>(gatheringPallet); }); } catch (Exception ex) { _logger.Error($" ServiceName : GatheringService, MethodName : createGatheringPallet, Input : {gathering.GatheringId.ToString()}, Exception : {ex.Message}"); throw ex; } }
static void Main(string[] args) { Gathering gathering = new Gathering(_familyPath); bool success = false; if (!gathering.Validate()) { Console.WriteLine("Make sure every family member is included in the Secret Santa."); } else { success = gathering.Shuffle(_secretAmount); if (success) { gathering.CreateCsv(); Console.WriteLine("Secret Santa list was successfully created"); } else { Console.WriteLine("The amount specified are higher or equal to the number of players."); } } Console.WriteLine("Press any button to close."); Console.ReadKey(); }
public ResourceSource(string nombreEnglish, Gathering gather) { gathering = gather; nombre [0] = nombreEnglish; type = 4; icono = Resources.Load <Sprite> ("Sprites/Icons/" + nombreEnglish); }
CreatenewGatheringTest_VerifiesThatANewGatheringIsCreatedSuccessfully_VeirifiesByTheSecuredInstance() { string title = "Painters Get Around"; string description = "We painters are a different lot"; DateTime dateOfMeeting = DateTime.Now.AddDays(9); string organizerEmail = "thisisit@123456789-0"; string topic = Gathering.AllTopics()[0]; Location location = new Location(23.45M, 73.31M, "F-6, Islamabad, Pakistan"); string venue = "Chaye Khana"; bool isVideoMeeting = false; string videoCallLink = null; var gathering = new Gathering.GatheringBuilder().Title(title).Description(description).DateOfMeeting(dateOfMeeting) .OrganizerEmail(organizerEmail).Topic(topic).Location(location).Venue(venue) .IsVideoGathering(isVideoMeeting).VideoCallLink(videoCallLink).Build(); Assert.IsNotNull(gathering); Assert.AreEqual(title, gathering.Title); Assert.AreEqual(description, gathering.Description); Assert.AreEqual(dateOfMeeting, gathering.DateOfMeeting); Assert.AreEqual(organizerEmail, gathering.OrganizerEmail); Assert.AreEqual(topic, gathering.Topic); Assert.IsNotNull(gathering.Location); Assert.AreEqual(location.Latitude, gathering.Location.Latitude); Assert.AreEqual(location.Longitude, gathering.Location.Longitude); Assert.AreEqual(location.Area, gathering.Location.Area); Assert.AreEqual(venue, gathering.Venue); Assert.AreEqual(isVideoMeeting, gathering.IsVideoGathering); Assert.AreEqual(videoCallLink, gathering.VideoCallLink); }
public bool MindEquals(IMind mind1, IMind mind2) { if (mind1.GetType() == mind2.GetType()) { bool returnvalue = true; if (mind1.GetType() == typeof(Gathering)) { Gathering gather = (Gathering)mind1; Gathering gather2 = (Gathering)mind2; if (!(gather.prefferedType == gather2.prefferedType && gather.prefferedDirection == gather2.prefferedDirection && gather.carryWeight == gather2.carryWeight && gather.IsScout == gather2.IsScout)) { returnvalue = false; } } if (mind1.GetType() == typeof(CombatMind)) { CombatMind combat = (CombatMind)mind1; CombatMind combat2 = (CombatMind)mind2; if (!(combat.GetMinEstimatedDifference() == combat2.GetMinEstimatedDifference() && combat.GetPrefferedHealth() == combat2.GetPrefferedHealth())) { returnvalue = false; } } return(returnvalue); } return(false); }
internal async Task <bool> CloseGatheringWindow() { return (await Gathering.CloseGently( (byte)(SkipWindowDelay < 33 ? 100 : Math.Max(1, 3000 / SkipWindowDelay)), (ushort)SkipWindowDelay)); }
public IEnumerator AntHasReturnedToBase() { ant.GetAgent().enabled = true; yield return(new WaitForSeconds(41f)); Gathering gather = (Gathering)ant.GetMinds()[0]; Assert.AreNotEqual(Gathering.State.Scouting, gather.state); }
public IEnumerator ResourceHasCorrectAmount() { ant.SetAtBase(false); ant.GetAgent().enabled = true; yield return(new WaitForSeconds(0.1f)); Gathering gather = (Gathering)ant.GetMinds()[0]; Assert.AreEqual(9, resourceNode.GetResources()); }
public IEnumerator AntpicksUpResourceCorrectly() { ant.SetAtBase(false); ant.GetAgent().enabled = true; yield return(new WaitForSeconds(0.1f)); Gathering gather = (Gathering)ant.GetMinds()[0]; Assert.AreEqual(1, gather.carryingObjects.Count); }
public IActionResult ShowActivity(int gatheringId) { User userInDb = UserInDb(); if (userInDb == null) { return(RedirectToAction("Logout")); } Gathering activity = dbContext.Gatherings.Include(g => g.Creator).Include(g => g.Participants).ThenInclude(p => p.Participant).FirstOrDefault(g => g.GatheringId == gatheringId); ViewBag.User = userInDb; return(View(activity)); }
public IActionResult DeleteGathering(int gatheringId) { User userInDb = GetUser(); if (userInDb == null) { return(Redirect("/")); } Gathering remove = dbContext.Gatherings.FirstOrDefault(w => w.GatheringId == gatheringId); dbContext.Gatherings.Remove(remove); dbContext.SaveChanges(); return(RedirectToAction("Dashboard")); }
public IActionResult DestroyActivity(int gatheringId) { User userInDb = UserInDb(); if (userInDb == null) { return(RedirectToAction("Logout")); } Gathering cancel = dbContext.Gatherings.FirstOrDefault(g => g.GatheringId == gatheringId); dbContext.Gatherings.Remove(cancel); dbContext.SaveChanges(); return(RedirectToAction("Dashboard")); }
public IActionResult Delete(int gatheringID) { User current = GetUser(); if (current == null) { return(RedirectToAction("Index")); } Gathering todelete = _context.gatherings .FirstOrDefault(w => w.gatheringID == gatheringID); _context.gatherings.Remove(todelete); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }
private void GatherSpot(Character user, Gathering currentSpot) { currentSpot.Refresh(); user.Refresh(); if (user.Health_Current == 0) { _botstage = BotStage.Nothing; _navigation.Stop(); return; } if (user.Coordinate.Distance(currentSpot.Coordinate) < 0.5) { user.Heading = user.Coordinate.AngleTo(currentSpot.Coordinate); Utilities.Keyboard.KeyBoardHelper.KeyDown(Keys.S); Thread.Sleep(150); Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.S); } // We are close enough.. stop running //Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.W); if (currentSpot.IsHidden == false) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad0); Thread.Sleep(350); } else { //_ignorelist.Clear(); _navigation.Resume(); _botstage = BotStage.Detection; } //// Check if we should ignore the monster because it has not been claimed for a while.. //// This typically happens if monster is out of line of sight. //if (_claimwatch.Elapsed.Seconds > 7 && currentSpot.IsClaimed == false) //{ // _claimwatch.Stop(); // _ignorelist.Add(currentSpot.ID); // _navigation.Resume(); // _botstage = BotStage.Detection; //} }
private Gathering FindClosestGatheringSpot() { float minDistance = 99999.0f; Gathering closestSpot = null; List <Character> players = new List <Character>(); List <Character> monsters = new List <Character>(); List <Character> fate = new List <Character>(); List <Gathering> gathering = new List <Gathering>(); Character user = null; MemoryFunctions.GetCharacters(monsters, fate, players, ref user); MemoryFunctions.GetGathering(gathering); foreach (Gathering spot in gathering) { if (spot.Valid == false) { continue; } if (spot.IsHidden) { continue; } if (spot.Name.ToLower().Contains("mineral") || spot.Name.ToLower().Contains("outcrop") || spot.Name.ToLower().Contains("mature tree") || spot.Name.ToLower().Contains("lush vegetation")) { float curDistance = user.Coordinate.Distance(spot.Coordinate); if (curDistance < minDistance && curDistance < SearchDistance) { minDistance = curDistance; closestSpot = spot; } } } // If there is no monster nearby, exit out and try again. if (closestSpot == null) { return(null); } Debug.Print(minDistance.ToString()); return(closestSpot); }
CreateNewGatheringFailTest_DateOfMeetingIsMissingSoTheBuildingOfTheInstanceWillThrowAnError_VerifiesByTheRaisedException() { string title = "Badass Gathering"; string description = "We painters are a different lot"; //DateTime dateOfMeeting = DateTime.Now.AddDays(9); string organizerEmail = "thisisit@123456789-0"; string topic = Gathering.AllTopics()[0]; Location location = new Location(23.45M, 73.31M, "F-6, Islamabad, Pakistan"); string venue = "Chaye Khana"; bool isVideoMeeting = false; string videoCallLink = null; Assert.That(() => new Gathering.GatheringBuilder().Title(title).Description(description) .OrganizerEmail(organizerEmail).Topic(topic).Location(location).Venue(venue) .IsVideoGathering(isVideoMeeting).VideoCallLink(videoCallLink).Build(), Throws.TypeOf <InvalidOperationException>()); }
public IActionResult PostEvent(Gathering newevent) { User current = GetUser(); if (current == null) { return(Redirect("/signin")); } if (ModelState.IsValid) { newevent.userID = current.userID; _context.gatherings.Add(newevent); _context.SaveChanges(); return(RedirectToAction("Details", newevent)); } return(View("new")); }
public IActionResult DisplayGathering(int gatheringId) { User userInDb = GetUser(); if (userInDb == null) { return(Redirect("/")); } ViewBag.User = userInDb; Gathering displaying = dbContext.Gatherings .Include(w => w.Guests) .ThenInclude(gl => gl.Participants) .Include(w => w.Planner) .FirstOrDefault(w => w.GatheringId == gatheringId); return(View(displaying)); }
public IActionResult Details(int gatheringID) { User current = GetUser(); if (current == null) { return(Redirect("/signin")); } ViewBag.User = current; Gathering theevent = _context.gatherings .Include(w => w.participants) .ThenInclude(a => a.attendee) .Include(w => w.coordinator) .FirstOrDefault(w => w.gatheringID == gatheringID); ViewBag.User = current; return(View("details", theevent)); }
public async Task <IActionResult> Create([Bind("GatheringId,UserId,Title,Description,MaxAttendees,StartTime,EndTime,LocationId,City")] Gathering gathering) { ModelState.Remove("UserId"); if (ModelState.IsValid) { var user = await GetCurrentUserAsync(); gathering.UserId = user.Id; _context.Add(gathering); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LocationId"] = new SelectList(_context.Location, "LocationId", "County", gathering.LocationId); ViewData["UserId"] = new SelectList(_context.User, "Id", "Id", gathering.UserId); return(View(gathering)); }
public void AssignUserToGathering(long gatheringId, int userId) { using (IDAL dal = this.DAL) { try { Gathering gathering = dal.Read <Gathering>(gatheringId); gathering.GatheringUser = userId; dal.BeginTransaction(); dal.Update <Gathering>(gathering); dal.CommitTransaction(); } catch (Exception ex) { _logger.Error($" ServiceName : GatheringService, MethodName : AssignUserToGathering, Input : ({gatheringId.ToString()}, {userId.ToString()}), Exception : {ex.Message}"); dal.RollbackTransaction(); throw; } } }
public void ChangePriority(long gatheringId, int priority) { using (IDAL dal = this.DAL) { try { Gathering gathering = dal.Read <Gathering>(gatheringId); gathering.Priority = priority; dal.BeginTransaction(); dal.Update <Gathering>(gathering); dal.CommitTransaction(); } catch (Exception ex) { _logger.Error($" ServiceName : GatheringService, MethodName : ChangePriority, Input : ({gatheringId.ToString()}, {priority.ToString()}), Exception : {ex.Message}"); dal.RollbackTransaction(); throw; } } }
internal void GenerateMind() { gather = (Gathering)mindGroup.Minds.Find(mind => mind.GetType() == typeof(Gathering)); if (gather == null) { gather = new Gathering(); mindGroup.Minds.Add(gather); } combat = (CombatMind)mindGroup.Minds.Find(mind => mind.GetType() == typeof(CombatMind)); if (combat == null) { combat = new CombatMind(); mindGroup.Minds.Add(combat); } UpdateResourceValues(gather.carryWeight, gather.IsScout, gather.prefferedType, gather.prefferedDirection); UpdateCombatValues(combat.GetMinEstimatedDifference(), combat.GetPrefferedHealth()); }
public IActionResult Create(Gathering created) { User userInDb = UserInDb(); if (userInDb == null) { return(RedirectToAction("Logout")); } if (ModelState.IsValid) { dbContext.Gatherings.Add(created); dbContext.SaveChanges(); return(Redirect($"/activity/{created.GatheringId}")); } else { ViewBag.User = userInDb; return(View("NewActivity")); } }
public void UpdateResourceMindCorrectly(ResourceType resType, int carryweight, Direction exploreDirection, bool isScout = false) { MindGroup mindGroup = unitControl.MindGroupList.GetMindGroupFromIndex(1); Gathering gather = new Gathering(); for (int i = 0; i < mindGroup.Minds.Count; i++) { if (mindGroup.Minds[i].GetType() == typeof(Gathering)) { gather = (Gathering)mindGroup.Minds[i]; } } uiController.UI_OpenMindBuilder(1); MindBuilderTabbed mbTabbed = uiController.GetComponentInChildren <MindBuilderTabbed>(); mbTabbed.UpdateResourceValues(carryweight, isScout, resType, exploreDirection); mbTabbed.UpdateMind(); Assert.True(MindEquals(gather, new Gathering(resType, carryweight, exploreDirection, isScout))); }
/// <summary> /// Update an existing car /// </summary> /// <param name="instance"></param> /// <returns></returns> public bool Update(Gathering instance) { var filter = Builders <Gathering> .Filter.Eq(x => x.Id, instance.Id); var update = Builders <Gathering> .Update .Set(x => x.Title, instance.Title) .Set(x => x.Description, instance.Description) .Set(x => x.DateOfMeeting, instance.DateOfMeeting) .Set(x => x.OrganizerEmail, instance.OrganizerEmail) .Set(x => x.Topic, instance.Topic) .Set(x => x.Venue, instance.Venue) .Set(x => x.IsVideoGathering, instance.IsVideoGathering) .Set(x => x.VideoCallLink, instance.VideoCallLink) .Set(x => x.Location.Latitude, instance.Location.Latitude) .Set(x => x.Location.Longitude, instance.Location.Longitude) .Set(x => x.Location.Area, instance.Location.Area); UpdateResult result = _mongoCollection.UpdateOne(filter, update); return(result.ModifiedCount == 1); }
public void AbortGathering(long gatheringId) { using (IDAL dal = this.DAL) { try { dal.BeginTransaction(); Gathering gathering = dal.Read <Gathering>(gatheringId); gathering.GatheringStatus = 1; // gathering.Priority = -1; dal.Update <Gathering>(gathering); dal.CommitTransaction(); } catch (Exception ex) { _logger.Error($" ServiceName : GatheringService, MethodName : AbortGathering, Input : {gatheringId.ToString()}, Exception : {ex.Message}"); dal.RollbackTransaction(); throw; } } }
public IEnumerator Init() { AsyncOperation asyncLoadLevel = SceneManager.LoadSceneAsync("TestScene", LoadSceneMode.Single); while (!asyncLoadLevel.isDone) { yield return(null); } uiController = GameObject.FindObjectOfType <UiController>(); GameObject gameObjectAnt = MonoBehaviour.Instantiate(Resources.Load("Prefabs/WorkerAnt") as GameObject); ant = gameObjectAnt.GetComponent <Ant>(); yield return(null); Gathering gather = new Gathering(ResourceType.Crystal, 1, Gathering.Direction.South, true); gather.state = Gathering.State.Idle; ant.SetMinds(new List <IMind>() { gather }); foreach (IMind mind in ant.GetMinds()) { mind.Initiate(ant); } MindGroup mindGroup = GameObject.FindObjectOfType <UnitController>().MindGroupList.GetMindGroupFromIndex(1); mindGroup.Minds = new List <IMind>() { gather }; var Id = mindGroup.AddUnit(new UnitGroup(uiController.unitIconBase)); ant.SetunitGroupID(Id); resource = MonoBehaviour.Instantiate(Resources.Load("Prefabs/Resources/crystal") as GameObject); resource.transform.position = new Vector3(0, 0.6f, 0); resource.GetComponent <ResourceNode>().Discover(ant.TeamID); resourceNode = resource.GetComponent <ResourceNode>(); }
public IEnumerator Init() { AsyncOperation asyncLoadLevel = SceneManager.LoadSceneAsync("TestScene", LoadSceneMode.Single); while (!asyncLoadLevel.isDone) { yield return(null); } uiController = GameObject.FindObjectOfType <UiController>(); unitControl = GameObject.FindObjectOfType <UnitController>(); GameObject gameObjectAnt = MonoBehaviour.Instantiate(Resources.Load("Prefabs/WorkerAnt") as GameObject); ant = gameObjectAnt.GetComponent <Ant>(); yield return(null); Gathering gather = new Gathering(ResourceType.Crystal, 1, Gathering.Direction.South, true) { state = Gathering.State.Scouting, busy = true }; ant.SetMinds(new List <IMind>() { gather, new CombatMind() }); foreach (IMind mind in ant.GetMinds()) { mind.Initiate(ant); } MindGroup mindGroup = unitControl.MindGroupList.GetMindGroupFromIndex(1); mindGroup.Minds = new List <IMind>() { gather, new CombatMind() }; var Id = mindGroup.AddUnit(new UnitGroup(uiController.unitIconBase)); ant.SetunitGroupID(Id); }
// Use this for initialization void Start() { playerGathering = GameObject.Find("Player").GetComponent<Gathering>(); startTerrain = Terrain.activeTerrain.terrainData; }