示例#1
0
 public AnimationSettings(DoublePoint startPoint, DoublePoint endPoint,
                          AnimationTiming timing, int speed, string scriptName = null)
 {
     StartPoint = startPoint;
     EndPoint   = endPoint;
     Timing     = timing;
     Speed      = speed;
     ScriptName = scriptName;
 }
示例#2
0
        public void UpdateAction()
        {
            if (this.Emitter != null)
            {
                if (this.Emitter.Cue != null && this.Emitter.Cue.IsLooped)
                {
                    this.Emitter.Cue.Stop(true);
                }
                this.Emitter = (SoundEmitter)null;
            }
            AnimatedTexture animation = this.Npc.Actions[this.CurrentAction].Animation;
            SoundEffect     sound     = this.Npc.Actions[this.CurrentAction].Sound;

            if (this.CurrentAction == NpcAction.Talk && this.CurrentLine != null && this.CurrentLine.OverrideContent != null)
            {
                if (this.CurrentLine.OverrideContent.Animation != null)
                {
                    animation = this.CurrentLine.OverrideContent.Animation;
                }
                if (this.CurrentLine.OverrideContent.Sound != null)
                {
                    sound = this.CurrentLine.OverrideContent.Sound;
                }
            }
            this.CurrentTiming    = animation.Timing.Clone();
            this.CurrentAnimation = animation;
            this.Group.Texture    = (Texture)animation.Texture;
            this.UpdateScale();
            if (sound == null || this.Npc.ActorType == ActorType.Owl && this.OwlInvisible || !this.initialized)
            {
                return;
            }
            if (this.CurrentAction == NpcAction.Talk)
            {
                if (this.talkEmitter == null || this.talkEmitter.Dead)
                {
                    this.talkEmitter = SoundEffectExtensions.EmitAt(sound, this.Position, true, RandomHelper.Centered(0.05));
                }
                else
                {
                    this.talkEmitter.Position = this.Position;
                    Waiters.Wait(0.100000001490116, (Action)(() =>
                    {
                        this.talkEmitter.Cue.Resume();
                        this.talkEmitter.VolumeFactor = 1f;
                    })).AutoPause = true;
                }
            }
            else
            {
                this.Emitter = SoundEffectExtensions.EmitAt(sound, this.Position, true, RandomHelper.Centered(0.05));
            }
        }
示例#3
0
 public void Dispose()
 {
     if (Texture != null)
     {
         //TextureExtensions.Unhook(Texture);
         #if UNITY
         GameObject.Destroy(Texture);
         #else
         Texture.Dispose();
         #endif
     }
     Texture = null;
     Timing  = null;
 }