Exemplo n.º 1
0
        public override IEnumerable <Status> Run()
        {
            if ((Creature.Physics.GlobalTransform.Translation - Location).LengthSquared() < 0.5f)
            {
                yield return(Act.Status.Success);

                yield break;
            }
            switch (Type)
            {
            case TeleportType.Jump:
            {
                TossMotion motion = new TossMotion(0.6f, 0.9f, Creature.Physics.GlobalTransform, Location);
                Creature.Physics.AnimationQueue.Add(motion);
                SoundManager.PlaySound(ContentPaths.Audio.jump, Creature.Physics.GlobalTransform.Translation);

                while (!motion.IsDone())
                {
                    Creature.CurrentCharacterMode = CharacterMode.Falling;
                    yield return(Status.Running);
                }
                break;
            }

            case TeleportType.Lerp:
            {
                EaseMotion motion = new EaseMotion(0.6f, Creature.Physics.GlobalTransform, Location);
                while (!motion.IsDone())
                {
                    Creature.Physics.PropogateTransforms();
                    motion.Update(DwarfTime.LastTime);
                    Creature.AI.Position = motion.GetTransform().Translation;
                    yield return(Status.Running);
                }
                Creature.Physics.IsSleeping = false;
                break;
            }

            case TeleportType.Snap:
                Creature.AI.Position = Location;
                break;
            }

            yield return(Status.Success);
        }
Exemplo n.º 2
0
        public override IEnumerable <Status> Run()
        {
            switch (Type)
            {
            case TeleportType.Jump:
            {
                TossMotion motion = new TossMotion(0.6f, 0.9f, Creature.Physics.GlobalTransform, Location);
                Creature.AI.Jump(DwarfTime.LastTime);

                while (!motion.IsDone())
                {
                    Creature.Physics.IsSleeping = true;
                    motion.Update(DwarfTime.LastTime);
                    Creature.AI.Position          = motion.GetTransform().Translation;
                    Creature.CurrentCharacterMode = Creature.CharacterMode.Falling;
                    yield return(Status.Running);
                }
                break;
            }

            case TeleportType.Lerp:
            {
                EaseMotion motion = new EaseMotion(0.6f, Creature.Physics.GlobalTransform, Location);
                while (!motion.IsDone())
                {
                    motion.Update(DwarfTime.LastTime);
                    Creature.AI.Position = motion.GetTransform().Translation;
                    yield return(Status.Running);
                }
                break;
            }

            case TeleportType.Snap:
                Creature.AI.Position = Location;
                break;
            }

            yield return(Status.Success);
        }
Exemplo n.º 3
0
        public override IEnumerable<Status> Run()
        {
            switch (Type)
            {
                case TeleportType.Jump:
                {
                    TossMotion motion = new TossMotion(0.6f, 0.9f, Creature.Physics.GlobalTransform, Location);
                    Creature.AI.Jump(DwarfTime.LastTime);

                    while (!motion.IsDone())
                    {
                        Creature.Physics.IsSleeping = true;
                        motion.Update(DwarfTime.LastTime);
                        Creature.AI.Position = motion.GetTransform().Translation;
                        Creature.CurrentCharacterMode = Creature.CharacterMode.Falling;
                        yield return Status.Running;
                    }
                    break;
                }
                case TeleportType.Lerp:
                {
                    EaseMotion motion = new EaseMotion(0.6f, Creature.Physics.GlobalTransform, Location);
                    while (!motion.IsDone())
                    {
                        motion.Update(DwarfTime.LastTime);
                        Creature.AI.Position = motion.GetTransform().Translation;
                        yield return Status.Running;
                    }
                    break;
                }
                case TeleportType.Snap:
                    Creature.AI.Position = Location;
                    break;
            }

            yield return Status.Success;
        }