Пример #1
0
        public void UpdatePopStrategy(GuestPopDestinationCtrl ctrl, IGuestTypeStrategy typeStrategy, int[] values, float[] fvalues)
        {
            m_remainTime -= Time.deltaTime;
            if (m_remainTime > 0.0f)
            {
                return;
            }

            m_remainTime = fvalues[0];

            int count = values[0];

            for (int i = 0; i < count; ++i)
            {
                GuestPopPointerCtrl startPoint = null;
                GuestPopPointerCtrl endPoint   = null;

                {
                    int r   = Random.Range(0, ctrl.baseSumCost + 1);
                    int sum = 0;
                    foreach (GuestPopPointerCtrl unit in ctrl.pointTable)
                    {
                        if (unit.m_priority != 0)
                        {
                            sum += unit.m_priority;
                            if (r <= sum)
                            {
                                startPoint = unit;
                                break;
                            }
                        }
                    }
                }
                {
                    int r = Random.Range(0, ctrl.pointTable.Length);
                    endPoint = ctrl.pointTable[r];
                }

                ctrl.SendPopGuest(typeStrategy.CalcType(ctrl), startPoint, ctrl.GetDestination(), endPoint);
            }
        }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        m_slotIndex = 0;
        pointTable  = this.GetComponentsInChildren <GuestPopPointerCtrl>();
        baseSumCost = 0;
        foreach (GuestPopPointerCtrl unit in pointTable)
        {
            baseSumCost += unit.m_priority;
        }

        foreach (GuestParam unit in m_param)
        {
            unit.m_num = unit.m_capacity;
        }

        foreach (StrategySlot slot in m_slotStrategy)
        {
            slot.Initialize();
        }

        m_slotTime     = m_slotStrategy[m_slotIndex].m_time;
        m_typeStrategy = new GuestPopStrategyInternal.GuestTypeStrategy_Random();
    }
 public void UpdatePopStrategy(GuestPopDestinationCtrl ctrl, IGuestTypeStrategy typeStrategy, int[] values, float[] fvalues)
 {
     // Empty
 }