Beispiel #1
0
        public unsafe override void LoadToObject(FakeStruct fake, Component game)
        {
            BuoyancyData *data = (BuoyancyData *)fake.ip;
            var           obj  = game.GetComponent <BuoyancyEffector2D>();

            if (obj == null)
            {
                return;
            }
            obj.useColliderMask = data->useColliderMask;
            obj.colliderMask    = data->colliderMask;
            obj.surfaceLevel    = data->surfaceLevel;
            obj.density         = data->density;
            obj.linearDrag      = data->linearDrag;
            obj.angularDrag     = data->angularDrag;
            obj.flowAngle       = data->flowAngle;
            obj.flowMagnitude   = data->flowMagnitude;
            obj.flowVariation   = data->flowVariation;
        }
        public static unsafe FakeStruct LoadFromObject(Component com, DataBuffer buffer)
        {
            var obj = com as BuoyancyEffector2D;

            if (obj == null)
            {
                return(null);
            }
            FakeStruct    fake = new FakeStruct(buffer, BuoyancyData.ElementSize);
            BuoyancyData *bd   = (BuoyancyData *)fake.ip;

            bd->useColliderMask = obj.useColliderMask;
            bd->colliderMask    = obj.colliderMask;
            bd->surfaceLevel    = obj.surfaceLevel;
            bd->density         = obj.density;
            bd->linearDrag      = obj.linearDrag;
            bd->angularDrag     = obj.angularDrag;
            bd->flowAngle       = obj.flowAngle;
            bd->flowMagnitude   = obj.flowMagnitude;
            bd->flowVariation   = obj.flowVariation;
            return(fake);
        }