Example #1
0
        void GoalieTouchPuck()
        {
            if (shot == true && GameInfo.StopTime == 0)
            {
                GShot = true;
            }

            foreach (Player p in PlayerManager.Players)
            {
                if (p.Team == HQMTeam.Blue && Puck.Position.Z < 21.5)
                {
                    if (shot == false && GShot == true && GameInfo.StopTime == 0) //goalie has made a save
                    {
                        if (PlayerTouch.Name == p.Name)                           //BlueGoalie check to see if he touched puck
                        {
                            BSave++;
                            ShotCounterB++;
                            BGoalieList.Add("Blue Player: " + p.Name + " / Save number: " + BSave + " / at: " + GameTime + " of period " + GameInfo.Period);
                            GShot = false;
                            System.IO.File.WriteAllText(@"red.txt", string.Empty);
                            System.IO.File.WriteAllText(@"red.txt", ShotCounterB.ToString());
                        }
                    }
                }
                if (p.Team == HQMTeam.Red && Puck.Position.Z > 39)
                {
                    if (shot == false && GShot == true && GameInfo.StopTime == 0) //goalie has made a save
                    {
                        if (PlayerTouch.Name == p.Name)                           //RedGoalie check to see if he touched puck
                        {
                            RSave++;
                            ShotCounterR++;
                            RGoalieList.Add("Red Player: " + p.Name + " / Save number: " + RSave + " / at: " + GameTime + " of period " + GameInfo.Period);
                            GShot = false;
                            System.IO.File.WriteAllText(@"blue.txt", string.Empty);
                            System.IO.File.WriteAllText(@"blue.txt", ShotCounterR.ToString());
                        }
                    }
                }
            }
        }
Example #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            PuckPos.Text = "PuckPos: " + (string)Puck.Position.ToString();
            Slope.Text   = "Shot On Net: " + Puckonnet();
            Shots.Text   = "Blue Shots: " + ShotCounterR;
            Shot2.Text   = "Red Shots: " + ShotCounterB;
            TeamTouchedPuck();
            GoalieTouchPuck();
            GameTime   = (GameInfo.GameTime / 6000) + ":" + ((GameInfo.GameTime / 100) % 60).ToString("00");
            Time.Text  = "Time: " + GameTime;
            RedS.Text  = "Red Saves: " + RSave;
            BlueS.Text = "Blue Saves: " + BSave;


            if (GameInfo.StopTime > 0 && assist == false)

            {
                if (Puck.Position.Z < 4) //scored on blue net
                {
                    SecondA.Add("Red Goal: " + RQueue.ElementAt(2) + " / Primary Assist: " + RQueue.ElementAt(1) + " / Secondary Assist: " + RQueue.ElementAt(0));
                    if (TeamTouch == HQMTeam.Red)
                    {
                        ShotCounterB++;
                        System.IO.File.WriteAllText(@"red.txt", string.Empty);
                        System.IO.File.WriteAllText(@"red.txt", ShotCounterB.ToString());
                    }
                }
                if (Puck.Position.Z > 57) //scored on red net
                {
                    SecondA.Add("Blue Goal: " + BQueue.ElementAt(2) + " / Primary Assist: " + BQueue.ElementAt(1) + " / Secondary Assist: " + BQueue.ElementAt(0));
                    if (TeamTouch == HQMTeam.Blue)
                    {
                        ShotCounterR++;
                        System.IO.File.WriteAllText(@"blue.txt", string.Empty);
                        System.IO.File.WriteAllText(@"blue.txt", ShotCounterR.ToString());
                    }
                }
                GShot = false;
                InitializeQueue();
                assist = true;
            }

            if (GameInfo.StopTime == 0)
            {
                assist = false;
            }

            if (GameInfo.Period == 0)
            {
                System.IO.File.WriteAllText(@"red.txt", "0");
                System.IO.File.WriteAllText(@"blue.txt", "0");
                ShotCounterB = 0;
                ShotCounterR = 0;
                Bshot.Clear();
                Rshot.Clear();
                InitializeQueue();
                SecondA.Clear();
                RGoalieList.Clear();
                BGoalieList.Clear();
                RSave = 0;
                BSave = 0;
                wrote = false;
            }

            TeamLT.Text   = "Red Last Touch: " + RQueue.ElementAt(2) + " / " + RQueue.ElementAt(1) + " / " + RQueue.ElementAt(0);
            PersonLT.Text = "Blue Last Touch: " + BQueue.ElementAt(2) + " / " + BQueue.ElementAt(1) + " / " + BQueue.ElementAt(0);

            if (GameInfo.GameOver == 1 && wrote == false)
            {
                Writer write = new Writer();
                write.WriteLine("Red Shots: " + ShotCounterB + " Blue Shots: " + ShotCounterR + Environment.NewLine, false);
                foreach (var item in Rshot)
                {
                    write.WriteLine(item.ToString(), false);
                }
                foreach (var item2 in Bshot)
                {
                    write.WriteLine(item2.ToString(), false);
                }
                write.WriteLine("", false);
                foreach (var item3 in SecondA)
                {
                    write.WriteLine(item3.ToString(), false);
                }
                write.WriteLine("", false);
                foreach (var item4 in BGoalieList)
                {
                    write.WriteLine(item4.ToString(), false);
                }
                foreach (var item5 in RGoalieList)
                {
                    write.WriteLine(item5.ToString(), false);
                }
                write.WriteLine("Red Saves: " + RSave);
                write.WriteLine("Blue Saves: " + BSave);
                wrote = true;
            }
        }