示例#1
0
    // 命令の設定を行います
    protected virtual void SetOrder()
    {
        // 命令リストの取得
        if (m_OrderList == null)
        {
            m_OrderList = this.transform.Find("OrderList").GetComponent <OrderList>();
        }
        m_OrderList.InitializeOrder();

        // m_OrderNumbers[i]
        m_OrderNumbers.Add(OrderNumber.ONE);
        m_OrderNumbers.Add(OrderNumber.TWO);
        m_OrderNumbers.Add(OrderNumber.THREE);

        for (int i = 0; i != m_OrderNumbers.Count; ++i)
        {
            ;
            // 命令の追加
            //m_Orders.Add(m_OrderNumbers[i], m_OrdersOne);
            // 命令状態の追加
            m_OrderStatus.Add(m_OrderNumbers[i], OrderStatus.NULL);
        }

        // 命令の追加
        m_Orders.Add(OrderNumber.ONE, m_OrdersOne);
        m_Orders.Add(OrderNumber.TWO, m_OrdersTwo);
        m_Orders.Add(OrderNumber.THREE, m_OrdersThree);
        // 命令状態の追加
        //m_OrderStatus.Add(OrderNumber.ONE, OrderStatus.NULL);
        //m_OrderStatus.Add(OrderNumber.TWO, OrderStatus.NULL);
        //m_OrderStatus.Add(OrderNumber.THREE, OrderStatus.NULL);

        // 命令の追加
        for (int i = 0; i != m_OrderNumbers.Count; ++i)
        {
            // 命令番号の数だけ追加する
            for (int j = 0; j != m_OrderList.GetOrderStatus(m_OrderNumbers[i]).Length; ++j)
            {
                var orders = m_OrderList.GetOrders(m_OrderNumbers[i])[j];
                var state  = m_OrderList.GetOrderStatus(m_OrderNumbers[i])[j];
                //m_Orders[m_OrderNumbers[i]].Add(m_OrderList.GetOrderStatus(m_OrderNumbers[i])[j], orders);
                m_Orders[m_OrderNumbers[i]].Add(state, orders);
                // 番号の設定
                //m_Orders[m_OrderNumbers[i]][m_OrderStatus[m_OrderNumbers[i]]].SetOrderNumber(m_OrderNumbers[i]);
                m_Orders[m_OrderNumbers[i]][state].SetOrderNumber(m_OrderNumbers[i]);
                m_Orders[m_OrderNumbers[i]][state].SetOrderState(state);
            }
            m_PrevOrders[m_OrderNumbers[i]] = OrderStatus.NULL;
        }

        // 命令変更格納リストに追加
        //m_ChangeOrders.Add((orders, numbers, count) => { Change(orders, numbers); });
        m_ChangeOrders.Add((number, dir, obj) => { m_Orders[number][m_OrderStatus[number]].StartAction(gameObject, obj); });
        m_ChangeOrders.Add((number, dir, obj) => { m_Orders[number][m_OrderStatus[number]].GetComponent <DirectionOrder>().StartAction(gameObject, dir); });
        // m_Orders[number][m_OrderStatus[number]].GetComponent<DirectionOrder>().StartAction(gameObject, dir);
    }