Exemple #1
0
        public OneTimeEvent(ModAnimationStateMachine animation, State state, OnAnimationEvent onAnimationEvent)
        {
            this.animation        = animation;
            this.state            = state;
            this.onAnimationEvent = onAnimationEvent;

            this.animation.stateChanged += OnStateChanged;
        }
Exemple #2
0
            public static bool Prefix(OnAnimationEvent onAnimationComplete)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                animation.TransitionToAndFire(FromAiming, onAnimationComplete);
                return(false);
            }
Exemple #3
0
            public static bool Prefix(int bulletsToReload, OnAnimationEvent roundLoadedEventCallback, OnAnimationEvent clipLoadedEventCallback, OnAnimationEvent reloadCompleteEventCallback)
            {
                PlayerManager            playerManager = GameManager.GetPlayerManagerComponent();
                ModAnimationStateMachine animation     = ModComponentUtils.ComponentUtils.GetComponent <ModAnimationStateMachine>(playerManager.m_ItemInHands);

                if (animation is null)
                {
                    return(true);
                }

                ReloadProcess process = new ReloadProcess();

                process.remainingBullets            = bulletsToReload;
                process.reloadCompleteEventCallback = reloadCompleteEventCallback;
                process.roundLoadedEventCallback    = roundLoadedEventCallback;
                process.clipLoadedEventCallback     = clipLoadedEventCallback;
                process.animation = animation;
                process.Start();

                return(false);
            }
Exemple #4
0
 public void TransitionToAndFire(State targetState, OnAnimationEvent onAnimationEvent)
 {
     TransitionTo(targetState);
     RegisterOneTimeEvent(targetState, onAnimationEvent);
 }
Exemple #5
0
 public void RegisterOneTimeEvent(State state, OnAnimationEvent onAnimationEvent)
 {
     new OneTimeEvent(this, state, onAnimationEvent);
 }
 public void CallAnimationEvent(EventType eventType)
 {
     OnAnimationEvent?.Invoke(eventType);
 }
Exemple #7
0
 public virtual void SetAnimationShakeEvent(OnAnimationEvent pFunc)
 {
 }
Exemple #8
0
 //设置角色动画打击点通知
 public virtual void SetAnimationHitEvent(OnAnimationEvent pFunc)
 {
 }
Exemple #9
0
 //设置角色动画可以结束通知
 public virtual void SetAnimationCanBreakEvent(OnAnimationEvent pFunc)
 {
 }
Exemple #10
0
 public void TriggerAnimationEvent(string eventTag)
 {
     OnAnimationEvent?.Invoke(eventTag);
 }
Exemple #11
0
            private readonly AnimationCB m_animation_cb;                    // A local reference to prevent the callback being garbage collected

            public Window(View3d view, HWND hwnd, bool?gdi_compatible_backbuffer = null, int?multi_sampling = null, string?dbg_name = null)
            {
                View   = view;
                Hwnd   = hwnd;
                Diag   = new Diagnostics(this);
                m_opts = new WindowOptions
                {
                    ErrorCB    = HandleError,
                    ErrorCBCtx = IntPtr.Zero,
                    GdiCompatibleBackBuffer = gdi_compatible_backbuffer ?? false,
                    Multisampling           = multi_sampling ?? 4,
                    DbgName = dbg_name ?? string.Empty,
                };

                // Create the window
                Handle = View3D_WindowCreate(hwnd, ref m_opts);
                if (Handle == null)
                {
                    throw new Exception("Failed to create View3D window");
                }
                void HandleError(IntPtr ctx, string msg, string filepath, int line, long pos) => Error?.Invoke(this, new ErrorEventArgs(msg, filepath, line, pos));

                // Set up a callback for when settings are changed
                View3D_WindowSettingsChangedCB(Handle, m_settings_cb = HandleSettingsChanged, IntPtr.Zero, true);
                void HandleSettingsChanged(IntPtr ctx, HWindow wnd, ESettings setting) => OnSettingsChanged?.Invoke(this, new SettingChangeEventArgs(setting));

                // Set up a callback for when the window is invalidated
                View3D_WindowInvalidatedCB(Handle, m_invalidated_cb = HandleInvalidated, IntPtr.Zero, true);
                void HandleInvalidated(IntPtr ctx, HWindow wnd) => OnInvalidated?.Invoke(this, EventArgs.Empty);

                // Set up a callback for when a render is about to happen
                View3D_WindowRenderingCB(Handle, m_render_cb = HandleRendering, IntPtr.Zero, true);
                void HandleRendering(IntPtr ctx, HWindow wnd) => OnRendering?.Invoke(this, EventArgs.Empty);

                // Set up a callback for when the object store for this window changes
                View3d_WindowSceneChangedCB(Handle, m_scene_changed_cb = HandleSceneChanged, IntPtr.Zero, true);
                void HandleSceneChanged(IntPtr ctx, HWindow wnd, ref View3DSceneChanged args) => OnSceneChanged?.Invoke(this, new SceneChangedEventArgs(args));

                // Set up a callback for animation events
                View3D_WindowAnimEventCBSet(Handle, m_animation_cb = HandleAnimationEvent, IntPtr.Zero, true);
                void HandleAnimationEvent(IntPtr ctx, HWindow wnd, EAnimCommand command, double clock) => OnAnimationEvent?.Invoke(this, new AnimationEventArgs(command, clock));

                // Set up the light source
                SetLightSource(v4.Origin, -v4.ZAxis, true);

                // Display the focus point
                FocusPointVisible = true;

                // Position the camera
                Camera = new Camera(this);
                Camera.Lookat(new v4(0f, 0f, -2f, 1f), v4.Origin, v4.YAxis);
            }