Пример #1
0
        public static void SyncMouseButton0Up(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long instant = proto.GetInt(start, ref start);
            int  id      = proto.GetByte(start, ref start);
            Unit unit    = Gamef.GetUnit(id);

            unit.SyncPlayerInput.SyncMouseButton0Up(instant);
        }
Пример #2
0
        public static void SyncMP(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long  instant = proto.GetInt(start, ref start);
            int   id      = proto.GetByte(start, ref start);
            Unit  unit    = Gamef.GetUnit(id);
            float val     = proto.GetFloat(start, ref start);

            unit.SyncUnitState.SyncMP(instant, val);
        }
Пример #3
0
        public static void SyncStop(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long instant    = proto.GetInt(start, ref start);
            int  id         = proto.GetByte(start, ref start);
            int  skillIndex = proto.GetByte(start, ref start);
            Unit unit       = Gamef.GetUnit(id);

            unit.SyncPlayerCastingState.SyncStop(instant, skillIndex);
        }
Пример #4
0
        public static void DestroyObj(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long instant = proto.GetInt(start, ref start);
            int  id      = proto.GetByte(start, ref start);
            Unit unit    = Gamef.GetUnit(id);

            //Destroy the object.
            unit.Death();
        }
Пример #5
0
        public static void SyncTransform(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long       instant  = proto.GetInt(start, ref start);
            int        id       = proto.GetByte(start, ref start);
            Unit       unit     = Gamef.GetUnit(id);
            Vector3    position = ParseVector3(proto, ref start);
            Quaternion rot      = ParseQuaternion(proto, ref start);
            float      speed    = proto.GetFloat(start, ref start);

            unit.SyncMovement.SyncTransform(instant, position, rot, speed);
        }
Пример #6
0
        public static void SyncMobileControlAxes(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long instant = proto.GetInt(start, ref start);           //parse instant
            int  id      = proto.GetByte(start, ref start);          //parse id

            int[]   hv  = ParseHaV(proto.GetByte(start, ref start)); //parse h and v
            Vector3 fwd = ParseVector3(proto, ref start);            // parse camera forward

            Unit unit = Gamef.GetUnit(id);

            unit.SyncPlayerInput.SyncMobileControlAxes(instant, hv[0], hv[1], fwd);
        }
Пример #7
0
        public static void SyncAimTarget(ProtocolBase protocol)
        {
            int           start = 0;
            ProtocolBytes proto = (ProtocolBytes)protocol;

            proto.GetNameX(start, ref start);
            long instant  = proto.GetInt(start, ref start);
            int  sourceId = proto.GetByte(start, ref start);
            int  targetId = proto.GetByte(start, ref start);

            if (targetId == 255)
            {
                targetId = -1;
            }
            Unit unit = Gamef.GetUnit(sourceId);

            Debug.Log(string.Format("Send sync target ID {0} -> ID {1}", sourceId, targetId));
            unit.SyncPlayerCastingState.SyncTarget(instant, Gamef.GetUnit(targetId));
        }