Beispiel #1
0
        private void Main(string[] args)
        {
            CallbackEvents Events = new CallbackEvents();

            Events.UpdateEventResultreceivedEvent += Events_UpdateEventResultreceivedEvent1;
            Callback(10);

            //Operation obj = new Operation();
            //obj.updateMethod(Callback);
            //Console.Read();
            Thread.Sleep(10000);
        }
Beispiel #2
0
    private void PlayStaticFramePriv(float staticFrame, int clipIdx, float duration, CallbackEvents callbacks)
    {
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if (renderer != null && renderer.clipNames != null)
        {
            if (clipIdx < renderer.clipNames.Length)
            {
                string clipName = renderer.clipNames[clipIdx];
                PlayStaticFramePriv(staticFrame, clipName, duration, callbacks);
            }
        }
    }
Beispiel #3
0
    private void PlayAnimationPriv(float frameRate, int clipIdx, float startFrame, float duration, int nTimes, bool reverse, CallbackEvents callbacks)
    {
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if (renderer != null && renderer.clipNames != null)
        {
            if (clipIdx < renderer.clipNames.Length)
            {
                string clipName = renderer.clipNames[clipIdx];
                PlayAnimationPriv(frameRate, clipName, startFrame, duration, nTimes, reverse, callbacks);
            }
        }
    }
Beispiel #4
0
    private void PlayStaticFramePriv(float staticFrame, string clipName, float duration, CallbackEvents callbacks)
    {
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if (renderer != null)
        {
            //  Load clip at index if not already loaded.
            renderer.LoadClipName(clipName);
        }

        if (duration < 0.0f)
        {
            AnimationClip clip = new AnimationClip(gameObject, 0.0f, clipName, staticFrame, 1.0f /*don't care*/, -1, false /*forward*/, callbacks);
            PlayPriv(clip);
        }
        else
        {
            AnimationClip clip = new AnimationClip(gameObject, 0.0f, clipName, staticFrame, duration, 1, false /*forward*/, callbacks);
            PlayPriv(clip);
        }
    }
Beispiel #5
0
    private void PlayAnimationPriv(float frameRate, string clipName, float startFrame, float duration, int nTimes, bool reverse, CallbackEvents callbacks)
    {
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if (renderer != null)
        {
            //  Load clip at index if not already loaded.
            renderer.LoadClipName(clipName);

            //  Negative duration, replace with clip full duration.
            if (duration < 0.0f)
            {
                float nFrames = renderer.GetClipFrameCount(clipName);
                duration = (frameRate > 0.0f) ? ((nFrames + 1.0f - startFrame) / frameRate) : 0.0f;
            }
        }

        if (duration > 0.0f)
        {
            AnimationClip clip = new AnimationClip(gameObject, frameRate, clipName, startFrame, duration, nTimes, reverse, callbacks);
            PlayPriv(clip);
        }
    }
Beispiel #6
0
 public void LoopDuration(float frameRate, int clipIdx, float startFrame, float duration, bool reverse = false, CallbackEvents callbacks = null)
 {
     PlayAnimationPriv(frameRate, clipIdx, startFrame, duration, -1, reverse, callbacks);
 }
Beispiel #7
0
 public void LoopFrames(float frameRate, int clipIdx, float startFrame, float nFrames, bool reverse = false, CallbackEvents callbacks = null)
 {
     PlayAnimationPriv(frameRate, clipIdx, startFrame, (frameRate > 0.0f) ? (nFrames / frameRate) : 0.0f, -1, reverse, callbacks);
 }
Beispiel #8
0
 public void LoopAnimation(float frameRate, int clipIdx, float startFrame = 1.0f, bool reverse = false, CallbackEvents callbacks = null)
 {
     PlayAnimationPriv(frameRate, clipIdx, startFrame, -1.0f /*full length*/, -1, reverse, callbacks);
 }
Beispiel #9
0
 public void PlayStaticFrame(float staticFrame, int clipIdx, float duration, CallbackEvents callbacks = null)
 {
     PlayStaticFramePriv(staticFrame, clipIdx, duration, callbacks);
 }
Beispiel #10
0
 public void PlayStaticFrame(float staticFrame, string clipName, float duration, CallbackEvents callbacks = null)
 {
     PlayStaticFramePriv(staticFrame, clipName, duration, callbacks);
 }
Beispiel #11
0
 public void PlayDuration(float frameRate, string clipName, float startFrame, float duration, int nTimes = 1, bool reverse = false, CallbackEvents callbacks = null)
 {
     PlayAnimationPriv(frameRate, clipName, startFrame, duration, nTimes, reverse, callbacks);
 }
Beispiel #12
0
 public void PlayFrames(float frameRate, string clipName, float startFrame, float nFrames, int nTimes = 1, bool reverse = false, CallbackEvents callbacks = null)
 {
     PlayAnimationPriv(frameRate, clipName, startFrame, (frameRate > 0.0f) ? (nFrames / frameRate) : 0.0f, nTimes, reverse, callbacks);
 }
Beispiel #13
0
 public void PlayAnimation(float frameRate, string clipName, float startFrame = 1.0f, int nTimes = 1, bool reverse = false, CallbackEvents callbacks = null)
 {
     PlayAnimationPriv(frameRate, clipName, startFrame, -1.0f /*full length*/, nTimes, reverse, callbacks);
 }
Beispiel #14
0
        public AnimationClip(GameObject gameObject, float frameRate, string clipName, float startFrame, float duration, int nTimes, bool reverse, CallbackEvents callbacks)
        {
            this.gameObject = gameObject;

            this.frameRate  = frameRate;
            this.clipName   = clipName;
            this.startFrame = startFrame;
            this.duration   = duration;
            this.nTimes     = nTimes;
            this.reverse    = reverse;

            if (callbacks != null)
            {
                float startDuration = (startFrame - 1.0f) / frameRate;

                this.callbacks = new List <DelayCallbackEvent>();
                foreach (CallbackEvent callbackEvent in callbacks)
                {
                    DurationCallbackEvent durationCallbackEvent = callbackEvent as DurationCallbackEvent;
                    if (durationCallbackEvent != null)
                    {
                        float delay = durationCallbackEvent.duration - startDuration;
                        if (delay <= duration)
                        {
                            this.callbacks.Add(new DelayCallbackEvent(delay, durationCallbackEvent.callback));
                        }
                    }
                    else
                    {
                        FrameCallbackEvent frameCallbackEvent = callbackEvent as FrameCallbackEvent;
                        if (frameCallbackEvent != null)
                        {
                            float delay = (frameCallbackEvent.frame < 0) ? duration : (frameCallbackEvent.frame - 1) / frameRate;
                            if (delay <= duration)
                            {
                                this.callbacks.Add(new DelayCallbackEvent(delay, frameCallbackEvent.callback));
                            }
                        }
                    }
                }
            }

            this.currentDuration = 0.0f;
        }