示例#1
0
 public void AddData(MovementFrame frame)
 {
     if (Data.Count > 0 && Data[Data.Count - 1].Time > frame.Time)
     {
         return;
     }
     Data.Add(frame);
 }
    private int CheckInput(KeyCode a, KeyCode b, bool currentState)
    {
        /*if (Input.GetKeyDown(a) || Input.GetKeyDown(b))
         * {
         *  if (currentState == false) {
         *      MovementFrame movementFrame = new MovementFrame();
         *      movementFrame.inputKey = a;
         *      movementFrame.down = true;
         *
         *      tempFrames.Add(movementFrame);
         *      return 1;
         *  }
         * }*/

        if (Input.GetKey(a))
        {
            if (currentState == false)
            {
                MovementFrame movementFrame = new MovementFrame();
                movementFrame.inputKey = a;
                movementFrame.down     = true;

                tempFrames.Add(movementFrame);
                return(1);
            }
        }
        else
        {
            if (currentState == true)
            {
                MovementFrame movementFrame = new MovementFrame();
                movementFrame.inputKey = a;
                movementFrame.down     = false;
                tempFrames.Add(movementFrame);
                return(-1);
            }
        }

        if (Input.GetKeyUp(a) || Input.GetKeyUp(b))
        {
            MovementFrame movementFrame = new MovementFrame();
            movementFrame.inputKey = a;
            movementFrame.down     = false;

            tempFrames.Add(movementFrame);
            return(-1);
        }



        return(0);
    }
        public void SendRestManeuverToSector(uint index, SpaceEntityType spaceEntityType, uint objectId, Vector3 position, Vector3 euler3, MovementFrame movementFrame)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.SyncMove);
            buffer.Write(objectId);
            buffer.Write(Server.GetSectorById(index).Tick); // tick

            movementFrame.Write(buffer);

            buffer.Write((byte)2);
            buffer.Write(Server.GetSectorById(index).Tick); //startTick

            //position
            buffer.Write(position);

            //euler3
            buffer.Write(euler3);

            SendMessageToSector(index, buffer);
        }