Exemplo n.º 1
0
        private void ApplyChangesAfterChoice(int eventNum)
        {
            NightRobberyData        rob = m_robberies[eventNum];
            NightEventButtonDetails bd  = rob.nightEvent.RootNode.Buttons[NightEventWindow.Choice];

            rob.ApplyChoice(bd);
        }
Exemplo n.º 2
0
        private void AssignNightEventDataToWindow(NightRobberyData rData, float time)
        {
            UnityAction windowSetUpMethod;
            RobberyType rt            = rData.Robbery.RobberyType;
            int         ln            = rData.Robbery.LocationNum;
            Vector2     windowPostion = RobberiesManager.Instance.Robberies[rt][ln].transform.localPosition;

            switch (rData.Status)
            {
            case EventStatus.Success:
                windowSetUpMethod = () => UIManager.nightEventWindow.ShowSuccess(rData.nightEvent.Success,
                                                                                 rData.Awards, rData.Money, windowPostion);
                RobberiesManager.Instance.AddNightEvent(rData.Robbery.RobberyType,
                                                        rData.Robbery.LocationNum, windowSetUpMethod, EventStatus.Success, time);
                break;

            case EventStatus.Fail:
                windowSetUpMethod = () => UIManager.nightEventWindow.ShowFail(rData.nightEvent.Fail, windowPostion);
                RobberiesManager.Instance.AddNightEvent(rData.Robbery.RobberyType,
                                                        rData.Robbery.LocationNum, windowSetUpMethod, EventStatus.Fail, time);
                break;

            case EventStatus.InProgress:
                windowSetUpMethod = () => UIManager.nightEventWindow.ShowChoice(rData.nightEvent.RootNode, windowPostion);
                RobberiesManager.Instance.AddNightEvent(rData.Robbery.RobberyType,
                                                        rData.Robbery.LocationNum, windowSetUpMethod, EventStatus.InProgress, time);
                break;
            }
        }
Exemplo n.º 3
0
        private IEnumerator NightEvents()
        {
            while (GetEventNum(out m_currentEventNum))
            {
                Debug.Log("Call robbery event: " + m_currentEventNum);
                NightRobberyData rob = m_robberies[m_currentEventNum];

                //todo: implement event for that
                RobberyType rt = rob.Robbery.RobberyType;
                int         ln = rob.Robbery.LocationNum;
                MapController.Instance.MoveToPosition(RobberiesManager.Instance.Robberies[rt][ln].LocalPosition);

                if (rob.nightEvent.RootNode != null)
                {
                    AssignNightEventDataToWindow(rob, eventTime);
                    yield return(new WaitForSeconds(eventTime));

                    if (NightEventWindow.Choice == -1)
                    {
                        MakeChoice(Random.Range(0, rob.nightEvent.RootNode.Buttons.Count));
                    }
                    RobberiesManager.Instance.ResetNightEvent(rob.Robbery.RobberyType, rob.Robbery.LocationNum);
                    ApplyChangesAfterChoice(m_currentEventNum);

                    if (rob.nightEvent.RootNode.Buttons[NightEventWindow.Choice].NextEventNode != null)
                    {
                        rob.nightEvent.RootNode = rob.nightEvent.RootNode.Buttons[NightEventWindow.Choice].NextEventNode;
                    }
                    else
                    {
                        rob.nightEvent.RootNode = null;
                    }
                }
                else
                {
                    if (GetResult(m_currentEventNum) == false)
                    {
                        rob.SetAsFailed();
                    }
                    else
                    {
                        rob.SetAsSuccesfull();
                    }
                    AssignNightEventDataToWindow(rob, eventTime);
                    yield return(new WaitForSeconds(eventTime));

                    if (NightEventWindow.Choice == -1)
                    {
                        MakeChoice(0);
                    }
                    RobberiesManager.Instance.ResetNightEvent(rob.Robbery.RobberyType, rob.Robbery.LocationNum);
                    rob.nightEvent = null;
                }
                UIManager.nightEventWindow.CloseWindow();
            }
            FinishNight();
        }
Exemplo n.º 4
0
 public NightEventArgs(NightRobberyData robberyData)
 {
     m_robberyData = robberyData;
 }