Exemplo n.º 1
0
 /**
  *  @brief Rotates game object based on provided axis angles of rotation and a relative space.
  *
  *  If relative space is SELF then the game object will rotate based on its forward vector.
  **/
 public void Rotate(FP xAngle, FP yAngle, FP zAngle, Space relativeTo)
 {
     Rotate(new TSVector(xAngle, yAngle, zAngle), relativeTo);
 }
Exemplo n.º 2
0
 /**
  *  @brief Rotates game object based on provided axis and angle of rotation.
  **/
 public void Rotate(TSVector axis, FP angle)
 {
     Rotate(axis, angle, Space.Self);
 }
Exemplo n.º 3
0
 /**
  *  @brief Rotates game object based on provided axis and angle of rotation.
  **/
 public void RotateAround(TSVector axis, FP angle)
 {
     Rotate(axis, angle);
 }
Exemplo n.º 4
0
 /**
  *  @brief Rotates game object based on provided axis angles of rotation.
  **/
 public void Rotate(FP xAngle, FP yAngle, FP zAngle)
 {
     Rotate(new TSVector(xAngle, yAngle, zAngle), Space.Self);
 }
Exemplo n.º 5
0
 /**
  *  @brief Moves game object based on provided axis values and a relative space.
  *
  *  If relative space is SELF then the game object will move based on its forward vector.
  **/
 public void Translate(FP x, FP y, FP z, Space relativeTo)
 {
     Translate(new TSVector(x, y, z), relativeTo);
 }
Exemplo n.º 6
0
 /**
  *  @brief Moves game object based on provided axis values and a relative {@link TSTransform}.
  *
  *  The game object will move based on TSTransform's forward vector.
  **/
 public void Translate(FP x, FP y, FP z, TSTransform relativeTo)
 {
     Translate(new TSVector(x, y, z), relativeTo);
 }
Exemplo n.º 7
0
 /**
  * @brief Adds a new FP value.
  **/
 internal void AddFP(byte key, FP value)
 {
     this.fpTable[key] = value;
 }
Exemplo n.º 8
0
 /**
  *  @brief Moves game object based on provided axis values.
  **/
 public void Translate(FP x, FP y, FP z)
 {
     Translate(x, y, z, Space.Self);
 }
Exemplo n.º 9
0
        public override void Deserialize(byte[] data, ref int offset)
        {
            byte numberOfActions = data[offset++];

            for (int i = 0; i < numberOfActions; i++)
            {
                byte key  = data[offset++];
                byte type = data[offset++];

                switch (type)
                {
                case (byte)Types.Integer:
                    int intValue = BitConverter.ToInt32(data, offset);
                    AddInt(key, intValue);
                    offset += sizeof(int);
                    break;

                case (byte)Types.Byte:
                    byte byteValue = data[offset++];
                    AddByte(key, byteValue);
                    break;

                case (byte)Types.ByteArray:
                    int byteArrayLen = BitConverter.ToInt32(data, offset);
                    offset += sizeof(int);

                    byte[] bArray = new byte[byteArrayLen];
                    for (int indexArray = 0; indexArray < byteArrayLen; indexArray++)
                    {
                        bArray[indexArray] = data[offset + indexArray];
                    }

                    offset += byteArrayLen;

                    AddByteArray(key, bArray);
                    break;

                case (byte)Types.String:
                    int strlen = BitConverter.ToInt32(data, offset);
                    offset += sizeof(int);
                    string stringValue = System.Text.Encoding.ASCII.GetString(data, offset, strlen);
                    offset += strlen;
                    AddString(key, stringValue);
                    break;

                case (byte)Types.FP:
                    FP fpValue = FP.FromRaw(BitConverter.ToInt64(data, offset));
                    AddFP(key, fpValue);
                    offset += sizeof(long);
                    break;

                case (byte)Types.TSVector:
                    FP fpValueX = FP.FromRaw(BitConverter.ToInt64(data, offset));
                    offset += sizeof(long);

                    FP fpValueY = FP.FromRaw(BitConverter.ToInt64(data, offset));
                    offset += sizeof(long);

                    FP fpValueZ = FP.FromRaw(BitConverter.ToInt64(data, offset));
                    offset += sizeof(long);

                    AddTSVector(key, new TSVector(fpValueX, fpValueY, fpValueZ));
                    break;

                case (byte)Types.TSVector2:
                    FP fpValueX2 = FP.FromRaw(BitConverter.ToInt64(data, offset));
                    offset += sizeof(long);

                    FP fpValueY2 = FP.FromRaw(BitConverter.ToInt64(data, offset));
                    offset += sizeof(long);

                    AddTSVector2(key, new TSVector2(fpValueX2, fpValueY2));
                    break;

                default:
                    //Not Implemented
                    break;
                }
            }
        }
Exemplo n.º 10
0
 public FP readFP()
 {
     return(FP.FromRaw(readInt64()));
 }
Exemplo n.º 11
0
 public void writeFP(FP v)
 {
     writeInt64(v.RawValue);
 }
Exemplo n.º 12
0
 public FrameTest(CMD cmd, FP arg1, FP arg2)
 {
     e.cmd_type = (Byte)cmd;
     fp_1       = arg1;
     fp_2       = arg2;
 }
Exemplo n.º 13
0
        void OnStepUpdate(List <InputDataBase> allInputData)
        {
            time += lockedTimeStep;

//             if (ReplayRecord.replayMode != ReplayMode.LOAD_REPLAY)
//             {
//                 CheckGameObjectsSafeMap();
//             }

            SyncInput.SetAllInputs(null);

            for (int index = 0; index < generalBehaviours.Count; index++)
            {
                SyncManagedBehaviour bh = generalBehaviours[index];

                if (bh != null && !bh.disabled)
                {
                    bh.OnPreSyncedUpdate();
                    //instance.scheduler.UpdateAllCoroutines();
                }
            }

            for (int index = 0; index < allInputData.Count; index++)
            {
                InputDataBase playerInputData = allInputData[index];

                if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
                {
                    List <SyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
                    for (int index2 = 0, length2 = managedBehavioursByPlayer.Count; index2 < length2; index2++)
                    {
                        SyncManagedBehaviour bh = managedBehavioursByPlayer[index2];

                        if (bh != null && !bh.disabled)
                        {
                            bh.OnPreSyncedUpdate();
                            //instance.scheduler.UpdateAllCoroutines();
                        }
                    }
                }
            }

            SyncInput.SetAllInputs(allInputData);

            SyncInput.CurrentSimulationData = null;
            for (int index = 0; index < generalBehaviours.Count; index++)
            {
                SyncManagedBehaviour bh = generalBehaviours[index];

                if (bh != null && !bh.disabled)
                {
                    bh.OnSyncedUpdate();
                    //instance.scheduler.UpdateAllCoroutines();
                }
            }

            for (int index = 0, length = allInputData.Count; index < length; index++)
            {
                InputDataBase playerInputData = allInputData[index];

                if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
                {
                    SyncInput.CurrentSimulationData = (InputData)playerInputData;

                    List <SyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
                    for (int index2 = 0, length2 = managedBehavioursByPlayer.Count; index2 < length2; index2++)
                    {
                        SyncManagedBehaviour bh = managedBehavioursByPlayer[index2];

                        if (bh != null && !bh.disabled)
                        {
                            bh.OnSyncedUpdate();
                            //instance.scheduler.UpdateAllCoroutines();
                        }
                    }
                }

                SyncInput.CurrentSimulationData = null;
            }

            CheckQueuedBehaviours();
        }