/* Properties Setup */ public void SetMountainProperties() { this.startPosition = AppController.LastEnd; this.actualHeight = IntUtil.Random(heightRange[0], heightRange[1]); this.actualWidth = IntUtil.Random(widthRange[0], widthRange[1]); this.topWidth = IntUtil.Random(1, this.actualWidth + 1); this.exitWidth = IntUtil.Random(0, this.actualWidth - this.topWidth + 1); this.entryWidth = this.actualWidth - this.topWidth - this.exitWidth; if (this.entryWidth != 0) { this.entryHeight = IntUtil.Random(heightRange[0], this.actualHeight); this.topHeight = this.entryHeight; } if (this.exitWidth != 0) { this.exitHeight = IntUtil.Random(heightRange[0], this.actualHeight); } if (topWidth > Valley.width[0]) { topIsValley = true; valley = new Valley(); } }
void SpawnLootBox(BasePlayer player, Vector3 hitloc) { var randomlootprefab = randomlootprefab1; var rlroll = IntUtil.Random(1, 6); if (rlroll == 1) { randomlootprefab = randomlootprefab1; } if (rlroll == 2) { randomlootprefab = randomlootprefab2; } if (rlroll == 3) { randomlootprefab = randomlootprefab3; } if (rlroll == 4) { randomlootprefab = randomlootprefab4; } if (rlroll == 5) { randomlootprefab = randomlootprefab5; } var createdPrefab = GameManager.server.CreateEntity(randomlootprefab, hitloc); BaseEntity treasurebox = createdPrefab?.GetComponent <BaseEntity>(); treasurebox.enableSaving = false; treasurebox?.Spawn(); timer.Once(treasureDespawn, () => CheckTreasureDespawn(treasurebox)); }
// // // private void cloudy() { while (!stopThread) { try { for (int i = 0; i < 5; i++) { // if we returned after a pause here level will be remembered _fixtureController.setWallLevelByPanel(level, i); level = (ushort)IntUtil.Random(1, 100); //this.Invoke((MethodInvoker)delegate //{ // label7.Text = level.ToString() + "%"; //}); } //System.Threading.Thread.Sleep(delay); } catch (Exception ex) { MessageBox.Show(@"problem during transmission of command to lutron panel/area: " + ex.ToString()); //break; } finally { // update progress graphic? } } #region old clouds based upon schedules //_fixtureController.turnOffWall(); //var panels = _fixtureController.getAreas().ToArray(); //var area1 = panels[0]; //var area2 = panels[1]; //var area3 = panels[2]; //var area4 = panels[3]; //var fixtures1 = _fixtureController.getFixturesForArea(area1).OrderBy(f => f.IntegrationId).Skip(4); //var fixtures2 = _fixtureController.getFixturesForArea(area2).OrderBy(f => f.IntegrationId); //var fixtures3 = _fixtureController.getFixturesForArea(area3).OrderBy(f => f.IntegrationId); //var fixtures4 = _fixtureController.getFixturesForArea(area4).OrderBy(f => f.IntegrationId).Take(20); //var levels = new List<int>(); //levels.AddRange(new List<int> { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); //levels.AddRange(new List<int> { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100 }); //levels.AddRange(new List<int> { 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5 }); //var schedules = new List<FixtureSchedule>(); //schedules.AddRange(MakeRotatingLevel(fixtures1, levels)); //schedules.AddRange(MakeRotatingLevel(fixtures2, levels)); //schedules.AddRange(MakeRotatingLevel(fixtures3, levels)); //schedules.AddRange(MakeRotatingLevel(fixtures4, levels)); //_skywallFadeWorker = new SkyWallFadeWorker(schedules, _fixtureController); //_skywallFadeWorker.StartSkyWall(); #endregion }
private void GenerateRandomActor() { int randomActor; for (int i = 0; i < 4; i++) { do { randomActor = IntUtil.Random(1, 11); }while(actorIds.Contains(randomActor)); actorIds.Add(randomActor); } }
void FishTypeRoll(BasePlayer player, Vector3 hitloc) { int totalfishtypechance = rarecatchchance + uncommoncatchchance + common1catchchance + common2catchchance; var fishtyperoll = IntUtil.Random(1, totalfishtypechance + 1); if (allowrandomitemchance) { if (fishtyperoll < randomitemchance) { catchFishCui(player, randomitemiconurl); SendReply(player, msg("randomitem", player.UserIDString)); SpawnLootBox(player, hitloc); return; } } if (fishtyperoll < rarecatchchance) { catchFishCui(player, rareiconurl); SendReply(player, msg("rarefish1", player.UserIDString)); player.inventory.GiveItem(ItemManager.CreateByItemID(rarecatchitemid, rarecatchamount)); player.Command("note.inv", rarecatchitemid, rarecatchamount); return; } if (fishtyperoll < rarecatchchance + uncommoncatchchance) { catchFishCui(player, uncommoniconurl); SendReply(player, msg("uncommonfish1", player.UserIDString)); player.inventory.GiveItem(ItemManager.CreateByItemID(uncommoncatchitemid, uncommoncatchamount)); player.Command("note.inv", uncommoncatchitemid, uncommoncatchamount); return; } if (fishtyperoll < rarecatchchance + uncommoncatchchance + common2catchchance) { catchFishCui(player, common2iconurl); SendReply(player, msg("commonfish2", player.UserIDString)); player.inventory.GiveItem(ItemManager.CreateByItemID(common2catchitemid, common2catchamount)); player.Command("note.inv", common2catchitemid, common2catchamount); return; } if (fishtyperoll < rarecatchchance + uncommoncatchchance + common2catchchance + common1catchchance) { catchFishCui(player, common1iconurl); SendReply(player, msg("commonfish1", player.UserIDString)); player.inventory.GiveItem(ItemManager.CreateByItemID(common1catchitemid, common1catchamount)); player.Command("note.inv", common1catchitemid, common1catchamount); return; } }
void FishChanceRoll(BasePlayer player, Vector3 hitloc) { int roll = IntUtil.Random(1, 101); int totatchance = CatchFishModifier(player); if (roll < totatchance) { FishTypeRoll(player, hitloc); return; } else { SendReply(player, msg("missedfish", player.UserIDString)); } return; }
// King 47.798666, -122.409016 to 47.463651, -121.799275 // pierce 47.303719, -122.521626 to 46.890506, -121.274678 // snohomish 47.809735, -122.398030 to 48.309042, -121.101643 public Person() { HairColor = RandomValueOfArray(_hairColors); EyeColor = RandomValueOfArray(_eyeColors); Sex = RandomValueOfArray(_sex); YearOfBirth = IntUtil.Random(1940, 2005); SearchAction = "mergeOrUpload"; Region = RandomValueOfArray(_regions); switch (Region) { case "King": City = RandomValueOfArray(_kingCities); //var kingLatitude = 47.463651 + ((double) IntUtil.Random(0, 335015)/1000000); //var kingLongitude = -121.799275 + ((double)IntUtil.Random(0, 609741) / 1000000); var kingLatitude = 47.49 + ((double)IntUtil.Random(0, 200) / 1000); var kingLongitude = -122.4 + ((double)IntUtil.Random(0, 400) / 1000); //47.615330, -122.146812 HomeLocation = new GeoPoint(kingLatitude, kingLongitude); break; case "Snohomish": City = RandomValueOfArray(_snohomishCities); //var snoLatitude = 47.809735 + ((double)IntUtil.Random(0, 499307) / 1000000); //var snoLongitude = -122.398030 + ((double)IntUtil.Random(0, 1296387) / 10000000); var snoLatitude = 47.7 + ((double)IntUtil.Random(0, 500) / 1000); var snoLongitude = -122.3 + ((double)IntUtil.Random(0, 500) / 1000); //47.916760, -122.102074 HomeLocation = new GeoPoint(snoLatitude, snoLongitude); break; case "Pierce": City = RandomValueOfArray(_pierceCities); //var pierceLatitude = 46.890506 + ((double)IntUtil.Random(0, 413213) / 10000000); //var pierceLongitude = -121.274678 + ((double)IntUtil.Random(0, 1246948) / 10000000); var pierceLatitude = 46.93 + ((double)IntUtil.Random(0, 400) / 1000); var pierceLongitude = -122.6 + ((double)IntUtil.Random(0, 500) / 1000); //47.218698, -122.416958 HomeLocation = new GeoPoint(pierceLatitude, pierceLongitude); break; } State = "WA"; }
public List <xyPairs> generateArray() { int xPairsParam = 0; int yPairsParam = 0; for (int i = 0; i < testPointsNum * 2; i++) { if (i % 2 == 0) { xPairsParam = IntUtil.Random(1, 1000); } else { yPairsParam = IntUtil.Random(1, 1000); //Console.WriteLine("({0}, {1})", xPairsParam, yPairsParam); xyPairs xyStruct = new xyPairs(); xyStruct.x = xPairsParam; xyStruct.y = yPairsParam; PointsLi.Add(xyStruct); } } return(this.PointsLi); }
private async void button1_Click(object sender, EventArgs e) { //checking if textbox value is int int n; bool isNumeric = int.TryParse(textBox1.Text, out n); if (isNumeric == true) { bet = n; label2.Text = "Bet: " + bet.ToString(); if (credits == 0) { MessageBox.Show("Sorry, you're out of credits!"); this.Close(); } else if (credits < bet) { MessageBox.Show("Bet must be equal to or lower than Credit balance!"); } else if (credits >= bet) { credits = credits - bet; label1.Text = "Credits: " + credits.ToString(); for (var i = 0; i < 10; i++) { p1 = IntUtil.Random(1, 5); p2 = IntUtil.Random(1, 5); p3 = IntUtil.Random(1, 5); if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } pictureBox1.Image = Image.FromFile(p1.ToString() + ".png"); if (pictureBox2.Image != null) { pictureBox2.Image.Dispose(); } pictureBox2.Image = Image.FromFile(p2.ToString() + ".png"); if (pictureBox3.Image != null) { pictureBox3.Image.Dispose(); } pictureBox3.Image = Image.FromFile(p3.ToString() + ".png"); await Task.Delay(50); } total = 0; //Three of a kind combos if (p1 == 3 & p2 == 3 & p3 == 3) { total = total + (bet * 3); } else if (p1 == 1 & p2 == 1 & p3 == 1) { total = total + (bet * 3); } else if (p1 == 2 & p2 == 2 & p3 == 2) { total = total + (bet * 5); } else if ((p1 == 3 & p2 == 3) || (p1 == 3 & p3 == 3) || (p2 == 3 & p3 == 3)) { total = total + (bet * 2); } else if ((p1 == 1 & p2 == 1) || (p1 == 1 & p3 == 1) || (p2 == 1 & p3 == 1)) { total = total + (bet * 2); } else if ((p1 == 2 & p2 == 2) || (p1 == 2 & p3 == 2) || (p2 == 2 & p3 == 2)) { total = total + (bet * 2); } credits = credits + total; label3.Text = "Win: " + total.ToString(); label1.Text = "Credits: " + credits.ToString(); } } else { MessageBox.Show("Please enter a number value with no decimals!"); } }
//when play is pressed: private void button1_Click(object sender, EventArgs e) { for (var i = 0; i < 10; i++) { p1 = IntUtil.Random(1, 6); p2 = IntUtil.Random(1, 6); p3 = IntUtil.Random(1, 6); p4 = IntUtil.Random(1, 6); p5 = IntUtil.Random(1, 6); p6 = IntUtil.Random(1, 6); p7 = IntUtil.Random(1, 6); p8 = IntUtil.Random(1, 6); p9 = IntUtil.Random(1, 6); p10 = IntUtil.Random(1, 6); p11 = IntUtil.Random(1, 6); p12 = IntUtil.Random(1, 6); } if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } pictureBox1.Image = Image.FromFile(p1.ToString() + ".png"); if (pictureBox2.Image != null) { pictureBox2.Image.Dispose(); } pictureBox2.Image = Image.FromFile(p2.ToString() + ".png"); if (pictureBox3.Image != null) { pictureBox3.Image.Dispose(); } pictureBox3.Image = Image.FromFile(p3.ToString() + ".png"); if (pictureBox4.Image != null) { pictureBox4.Image.Dispose(); } pictureBox4.Image = Image.FromFile(p4.ToString() + ".png"); if (pictureBox5.Image != null) { pictureBox5.Image.Dispose(); } pictureBox5.Image = Image.FromFile(p5.ToString() + ".png"); if (pictureBox6.Image != null) { pictureBox6.Image.Dispose(); } pictureBox6.Image = Image.FromFile(p6.ToString() + ".png"); if (pictureBox7.Image != null) { pictureBox7.Image.Dispose(); } pictureBox7.Image = Image.FromFile(p7.ToString() + ".png"); if (pictureBox8.Image != null) { pictureBox8.Image.Dispose(); } pictureBox8.Image = Image.FromFile(p8.ToString() + ".png"); if (pictureBox9.Image != null) { pictureBox9.Image.Dispose(); } pictureBox9.Image = Image.FromFile(p9.ToString() + ".png"); if (pictureBox10.Image != null) { pictureBox10.Image.Dispose(); } pictureBox10.Image = Image.FromFile(p10.ToString() + ".png"); if (pictureBox11.Image != null) { pictureBox11.Image.Dispose(); } pictureBox11.Image = Image.FromFile(p11.ToString() + ".png"); if (pictureBox12.Image != null) { pictureBox12.Image.Dispose(); } pictureBox12.Image = Image.FromFile(p12.ToString() + ".png"); pictureBox1.Visible = false; //hides all images pictureBox2.Visible = false; pictureBox3.Visible = false; pictureBox4.Visible = false; pictureBox5.Visible = false; pictureBox6.Visible = false; pictureBox7.Visible = false; pictureBox8.Visible = false; pictureBox9.Visible = false; pictureBox10.Visible = false; pictureBox11.Visible = false; pictureBox12.Visible = false; b1.Visible = true; //shows all guess buttons button2.Visible = true; button3.Visible = true; button4.Visible = true; button5.Visible = true; button6.Visible = true; button7.Visible = true; button8.Visible = true; button9.Visible = true; button10.Visible = true; button11.Visible = true; button12.Visible = true; button1.Visible = false; //takes away play button label1.Text = triesLeft.ToString(); triesLeft = 4; MessageBox.Show("The images have been shuffled! Try to find the pistol used to kill Bill Bourbon! You have 4 guesses."); }
private void button1_Click(object sender, EventArgs e) { if (credits >= bet) { credits = credits - bet; label1.Text = "Credits: " + credits.ToString(); for (var i = 0; i < 10; i++) { p1 = IntUtil.Random(1, 4); p2 = IntUtil.Random(1, 4); p3 = IntUtil.Random(1, 4); } if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } pictureBox1.Image = Image.FromFile(p1.ToString() + ".png"); if (pictureBox2.Image != null) { pictureBox2.Image.Dispose(); } pictureBox2.Image = Image.FromFile(p2.ToString() + ".png"); if (pictureBox3.Image != null) { pictureBox3.Image.Dispose(); } pictureBox3.Image = Image.FromFile(p3.ToString() + ".png"); total = 0; // GET RESULTS FROM PAYTABLE // CHECK IF 1, 2 OR 3 OCCURANCES if (p1 == 3) { total = total + 5; } if (p1 == 2 & p2 == 2) { total = total + 10; } if (p1 == 3 & p2 == 3) { total = total + 10; } if (p1 == 1 & p2 == 1 & p3 == 1) { total = total + 20; } if (p1 == 2 & p2 == 2 & p3 == 2) { total = total + 30; } if (p1 == 3 & p2 == 3 & p3 == 3) { total = total + 50; } credits = credits + total; label3.Text = "Win: " + total.ToString(); label1.Text = "Credits: " + credits.ToString(); } }
private void button1_Click(object sender, EventArgs e) { if (credits >= bet) { credits = credits - bet; label1.Text = "Credits: " + credits.ToString(); for (var i = 0; i < 10; i++) { p1 = IntUtil.Random(1, 4); p2 = IntUtil.Random(1, 4); p3 = IntUtil.Random(1, 4); } if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } pictureBox1.Image = Image.FromFile(p1.ToString() + ".jpg"); if (pictureBox2.Image != null) { pictureBox2.Image.Dispose(); } pictureBox2.Image = Image.FromFile(p2.ToString() + ".jpg"); if (pictureBox3.Image != null) { pictureBox3.Image.Dispose(); } pictureBox3.Image = Image.FromFile(p3.ToString() + ".jpg"); total = 0; if (p1 == 3) { total = total + 5; } if (p1 == 2 & p2 == 2) { total = total + 10; } if (p1 == 3 & p2 == 3) { total = total + 10; } if (p1 == 1 & p2 == 1 & p3 == 1) { total = total + 20; } if (p1 == 2 & p2 == 2 & p3 == 2) { total = total + 30; } if (p1 == 3 & p2 == 3 & p3 == 3) { total = total + 50; } credits = credits + total; label3.Text = "Win: " + total.ToString(); label1.Text = "Credits: " + credits.ToString(); if (credits >= 200) { MessageBox.Show("You have won Caleb Crawdad's mini Game! \nCaleb Crawdad has proof of being nowhere near the murder scene that night, and his family reports him being at home during that time. However, Crawdad reckons Ole Nathaniel Nutmeg may have encouraged him to drink too much the night of the murder. "); button1.Visible = false; } if (credits <= 0) { MessageBox.Show("You have lost Caleb Cradad's Mini Game! \tYou will not get his final clue."); button1.Visible = false; } } }
private T RandomValueOfArray <T>(IReadOnlyList <T> array) { return(array[IntUtil.Random(0, array.Count)]); }
public Valley() { this.noTrees = IntUtil.Random(Tree.spawn[0], Tree.spawn[1] + 1); }
public void CalculateResults() { //credits = credits - bet; //TODO update Credit text //label1.Text = "Credits: " + credits.ToString(); //Randomize our three reels for (var i = 0; i < 10; i++) { p1 = IntUtil.Random(1, 4); p2 = IntUtil.Random(1, 4); p3 = IntUtil.Random(1, 4); } //TODO play animation for each reel depending on result switch (p1) { case 1: //Debug.Log("We Chose Red"); reel1Anim.SetTrigger("makeRed"); break; case 2: //Debug.Log("We Chose Greed"); reel1Anim.SetTrigger("makeGreen"); break; case 3: //Debug.Log("We Chose Blue"); reel1Anim.SetTrigger("makeBlue"); break; default: Debug.Log("Invalid reel outcome"); break; } switch (p2) { case 1: //Debug.Log("We Chose Red"); reel2Anim.SetTrigger("makeRed"); break; case 2: //Debug.Log("We Chose Greed"); reel2Anim.SetTrigger("makeGreen"); break; case 3: //Debug.Log("We Chose Blue"); reel2Anim.SetTrigger("makeBlue"); break; default: Debug.Log("Invalid reel outcome"); break; } switch (p3) { case 1: //Debug.Log("We Chose Red"); reel3Anim.SetTrigger("makeRed"); break; case 2: //Debug.Log("We Chose Greed"); reel3Anim.SetTrigger("makeGreen"); break; case 3: //Debug.Log("We Chose Blue"); reel3Anim.SetTrigger("makeBlue"); break; default: Debug.Log("Invalid reel outcome"); break; } /* * if (pictureBox1.Image != null) pictureBox1.Image.Dispose(); * pictureBox1.Image = Image.FromFile(p1.ToString() + ".png"); * * if (pictureBox2.Image != null) pictureBox2.Image.Dispose(); * pictureBox2.Image = Image.FromFile(p2.ToString() + ".png"); * * if (pictureBox3.Image != null) pictureBox3.Image.Dispose(); * pictureBox3.Image = Image.FromFile(p3.ToString() + ".png"); */ //resets total before calculating redTotal = 0; greenTotal = 0; blueTotal = 0; int totalReel1 = baseAward; int totalReel2 = baseAward; int totalReel3 = baseAward; // GET RESULTS FROM PAYTABLE // CHECK IF 1, 2 OR 3 OCCURANCES bool reel12Anim = false; bool reel23Anim = false; bool reel123Anim = false; if (p1 == p2 && p2 == p3) { totalReel1 = totalReel1 * trippleMultiplier; myAnimator.SetTrigger("123win"); addValues(1, totalReel1); } else if (p1 == p2) { totalReel1 = totalReel1 * doubleMultiplier; myAnimator.SetTrigger("12win"); addValues(1, totalReel1); addValues(3, totalReel3); } else if (p2 == p3) { totalReel2 = totalReel2 * doubleMultiplier; myAnimator.SetTrigger("23win"); addValues(2, totalReel2); addValues(1, totalReel1); } else { addValues(1, totalReel1); addValues(2, totalReel2); addValues(3, totalReel3); } /* * if (p1 == 3) blueTotal = blueTotal + 5; * * if (p1 == 2 & p2 == 2) greenTotal = greenTotal + 10; * if (p1 == 3 & p2 == 3) blueTotal = blueTotal + 10; * * if (p1 == 1 & p2 == 1 & p3 == 1) redTotal = redTotal + 20; * if (p1 == 2 & p2 == 2 & p3 == 2) greenTotal = greenTotal + 30; * if (p1 == 3 & p2 == 3 & p3 == 3) blueTotal = blueTotal + 50; */ redTotal = redTotal * (bet / 100); greenTotal = greenTotal * (bet / 100); blueTotal = blueTotal * (bet / 100); spinManager.spinResultRed = redTotal; spinManager.spinResultGreen = greenTotal; spinManager.spinResultBlue = blueTotal; Debug.Log("RED = " + redTotal + " || " + "GREEN = " + greenTotal + " || " + "BLUE = " + blueTotal); spinManager.SpinPressed(); //credits = credits + total; }