Esempio n. 1
0
        private void OnAnimationEventInternal(IntPtr nativeEventPtr, IntPtr nativeCharacterPtr)
        {
            if (nativeEventPtr == IntPtr.Zero)
            {
                Log.Error("The component {0} on entity {1} received an invalid AnimationEvent which could not be handled!", GetType().Name, Entity.Name);
                return;
            }
            var            nativeEvent  = new AnimEventInstance(nativeEventPtr, false);
            AnimationEvent managedEvent = new AnimationEvent(nativeEvent);

            // If the character is null we can still send the event, but we do notify the user with a warning.
            Character managedCharacter = null;

            if (nativeCharacterPtr == IntPtr.Zero)
            {
                Log.Warning("The component {0} on entity {1} received an invalid Character for AnimationEvent {2}", GetType().Name, Entity.Name, managedEvent.EventName);
                return;
            }
            else
            {
                var nativeCharacter = new ICharacterInstance(nativeCharacterPtr, false);
                managedCharacter = new Character(nativeCharacter);
            }

            OnAnimationEvent(managedEvent, managedCharacter);
        }
Esempio n. 2
0
 internal Character(ICharacterInstance nativeCharacter)
 {
     if (nativeCharacter == null)
     {
         throw new ArgumentNullException(nameof(nativeCharacter));
     }
     NativeHandle = nativeCharacter;
 }
Esempio n. 3
0
 internal Character(ICharacterInstance nativeCharacter)
 {
     NativeHandle = nativeCharacter ?? throw new ArgumentNullException(nameof(nativeCharacter));
 }