Пример #1
0
    void Start()
    {
        LinkedList <int> link = new LinkedList <int>();

        link.AddLast(100);
        link.AddLast(1000);
        link.Remove(100);



        directMessageCenter = new DirectMessageCenter();
        directMessageCenter.Regist(1000, new MessagetExecutorTest());

        //broadcastMessageCenter = new BroadcastMessageCenter();
        //broadcastMessageCenter.Regist(new BroadcastMessageExecutorTest());

        MessageTest msgTest1 = MessageTest.pool.New();

        msgTest1.messageID = 1000;
        msgTest1.Init(100, 200);

        MessageTest msgTest2 = MessageTest.pool.New();

        msgTest2.messageID = 1000;
        msgTest2.Init(300, 400);

        directMessageCenter.Send(msgTest1);
        //broadcastMessageCenter.Send(msgTest2);
    }
        public void OnPress()
        {
            //Debug.LogError("OnPress");
            float h = joy.axisX.axisValue;
            float v = joy.axisY.axisValue;

            if (h != 0 || v != 0)
            {
                //Debug.LogError(h + " " + v);
                JOY_Press joyPress = new JOY_Press();
                joyPress.tankID    = 0;
                joyPress.couldMove = true;
                joyPress.couldTurn = true;
                Vector3 dir = new Vector3(h, 0, v);
                dir.Normalize();
                joyPress.dir = dir;
                battleMessageCenter.Send(joyPress);
            }
        }