Пример #1
0
        public void Step()
        {
            //this is under a timer an needs

            AgentAnimation animation = this.currentAnimation;
            var            frame     = this.currentFrame;

            if (animation == null)
            {
                return;
            }

            var newFrameIndex = Math.Min(this.GetNextAnimationFrame(), animation.Frames.Count - 1);
            var frameChanged  = frame != null && this.currentFrameIndex != newFrameIndex;

            this.currentFrameIndex = newFrameIndex;

            // always switch frame data, unless we're at the last frame of an animation with a useExitBranching flag.
            if (!(this.IsAtLastFrame() && animation.UseExitBranching))
            {
                currentFrame = frame = animation.Frames[this.currentFrameIndex];
            }

            if (frame.Duration > 0)
            {
                NeedsRefresh?.Invoke(this, EventArgs.Empty);
                agent.PlaySound(currentFrame?.Sound);

                aTimer.Interval = frame.Duration;
                aTimer.Start();
            }

            if (frameChanged && this.IsAtLastFrame())
            {
                _started = false;
                if (animation.UseExitBranching && !this._exiting)
                {
                    AnimationEnded?.Invoke(this, new AnimationStateEventArgs(currentAnimationName, AnimationStates.Waiting));
                }
                else
                {
                    AnimationEnded?.Invoke(this, new AnimationStateEventArgs(currentAnimationName, AnimationStates.Exited));
                }
            }
        }
Пример #2
0
        private void OnQuestControlActivated(bool isAccepted)
        {
            Console.Write("\b");
            QuestGiver questGiver = QuestGiver.Quests.Find(q => q.IsTouched);

            if (questGiver == null)
            {
                return;
            }

            if (isAccepted)
            {
                GameMessage.SendMessage("ACCEPTED !");
                this.CurrentQuest = questGiver.OwnQuest;
                QuestUpdated?.Invoke(this.CurrentQuest);
            }
            else
            {
                GameMessage.SendMessage("DECLINED !");
            }
            NeedsRefresh?.Invoke();
        }
 private void PendingChangesControl_NeedsRefresh(object sender, EventArgs e)
 {
     NeedsRefresh?.Invoke(this, EventArgs.Empty);
 }
Пример #4
0
 void Refresh()
 {
     OnRefresh();
     NeedsRefresh?.Invoke(this, EventArgs.Empty);
 }
Пример #5
0
 private void RefreshWindow(object sender, RoutedEventArgs e)
 {
     NeedsRefresh?.Invoke(this, EventArgs.Empty);
 }