private void CompareNugget(Nugget n1, Nugget n2, bool equal) { // Test equality. if (equal) { Assert.AreEqual(n1, n2); } else { Assert.AreNotEqual(n1, n2); } // Test hash code. int h1 = n1.GetHashCode(); int h2 = n2.GetHashCode(); // · If two objects are equal then they must have the same hash code. if (n1.Equals(n2)) { Assert.AreEqual(h1, h2); } // · If two objects have different hash codes then they must be unequal. if (h1 != h2) { Assert.AreNotEqual(n1, n2); } }
// Start is called before the first frame update // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { nuggetToSpawn = nuggetsToSelect[0]; } if (Input.GetKeyDown(KeyCode.Alpha2)) { nuggetToSpawn = nuggetsToSelect[1]; } if (Input.GetKeyDown(KeyCode.Alpha3)) { nuggetToSpawn = nuggetsToSelect[2]; } if (Input.GetKeyDown(KeyCode.Alpha4)) { nuggetToSpawn = nuggetsToSelect[3]; } if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity, groundLayer, QueryTriggerInteraction.Ignore)) { Debug.Log(hit.collider.gameObject.layer); Instantiate(nuggetToSpawn, new Vector3(hit.point.x, hit.point.y + 0.5f, hit.point.z), Quaternion.identity); } } }
void ISaveableObject.LoadFromNugget(Loader SaveSystem, Nugget From) { var nug = From as PlayDataNugget; Camera = SaveSystem.LoadObject(nug.Camera) as OrbitCamera; /* Etc */ throw new NotImplementedException(); }
public IActionResult devtools() { Nugget nug = new Nugget(); nug.batches = _context.getBatches(); return(View(nug)); }
void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) { if (mqttHandlers.ContainsKey(e.Topic)) { ByteBuffer buf = new ByteBuffer(e.Message); Nugget nugget = Nugget.GetRootAsNugget(buf); mqttHandlers [e.Topic] (nugget); } }
private void AddNewTemplateItem( string fileName, ReferenceContext referenceContext, Nugget nugget, ConcurrentDictionary <string, TemplateItem> templateItems) { string msgid = nugget.MsgId.Replace("\r\n", "\n").Replace("\r", "\\n"); // NB: In memory msgids are normalized so that LFs are converted to "\n" char sequence. string key = TemplateItem.KeyFromMsgidAndComment(msgid, nugget.Comment, _settings.MessageContextEnabledFromComment); List <string> tmpList; // templateItems.AddOrUpdate( key, // Add routine. k => { TemplateItem item = new TemplateItem(); item.MsgKey = key; item.MsgId = msgid; item.FileName = fileName; item.References = new List <ReferenceContext> { referenceContext }; if (nugget.Comment.IsSet()) { tmpList = new List <string>(); tmpList.Add(nugget.Comment); item.Comments = tmpList; } return(item); }, // Update routine. (k, v) => { if (!_settings.DisableReferences) { var newReferences = new List <ReferenceContext>(v.References.ToList()); newReferences.Add(referenceContext); v.References = newReferences; } if (nugget.Comment.IsSet()) { tmpList = v.Comments != null ? v.Comments.ToList() : new List <string>(); if (!_settings.DisableReferences || !tmpList.Contains(nugget.Comment)) { tmpList.Add(nugget.Comment); } v.Comments = tmpList; } return(v); }); }
void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) { //Debug.Log("Received: " + System.Text.Encoding.UTF8.GetString(e.Message) ); ByteBuffer buf = new ByteBuffer(e.Message); Nugget nugget = Nugget.GetRootAsNugget(buf); lastpos = new UnityEngine.Vector3( nugget.Flakes(0).Value.Vector3s(0).Value.X, nugget.Flakes(0).Value.Vector3s(0).Value.Y, nugget.Flakes(0).Value.Vector3s(0).Value.Z); }
private void AddNewTemplateItem( string filePath, int lineNumber, Nugget nugget, ConcurrentDictionary <string, TemplateItem> templateItems) { string reference = filePath + ":" + lineNumber.ToString(); string msgid = nugget.MsgId.Replace("\r\n", "\n").Replace("\r", "\\n"); // NB: In memory msgids are normalized so that LFs are converted to "\n" char sequence. string key = TemplateItem.KeyFromMsgidAndComment(msgid, nugget.Comment, _settings.MessageContextEnabledFromComment); List <string> tmpList; // templateItems.AddOrUpdate( key, // Add routine. k => { TemplateItem item = new TemplateItem(); item.MsgKey = key; item.MsgId = msgid; tmpList = new List <string>(); tmpList.Add(reference); item.References = tmpList; if (nugget.Comment.IsSet()) { tmpList = new List <string>(); tmpList.Add(nugget.Comment); item.Comments = tmpList; } return(item); }, // Update routine. (k, v) => { tmpList = v.References.ToList(); tmpList.Add(reference); v.References = tmpList; if (nugget.Comment.IsSet()) { tmpList = v.Comments != null ? v.Comments.ToList() : new List <string>(); tmpList.Add(nugget.Comment); v.Comments = tmpList; } return(v); }); }
public ActionResult Search(string userDrink) { string results = new Api().searchDrinksAsync(userDrink).Result; Drink[] drinks = new Drink().deserializeDrinks(results); Nugget nug = new Nugget() { drinks = drinks, userDrink = userDrink }; return(View(nug)); }
public Village CreateVillageCenter(Vector3 spawnPoint, Nugget nugget, string villageName) { var newVillage = new Village(); newVillage.Name = villageName + " Village " + villages.Count; newVillage.NuggetNumber = 1; newVillage.Id = villages.Count; newVillage.Members = new List <Nugget>(); newVillage.Members.Add(nugget); newVillage.Faction = nugget.race; foreach (var item in buildings) { if (item.Faction == newVillage.Faction) { var newBuilding = new Building(); newBuilding.Name = item.name; newBuilding.Prop = item.gameObject; newBuilding.WoodCost = item.WoodCost; newBuilding.StoneCost = item.StoneCost; newBuilding.time = item.TimeToBuild; if (newVillage.Buildings == null) { newVillage.Buildings = new List <Building>(); } newVillage.Buildings.Add(newBuilding); } } nugget.villageName = newVillage.Name; var newCenter = Instantiate(villageCenter, spawnPoint, Quaternion.identity); var newcenterComponent = newCenter.GetComponent <VillageCenter>(); newcenterComponent.thisVillage = newVillage; newcenterComponent.name = newVillage.Name; newcenterComponent.buildings = newVillage.Buildings; newcenterComponent.population += 1; newcenterComponent.nuggets.Add(nugget); nugget.villageCenter = newCenter.GetComponent <VillageCenter>(); villages.Add(newVillage); return(newVillage); }
public IActionResult Recipe(string drinkId) { _context.addHit(drinkId); string results = new Api().searchById(drinkId).Result; Drink drink = new Drink().deserializeDrinks(results)[0]; Nugget nug = new Nugget() { drink = drink }; return(View(nug)); }
void updateReceived(Nugget nugget) { TrackedPosition.Set( nugget.Flakes(0).Value.Vector3s(0).Value.X, nugget.Flakes(0).Value.Vector3s(0).Value.Y, nugget.Flakes(0).Value.Vector3s(0).Value.Z); TrackedRotation.Set( nugget.Flakes(0).Value.Vector4s(0).Value.X, nugget.Flakes(0).Value.Vector4s(0).Value.Y, nugget.Flakes(0).Value.Vector4s(0).Value.Z, nugget.Flakes(0).Value.Vector4s(0).Value.W); UpdatedThisFrame = true; //deltaTime = Time.time - lastUpdateTime; //lastUpdateTime = Time.time; //Debug.Log (deltaTime); }
public void StateChanger(Worker worker, Bank bank, Nugget nugget) { if (FindObjectOfType <DayAndNightControl>().currentWorkerDaystate == DayAndNightControl.DaystateOut.Morning || FindObjectOfType <DayAndNightControl>().currentWorkerDaystate == DayAndNightControl.DaystateOut.Evening || FindObjectOfType <DayAndNightControl>().currentWorkerDaystate == DayAndNightControl.DaystateOut.Day && !FindObjectOfType <Nugget>().IsOnGround&& !FindObjectOfType <Worker>().IsFatigue) { worker.newTargetPos = GameObject.FindGameObjectWithTag("mineTargetPos").transform.position; worker.currentWorkerState = Worker.WorkerState.MineGold; } if (FindObjectOfType <DayAndNightControl>().currentWorkerDaystate != DayAndNightControl.DaystateOut.Day && !FindObjectOfType <Nugget>().CanPickUp&& FindObjectOfType <BoolChecks>().Dehydrated&& FindObjectOfType <BoolChecks>().Semihydrated&& !FindObjectOfType <BoolChecks>().Hydrated&& FindObjectOfType <Worker>().PocketsFull) { worker.newTargetPos = GameObject.FindGameObjectWithTag("saloonTargetpos").transform.position; worker.currentWorkerState = Worker.WorkerState.VisitSaloon; } if (FindObjectOfType <DayAndNightControl>().currentWorkerDaystate == DayAndNightControl.DaystateOut.Evening || FindObjectOfType <DayAndNightControl>().currentWorkerDaystate == DayAndNightControl.DaystateOut.Night && !FindObjectOfType <Nugget>().CanPickUp&& FindObjectOfType <Worker>().PocketsFull&& FindObjectOfType <BoolChecks>().Hydrated&& FindObjectOfType <BoolChecks>().Semihydrated&& !FindObjectOfType <BoolChecks>().Dehydrated) { worker.newTargetPos = GameObject.FindGameObjectWithTag("bankTargetPos").transform.position; worker.currentWorkerState = Worker.WorkerState.VisitBank; } if (FindObjectOfType <DayAndNightControl>().currentWorkerDaystate != DayAndNightControl.DaystateOut.Day && !FindObjectOfType <Worker>().PocketsFull) { worker.newTargetPos = GameObject.FindGameObjectWithTag("houseTargetPos").transform.position; worker.currentWorkerState = Worker.WorkerState.GoHome; } if (FindObjectOfType <Nugget>().IsOnGround&& FindObjectOfType <Nugget>().CanPickUp) { worker.newTargetPos = GameObject.FindGameObjectWithTag("nuggetTargetPos").transform.position; worker.currentWorkerState = Worker.WorkerState.PickUpGold; } if (FindObjectOfType <Worker>().IsFatigue) { worker.currentWorkerState = Worker.WorkerState.Rest; } }
private void ParseAndComp(string nuggetString, Nugget rhs, bool equal = true) { // Arrange. NuggetTokens nuggetTokens = new NuggetTokens("[[[", "]]]", "|||", "///", "(((", ")))"); NuggetParser nuggetParser = new NuggetParser(nuggetTokens, NuggetParser.Context.SourceProcessing); // Act. Nugget nugget = nuggetParser.BreakdownNugget(nuggetString); // Assert. if (equal) { Assert.AreEqual(nugget, rhs); } else { Assert.AreNotEqual(nugget, rhs); } }
public void Nugget_EqualsAndHashCode() { Nugget nugget01 = new Nugget { MsgId = "msgid" }; Nugget nugget02 = new Nugget { MsgId = "msgid", FormatItems = new string[] { "fi1", "fi2" } }; Nugget nugget03 = new Nugget { MsgId = "msgid", Comment = "comment" }; Nugget nugget04 = new Nugget { MsgId = "msgid", FormatItems = new string[] { "fi1", "fi2" }, Comment = "comment" }; Nugget nugget05 = new Nugget { MsgId = "msgid", FormatItems = new string[] { "fi1" } }; Nugget nugget06 = new Nugget { MsgId = "msgid", FormatItems = new string[] {}, Comment = "comment" }; Nugget nugget11 = new Nugget { MsgId = "msgid" }; Nugget nugget12 = new Nugget { MsgId = "msgid", FormatItems = new string[] { "fi1", "fi2" } }; Nugget nugget13 = new Nugget { MsgId = "msgid", Comment = "comment" }; Nugget nugget14 = new Nugget { MsgId = "msgid", FormatItems = new string[] { "fi1", "fi2" }, Comment = "comment" }; Nugget nugget15 = new Nugget { MsgId = "msgid", FormatItems = new string[] { "fi1" } }; Nugget nugget16 = new Nugget { MsgId = "msgid", FormatItems = new string[] {}, Comment = "comment" }; CompareNugget(nugget01, nugget01, true); CompareNugget(nugget02, nugget02, true); CompareNugget(nugget03, nugget03, true); CompareNugget(nugget04, nugget04, true); CompareNugget(nugget05, nugget05, true); CompareNugget(nugget06, nugget06, true); CompareNugget(nugget01, nugget11, true); CompareNugget(nugget02, nugget12, true); CompareNugget(nugget03, nugget13, true); CompareNugget(nugget04, nugget14, true); CompareNugget(nugget05, nugget15, true); CompareNugget(nugget06, nugget16, true); CompareNugget(nugget01, nugget11, true); CompareNugget(nugget02, nugget11, false); CompareNugget(nugget03, nugget11, false); CompareNugget(nugget04, nugget11, false); CompareNugget(nugget05, nugget11, false); CompareNugget(nugget06, nugget11, false); CompareNugget(nugget01, nugget12, false); CompareNugget(nugget02, nugget12, true); CompareNugget(nugget03, nugget12, false); CompareNugget(nugget04, nugget12, false); CompareNugget(nugget05, nugget12, false); CompareNugget(nugget06, nugget12, false); CompareNugget(nugget01, nugget13, false); CompareNugget(nugget02, nugget13, false); CompareNugget(nugget03, nugget13, true); CompareNugget(nugget04, nugget13, false); CompareNugget(nugget05, nugget13, false); CompareNugget(nugget06, nugget13, false); CompareNugget(nugget01, nugget14, false); CompareNugget(nugget02, nugget14, false); CompareNugget(nugget03, nugget14, false); CompareNugget(nugget04, nugget14, true); CompareNugget(nugget05, nugget14, false); CompareNugget(nugget06, nugget14, false); CompareNugget(nugget01, nugget15, false); CompareNugget(nugget02, nugget15, false); CompareNugget(nugget03, nugget15, false); CompareNugget(nugget04, nugget15, false); CompareNugget(nugget05, nugget15, true); CompareNugget(nugget06, nugget15, false); CompareNugget(nugget01, nugget16, false); CompareNugget(nugget02, nugget16, false); CompareNugget(nugget03, nugget16, false); CompareNugget(nugget04, nugget16, false); CompareNugget(nugget05, nugget16, false); CompareNugget(nugget06, nugget16, true); }
private void Awake() { nuggetScript = GetComponent <Nugget>(); }