Exemple #1
0
        //private void OnGUI()
        //{
        //    if (GUI.Button(new Rect(0, 0, 100, 30), "行走"))
        //    {
        //        string tag = "" + ((1 << 13) ^ (1 << 9) ^ (1 << 5));
        //        hashMap[tag].Transition(Item.STATE_TAG.WALK);
        //    }
        //    if (GUI.Button(new Rect(110, 0, 100, 30), "攻击"))
        //    {
        //        hashMap[tag].Transition(Item.STATE_TAG.ATTACK1);
        //    }
        //    if (GUI.Button(new Rect(220, 0, 100, 30), "攻击2"))
        //    {
        //        hashMap[tag].Transition(Item.STATE_TAG.ATTACK2);
        //    }
        //}

        //// Update is called once per frame
        //void Update()
        //{
        //    //float fix = Time.deltaTime * speed;

        //    foreach (string key in hashMap.Keys)
        //    {
        //        Item item = hashMap[key];
        //        //updateItem(item, fix);
        //        item.Do(Time.deltaTime);
        //    }
        //}

        //private void updateItem(Item item, float dt)
        //{

        //    if (!item.DV.IsZero())
        //    {
        //        var curPos = item.GO.transform.localPosition;
        //        item.GO.GetComponent<CharacterController>().Move(new Vector3(-dt * (float)item.DV.x, 0, -dt * (float)item.DV.z));
        //        transition(2);
        //    }
        //    else
        //        transition(1);
        //}

        //// handleLogicTick 处理逻辑层传过来的演示数据,更新目标状态
        //private void handleLogicTick(EventLogicTickList action)
        //{
        //    foreach (EventLogicTick tick in action)
        //    {

        //        Debug.Log("handle logic tick");
        //        //string tag = "" + tick.tag;
        //        //var item = hashMap[tag];
        //        //if (!item.GO.CompareTag(tag))
        //        //    continue;


        //        //item.DV = tick.v3;
        //        //if (tick.v3.IsZero())
        //        //    continue;

        //        //float radian = Mathf.Atan2(decimal.ToSingle(item.DV.z), decimal.ToSingle(item.DV.x));
        //        //float angle = radian / Mathf.PI * 180;

        //        //item.GO.transform.rotation = Quaternion.Euler(0, -90.0f - angle, 0);
        //    }
        //}

        //NOTE: 处理匹配消息完成
        private void handleNetMatch(Google.Protobuf.WellKnownTypes.Any any)
        {
            WarPb.War_Match match = any.Unpack <WarPb.War_Match>();
            GameObject      prefab;

            switch (match.MapId)
            {
            default:
                prefab = (GameObject)Resources.Load("Prefabs/CompleteLevelArt");
                break;
            }
            GameObject plane = Instantiate(prefab);

            SceneManager.MoveGameObjectToScene(plane, gameObject.scene);

            Net.WsClient.Instance.ID = match.Id;

            //plane.GetComponent<Views.PlaneManager>().DoMatch(match);
            var pm = plane.GetComponent <PlaneManager>();

            pm.DoMatch(match);
            Driver d = gameObject.AddComponent <Driver>();           //NOTE: 添加Driver 组件,处理数据

            d.M = pm.m_Meet;
            EventFollow.Instance.Invoke(pm.Look);
        }
Exemple #2
0
        public void DoMatch(WarPb.War_Match data)
        {
            m_Meet.DoMatch(data);
            //ulong uid = 2;
            //foreach (var tm in m_Meet.m_Tanks)
            //{
            //    if (uid == tm.m_Uid)
            //    {

            //        Look = tm.m_Instance.transform;
            //        break;
            //    }
            //}
            TankManager tm = m_Meet.GetTM(2002);

            if (null != tm)
            {
                Look = tm.m_Instance.transform;
            }
        }
Exemple #3
0
        public void DoMatch(WarPb.War_Match data)
        {
            //data.MapId      //NOTE: 用于确定使用哪个地图
            //DoMatch(data, SceneManager.CreateScene("PhysicField"));

            //Scene scene = SceneManager.GetActiveScene();

            int idx = 0;

            foreach (WarPb.Team team in data.League)
            {
                foreach (MasterPb.Role role in team.Roles)
                {
                    TankManager tm = m_Tanks[idx];
                    tm.m_Instance = GameObject.Instantiate(GetPrefab(role.ModelId), tm.m_SpawnPoint.position, tm.m_SpawnPoint.rotation) as GameObject;
                    //SceneManager.MoveGameObjectToScene(tm.m_Instance, scene);
                    tm.m_Uid = role.Uid;
                    tm.Setup();
                    idx++;
                }
            }
            Physics.IgnoreLayerCollision(9, 9);
        }