/// <summary>
        /// see https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffectTypes.cpp#L311
        /// see https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffectTypes.cpp#L177
        /// </summary>
        /// <param name="reader"></param>
        public void Serialize(NetBitReader reader)
        {
            var validData = reader.ReadBit();

            if (validData)
            {
                var RepBits = reader.ReadBitsToInt(7);

                if ((RepBits & (1 << 0)) > 0)
                {
                    Instigator = reader.ReadIntPacked();
                }
                if ((RepBits & (1 << 1)) > 0)
                {
                    EffectCauser = reader.ReadIntPacked();
                }
                if ((RepBits & (1 << 2)) > 0)
                {
                    AbilityCDO = reader.ReadIntPacked();
                }
                if ((RepBits & (1 << 3)) > 0)
                {
                    SourceObject = reader.ReadIntPacked();
                }
                if ((RepBits & (1 << 4)) > 0)
                {
                    // SafeNetSerializeTArray_HeaderOnly
                    var bitCount = (int)Math.Ceiling(Math.Log2(31));
                    var arrayNum = reader.ReadBitsToInt(bitCount);

                    // SafeNetSerializeTArray_Default
                    Actors = new ActorGuid[arrayNum];
                    for (var i = 0; i < arrayNum; i++)
                    {
                        Actors[i] = new ActorGuid()
                        {
                            Value = reader.ReadIntPacked()
                        };
                    }
                }
                if ((RepBits & (1 << 5)) > 0)
                {
                    HitResult = new FHitResult(reader);
                }
                if ((RepBits & (1 << 6)) > 0)
                {
                    WorldOrigin     = reader.SerializePropertyVector100();
                    bHasWorldOrigin = true;
                }
                else
                {
                    bHasWorldOrigin = false;
                }
            }
        }
Beispiel #2
0
 public bool IsEmpty()
 {
     return(ActorGuid.IsEmpty()); // this one is good enough
 }