コード例 #1
0
        public static NightEvent[] GetEventsForRobberyType(RobberyType robberyType)
        {
            if (m_xmlDoc == null)
            {
                GetNightEventsCollectionData();
            }
            XmlNode eventsOfNeededType = m_xmlDoc.SelectSingleNode("./eventsCollection/robbery[@type='" + robberyType.ToString("d").ToLower() + "']");

            int eventsCount = eventsOfNeededType.ChildNodes.Count;

            NightEvent[] nightEvents = new NightEvent[eventsCount];

            for (int eventNumber = 0; eventNumber < eventsCount; eventNumber++)
            {
                nightEvents[eventNumber] = new NightEvent();
                XmlNode eventRootNode = eventsOfNeededType.SelectSingleNode("./event[@id='" + eventNumber + "']");

                if (eventRootNode.SelectSingleNode("./node") != null)
                {
                    nightEvents[eventNumber].RootNode = ParseEventRandomTree(eventRootNode.SelectSingleNode("./node"), robberyType);
                }
                nightEvents[eventNumber].Success = ParseEventRandomTree(eventRootNode.SelectSingleNode("./success"), robberyType);
                nightEvents[eventNumber].Fail    = ParseEventRandomTree(eventRootNode.SelectSingleNode("./fail"), robberyType);
            }
            return(nightEvents);
        }
コード例 #2
0
 //Constructor
 public NightRobberyData(Robbery robbery)
 {
     this.m_robbery    = robbery;
     nightEvent        = NightEventsOptions.GetRandomEvent(robbery.RobberyType);
     m_eventStatus     = EventStatus.InProgress;
     m_chance          = RobberiesOptions.CalculatePreliminaryChance(robbery);
     m_policeChance    = Random.Range(0, 51);
     m_hospitalChance  = Random.Range(0, 51);
     m_money           = RobberiesOptions.GetRobberyMoneyRewardAtTheCurrentMoment(robbery.RobberyType);
     m_awards          = RobberiesOptions.GetRobberyAwardsAtTheCurrentMoment(robbery.RobberyType);
     m_policeKnowledge = 1;
 }