IEnumerator Next() { yield return(new WaitForSeconds(2.5f)); gameBall = (GameObject)Instantiate(ball, new Vector3(9.711f, 0.825f, 7.741f), Quaternion.identity); bm = gameBall.GetComponent <Basketball>(); }
private void OnSceneGUI() { Basketball ball = target as Basketball; EditorGUI.BeginChangeCheck(); Quaternion rot = Handles.RotationHandle(ball.rotation, ball.transform.position); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(ball, "Rotated RotateAt Point"); ball.rotation = rot; ball.UpdateBallRotation(); } if (Event.current.type == EventType.Repaint) { Transform transform = ((Basketball)target).transform; Handles.color = Handles.zAxisColor; Handles.ArrowHandleCap(0, transform.position + new Vector3(0, 0, 0f), transform.rotation * Quaternion.LookRotation(Vector3.forward), size, EventType.Repaint); } Handles.color = Color.cyan; float hizScale = Handles.ScaleSlider(ball.Hiz, ball.transform.position, ball.transform.forward, ball.transform.rotation, HandleUtility.GetHandleSize(ball.transform.position), 0.1f); ball.Hiz = hizScale; Handles.Label(ball.transform.position + (Vector3.up * 1.25f), string.Format("Açı: {0}\nHız: {1}", ball.transform.rotation.eulerAngles.x, ball.Hiz)); }
// Start is called before the first frame update void Start() { basketball = GetComponent <Basketball>(); duzlemNormal = Duzlem.transform.up; HizVektoru = basketball.Hiz * basketball.transform.forward; StartCoroutine(CarpmaTesti()); }
public ActionResult AddOrEdit(Basketball entry) { using (BasketballEntities db = new BasketballEntities()) { var success = true; //Setting condition var message = ""; //Test logic var newList = db.Basketballs.ToList(); //creating new list to compare too var compare = from c in newList where c.Exercise == entry.Exercise && c.ExerciseDate == entry.ExerciseDate select c; //LINQ to filter what to compare if (compare.Any()) //Checking if same exercise added on same day { success = false; message = "false!"; } else //IF condition is met, add and save data entry { db.Basketballs.Add(entry); db.SaveChanges(); success = true; message = "succesful save!"; } return(Json(new { success, message }, JsonRequestBehavior.AllowGet)); } }
void Update() { if (!aimingMode) return; Vector3 mousePos2D = Input.mousePosition; mousePos2D.z = -Camera.main.transform.position.z; Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D); Vector3 mouseDelta = mousePos3D - launchPos; float maxMagnitude = this.GetComponent<SphereCollider>().radius; if (mouseDelta.magnitude > maxMagnitude) { mouseDelta.Normalize(); mouseDelta *= maxMagnitude; } Vector3 projPos = launchPos + mouseDelta; projectile.transform.position = projPos; if (Input.GetMouseButtonUp(0)) { aimingMode = false; projectileRigidbody.isKinematic = false; projectileRigidbody.velocity = -mouseDelta * velocityMult; FollowCam.POI = projectile; projectile = null; Basketball.ShotFired(); } }
public void BasketballRentTest(int startHours, int startMinutes, int endHours, int endMinutes, double expectedCost) { IRentable basketball = new Basketball(); var cost = basketball.CalculateTotalRentCost(new DateTime(2019, 09, 05, startHours, startMinutes, 00), new DateTime(2019, 09, 05, endHours, endMinutes, 00)); Assert.Equal(Math.Round(expectedCost, 2), Math.Round(cost, 2)); }
public void enumStartingFive() { Basketball pointGuard = Basketball.Stockton; Basketball center = Basketball.Shaq; Console.WriteLine(pointGuard); Console.WriteLine(center); }
public Form1() { InitializeComponent(); fGames = new List <Game <Football> >(); bGames = new List <Game <Basketball> >(); //TEMP GAMES //BASKETBALL Basketball detailsHome = new Basketball(); Details <int, String> detail1 = new Details <int, string>(); detail1.key = 30; detail1.value = "Kobe Bryant"; detailsHome.gameDetails = new List <Details <int, string> >(); detailsHome.gameDetails.Add(detail1); Basketball detailsAway = new Basketball(); Details <int, String> detail2 = new Details <int, string>(); detail2.key = 25; detail2.value = "Rajon Rondo"; detailsAway.gameDetails = new List <Details <int, string> >(); detailsAway.gameDetails.Add(detail2); DateTime date = new DateTime(); Game <Basketball> bGame = new Game <Basketball>("LA Lakers", "NO Pelicans", 30, 25, detailsHome, detailsAway, date); bGames.Add(bGame); //FOOTBALL Football detailsHome2 = new Football(); Details <String, String> detail3 = new Details <String, String>(); detail3.key = "25min"; detail3.value = "Sergio Ramos"; detailsHome2.gameDetails = new List <Details <String, String> >(); detailsHome2.gameDetails.Add(detail3); Football detailsAway2 = new Football(); Details <String, String> detail4 = new Details <String, String>(); detail4.key = "55min"; detail4.value = "Lionel Messi"; detailsAway2.gameDetails = new List <Details <String, String> >(); detailsAway2.gameDetails.Add(detail4); DateTime date2 = new DateTime(); Game <Football> fGame = new Game <Football>("Real Madrid", "Barcelona", 1, 1, detailsHome2, detailsAway2, date); fGames.Add(fGame); // footballListBox.DataSource = fGames; basketballListBox.DataSource = bGames; }
public async Task <List <Basketball> > GetBasketball() { var document = new HtmlDocument(); var client = new WebClient(); client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"); var htmlData = await client.DownloadStringTaskAsync(BasketballUrl); document.LoadHtml(htmlData); var table = document.DocumentNode.SelectSingleNode(".//div[@id='all_misc_stats']"); var tableWithComments = table.OuterHtml; var tableUncommented = tableWithComments.Replace("<!--", "").Replace("-->", ""); var document1 = new HtmlDocument(); document1.LoadHtml(tableUncommented); var rows = document1.DocumentNode.SelectSingleNode(".//tbody").SelectNodes(".//tr"); var basketballs = new List <Basketball>(); foreach (var row in rows) { var items = row.ChildNodes; var bass = new Basketball { Rk = items[0].InnerText, Team = items[1].InnerText, Age = items[2].InnerText, Wins = items[3].InnerText, Losses = items[4].InnerText, WinsPyth = items[5].InnerText, LossesPyth = items[6].InnerText, MOV = items[7].InnerText, SOS = items[8].InnerText, SRS = items[9].InnerText, OffRtg = items[10].InnerText, DefRtg = items[11].InnerText, Pace = items[12].InnerText, Fta_per_fga_pct = items[13].InnerText, Fg3a_per_fga_pct = items[14].InnerText, TSProcent = items[15].InnerText, EfgPrc = items[16].InnerText, TOVProcent = items[17].InnerText, ORBProcent = items[18].InnerText, FTRate = items[19].InnerText, Opp_efg_pct = items[20].InnerText, Opp_tov_pct = items[21].InnerText, DRBProcent = items[22].InnerText, Opp_ft_rate = items[23].InnerText, Arena = items[24].InnerText, Attend = items[25].InnerText, Attendance_Per = items[26].InnerText, }; basketballs.Add(bass); } return(basketballs); }
public void InitializeObjects() { controller = GameObject.Find("GameController").GetComponent <GameController>(); basketball = controller.BasketballObject; basketballRigidbody = controller.BasketballRigidbody; player = controller.PlayerObject; playerCamera = controller.PlayerCamera; GrabBall(); }
static void Main(string[] args) { Game game = new Football(); game.Play(); Console.WriteLine(); game = new Basketball(); game.Play(); Console.WriteLine(); Console.ReadKey(); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Projectile" && scored == false) { Goal.goalMet = true; Material mat = GetComponent <Renderer>().material; Color c = mat.color; c.a = 1; mat.color = c; scored = true; Basketball.GoalHit(); } }
void Start() { scored = 0; notInBin = true; self = GetComponent <Renderer>().bounds; basketball = GetComponent <Basketball>(); Vector3 a = new Vector3(1, 2, 0); Vector3 b = new Vector3(-2, 3, 5); Vector2 c = new Vector2(0, -4); Vector2 d = new Vector2(-4, 1); }
// Start is called before the first frame update void Start() { basketball = GetComponent <Basketball>(); duzlemNormal = Duzlem.transform.forward * -1; HizVektoru = basketball.Hiz * basketball.transform.forward; PoligonVertices = Duzlem.GetComponent <MeshFilter>().mesh.vertices; for (int i = 0; i < PoligonVertices.Length; i++) { PoligonVertices[i].x *= Duzlem.transform.localScale.x; PoligonVertices[i].y *= Duzlem.transform.localScale.y; PoligonVertices[i].z *= Duzlem.transform.localScale.z; } StartCoroutine(CarpmaTesti()); }
void Start() { foreach (Renderer rend in objects) { if (rend.tag != "invisableCube") { rend.enabled = true; } } scored = 0; self = GetComponent <Renderer>().bounds; basketball = GetComponent <Basketball>(); }
// Start is called before the first frame update void Start() { player = GameObject.Find("Player").GetComponent <Player>(); basketball = GameObject.Find("Basketball").GetComponent <Basketball>(); Debug.Log(basketball == null); basketballRigidbody = basketball.GetComponent <Rigidbody>(); playerCamera = GameObject.Find("FirstPersonCharacter"); resetTimerInitial = 10.0f; resetTimer = resetTimerInitial; resetGame = false; pauseTimer = false; player.InitializeObjects(); }
private void Update() { SetCountText(); if (gameTime == 5) { if (gameScore >= 1) { win = 1; } else { win = 2; } Destroy(gameBall, 2f); } if (bm.ground >= 1 && changeGoal && changeGround) { gameTime++; changeGround = false; Destroy(gameBall, 1.5f); if (gameTime < 5) { gameBall = (GameObject)Instantiate(ball, new Vector3(9.711f, 0.825f, 7.741f), Quaternion.identity); bm = gameBall.GetComponent <Basketball>(); } } else if (bm.ground == 0 && changeGoal && !changeGround) { changeGround = true; } if (bm.goal >= 1 && changeGoal && changeGround) { gameScore++; changeGoal = false; } else if (bm.goal == 0 && !changeGoal && changeGround) { changeGoal = true; } }
private void addNewGameOK_Click(object sender, EventArgs e) { if (gameTypeBox.SelectedItem.Equals("Кошарка"))//Basketball { if (!(homeTeamTextBox.Text is null || homeTeamTextBox.Text.Equals("")) && !(awayTeamTextBox.Text is null || awayTeamTextBox.Text.Equals(""))) { Basketball homeTeam = new Basketball(); Basketball awayTeam = new Basketball(); homeTeam.gameDetails = detailsHome; awayTeam.gameDetails = detailsAway; bGame = new Game <Basketball>(homeTeamTextBox.Text, awayTeamTextBox.Text, int.Parse(homeTeamScoreTextBox.Text), int.Parse(awayTeamScoreTextBox.Text), homeTeam, awayTeam, dateOfMatch.Value); this.Close(); } else { MessageBox.Show("Погрешни податоци!", "ГРЕШКА", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void TeamDefaultInitsTest() { ISport football = new Football(); ITeam eagles = new Team(football, "Eagles"); Assert.AreEqual(eagles.Name, "Eagles"); Assert.AreEqual(eagles.ID, 404); // 404 is default ID Assert.AreEqual(eagles.PlayerList.Count, 0); Assert.AreEqual(eagles.SportPlayed.Name, "Football"); Assert.AreEqual(eagles.StatList.Count, 4); ISport baseball = new Baseball(); eagles = new Team(baseball, "Eagles"); Assert.AreEqual(eagles.SportPlayed.Name, "Baseball"); ISport basketBall = new Basketball(); eagles = new Team(basketBall, "Eagles"); Assert.AreEqual(eagles.SportPlayed.Name, "Basketball"); }
public string PrintMatchEvents() { Random randNumEvents = new Random(); int amountOfEvents; // a random amount of times events will occur Random randSeed = new Random(); // seed for random players and teams int randEventSeed; // for getting a random sport event this.MatchResultOutputString = ""; // reset output string if (Match.SportPlayed.GetType() == typeof(Football)) { Football football = new Football(); amountOfEvents = randNumEvents.Next(10, 18); for (int i = 0; i < amountOfEvents; i++) { randEventSeed = randSeed.Next(0, Match.SportPlayed.NumEvents); ITeam teamChosen = Match.getRandomTeam(randSeed); if (randEventSeed == 0) { teamChosen.StatList[0].Value++; // increment touchdowns teamChosen.Score += 7; MatchResultOutputString += football.Touchdown(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 1) { teamChosen.StatList[1].Value++; // increment Interceptions MatchResultOutputString += football.Interception(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 2) { teamChosen.StatList[2].Value++; // increment field goals teamChosen.Score += 3; MatchResultOutputString += football.FieldGoal(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 3) { teamChosen.StatList[3].Value++; // increment penalties MatchResultOutputString += football.Penalty(teamChosen.GetRandomPlayer(randSeed)); } } } else if (Match.SportPlayed.GetType() == typeof(Baseball)) { Baseball baseball = new Baseball(); amountOfEvents = randNumEvents.Next(6, 12); for (int i = 0; i < amountOfEvents; i++) { randEventSeed = randSeed.Next(0, Match.SportPlayed.NumEvents); ITeam teamChosen = Match.getRandomTeam(randSeed); if (randEventSeed == 0) { teamChosen.StatList[0].Value++; int scoreAmount = randSeed.Next(1, 4); teamChosen.Score += scoreAmount; MatchResultOutputString += baseball.HomeRun(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 1) { teamChosen.StatList[1].Value++; teamChosen.Score += 1; MatchResultOutputString += baseball.ScoreRun(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 2) { teamChosen.StatList[2].Value++; teamChosen.Score += 4; MatchResultOutputString += baseball.GrandSlam(teamChosen.GetRandomPlayer(randSeed)); } } } else if (Match.SportPlayed.GetType() == typeof(Hockey)) { Hockey hockey = new Hockey(); amountOfEvents = randNumEvents.Next(3, 13); for (int i = 0; i < amountOfEvents; i++) { randEventSeed = randSeed.Next(0, Match.SportPlayed.NumEvents); ITeam teamChosen = Match.getRandomTeam(randSeed); if (randEventSeed == 0) { teamChosen.StatList[0].Value++; teamChosen.Score += 1; MatchResultOutputString += hockey.Score(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 1) { teamChosen.StatList[1].Value++; MatchResultOutputString += hockey.Fight(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 2) { teamChosen.StatList[2].Value++; MatchResultOutputString += hockey.StealPuck(teamChosen.GetRandomPlayer(randSeed)); } } } else if (Match.SportPlayed.GetType() == typeof(Basketball)) { Basketball basketBall = new Basketball(); amountOfEvents = randNumEvents.Next(20, 35); for (int i = 0; i < amountOfEvents; i++) { randEventSeed = randSeed.Next(0, Match.SportPlayed.NumEvents); ITeam teamChosen = Match.getRandomTeam(randSeed); if (randEventSeed == 0) { teamChosen.StatList[0].Value++; teamChosen.Score += 3; MatchResultOutputString += basketBall.ThreePoint(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 1) { teamChosen.StatList[1].Value++; teamChosen.Score += 2; MatchResultOutputString += basketBall.TwoPoint(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 2) { teamChosen.StatList[2].Value++; MatchResultOutputString += basketBall.Foul(teamChosen.GetRandomPlayer(randSeed)); } else if (randEventSeed == 3) { teamChosen.StatList[3].Value++; teamChosen.Score += 2; MatchResultOutputString += basketBall.Dunk(teamChosen.GetRandomPlayer(randSeed)); } } } return(MatchResultOutputString); }
void Awake() { Instance = this; }
// Start is called before the first frame update void Start() { S = this; UIT_Text_Win.SetActive(false); SwitchView("Show Both"); }
// Main function for where instructions are placed for computer to execute. static void Main() { // 1) Print out line of text. Console.WriteLine("1) Hello Marsh!!"); // Using employee namespace from "EmployeeData". Included at top. EmployeeData.EmployeeInfo.Employee1("Marsh", "1"); // Create a string variable string testing = "2) This is just a test"; // 2) Print out string variable. Console.WriteLine(testing); // Returns a true value if string contains the following phrase. Console.WriteLine(testing.Contains("This")); // Returns the seconds character of the string. Console.WriteLine(testing[1]); // Returns the 4 characters of the string testing starting at index 11. Index includes spaces. Console.WriteLine(testing.Substring(11, 4)); // 3) Print out a floating point number. double test_number = 4.54; Console.WriteLine("3) " + test_number); // 4) Allow user to enter a line of text. //This line allows a user to write a line of text without the program jumping to the next executing line. Console.Write("4) Enter your name here: "); // Stores the line of text entered as a string. string name = Console.ReadLine(); // 5) Repeat nomenclature for entering age. Console.Write("5) Enter your age: "); string age = Console.ReadLine(); // 6) Printout entered text. Console.WriteLine("6) Hello " + name + ", you are " + age + " years old!"); // Create an array of inegers. int[] array1 = { 1, 2, 3, 4, 5, 6 }; array1[1] = 6000; //Printout. Console.WriteLine(array1[2]); Console.WriteLine(array1[1]); // 7) Declare & compose 3 strings to output a sentence. var string1 = "Hi"; var string2 = ", my name is Marshman!"; var string3 = " Whats yours?"; Console.WriteLine("7)" + string1 + string2 + string3); // 8) Append a string to a Stringbuilder object. var sb = new StringBuilder(); var sb2 = new StringBuilder("Hello man"); sb.Append("8) Bighead :)"); Console.WriteLine(sb); Console.WriteLine(sb2); // 9) String Formatter var nine_city = "Indianapolis"; //string var nine_temperature = 85.6f; //floating point number var nine_date = DateTime.Now; //date & time Console.WriteLine(string.Format("9) Welcome to {0}, the temperature is {1} Deg. F, while the date is {2}.", nine_city, nine_temperature, nine_date)); // 10) Parsing string into an integer. var nine_int_string = "13"; var nine_int1 = int.Parse(nine_int_string); Console.WriteLine("10) " + nine_int1); // 11) Date time example var eleven_birthday = new DateTime(1995, 9, 10); //Create an object for a custom date. var eleven_ageDifference = DateTime.Now - eleven_birthday; Console.WriteLine("11) You are currently " + (eleven_ageDifference.Days / 365) + " Years old"); Console.WriteLine("11) " + eleven_birthday.ToLongDateString()); //Change date time to string date format. // 12) Imported from class "Basketball". Basketball mvp = new Basketball(2); Console.WriteLine("12) " + mvp.totalPoints); mvp.fouled(); // Call "fouled()" function. Console.WriteLine("12) " + mvp.totalPoints); // 13) Abstract method imported from derived class "Lakers". Lakers thirteen_result = new Lakers(); Console.WriteLine("13) Total players of the month " + thirteen_result.players_of_the_month()); // 14) Virtual method imported from base class "Teams". Lakers fourteen_result_1 = new Lakers(); Console.WriteLine("14) " + fourteen_result_1.best_player("LeBron James")); //Keeps console window up after compiling the code. Waits for an entry of text. Console.ReadLine(); }
public ActionResult Edit(Basketball.Domain.Entities.DayOfWeek @dayOfWeek) { if (ModelState.IsValid) { dayOfWeekService.Update(@dayOfWeek); dayOfWeekService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return RedirectToAction("Index"); } return View(@dayOfWeek); }