Exemple #1
0
 void Start()
 {
     base.Start();
     //controller = GetComponent<CharacterController>();
     rayColor                 = Color.cyan;
     throwingHandScript       = GetComponentInChildren <ThrowingHand>();
     userControl              = GetComponent <UserControl>();
     gameManager.hikeTrigger += HikeTrigger;
 }
        static PitcherAppearance ParseStarter(JObject game, string homeOrAway, DateTime day)
        {
            var pitcherToken = game[homeOrAway + "_probable_pitcher"];

            if (pitcherToken == null)
            {
                Logger.Debug("No probable pitcher for {0} team", homeOrAway);
                return(null);
            }
            int?pitcherId = pitcherToken["id"]?.ToInt();

            if (!pitcherId.HasValue || pitcherId == 0)
            {
                Logger.Warn("No pitcher id for probable start on {0} team", homeOrAway);
                return(null);
            }

            string       firstN = pitcherToken.SafeParseToken <string>("first", Logger);
            string       lastN  = pitcherToken.SafeParseToken <string>("last", Logger);
            int          number = pitcherToken.SafeParseToken <int>("number", Logger);
            ThrowingHand throws = pitcherToken.SafeParseToken <ThrowingHand>("throwinghand", Logger);

            return(new PitcherAppearance()
            {
                Date = day,
                Order = 1,
                Pitcher = new Pitcher()
                {
                    PitcherId = pitcherId.Value,
                    FirstName = firstN,
                    LastName = lastN,
                    JerseyNumber = number,
                    Throws = throws,
                }
            });
        }