예제 #1
0
        public void Update(float dt)
        {
            elapsed += dt;
            if (isInterrupted || isFinished)
            {
                return;
            }

            if (movableAction.ShowMode() == MovableAction.Mode.Move)
            {
                if (movableAction.backward)
                {
                    bool isBackward = facingDirectionAtStart != userInput.RunDirection();
                    skill.SetMoveBackward(isBackward);
                }

                if (!isFinished && elapsed >= durationInSeconds)
                {
                    skill.SetMovable(false);
                }
            }

            if (movableAction.ShowMode() == MovableAction.Mode.Face)
            {
                if (userInput.IsInputRun())
                {
                    if (caster.FacingDirection() != userInput.RunDirection())
                    {
                        if (count < movableAction.count)
                        {
                            count++;
                            switch (userInput.RunDirection())
                            {
                            case Direction.Left:
                                caster.SetFacingDirectionToLeft();
                                break;

                            case Direction.Right:
                                caster.SetFacingDirectionToRight();
                                break;
                            }
                        }
                    }
                }
            }

            if (elapsed >= durationInSeconds)
            {
                isFinished = true;
            }
        }
예제 #2
0
 public Movable(MovableAction movableAction, Skill skill, Direction facingDirectionAtStart,
                UserInput userInput, Character caster)
 {
     this.movableAction          = movableAction;
     this.skill                  = skill;
     this.facingDirectionAtStart = facingDirectionAtStart;
     this.userInput              = userInput;
     this.caster                 = caster;
     durationInSeconds           = FrameAndSecondsConverter._30Fps.FloatFramesToSeconds(movableAction.duration);
     if (movableAction.ShowMode() == MovableAction.Mode.Move)
     {
         skill.SetMovable(true);
         if (movableAction.backward)
         {
             bool isBackward = facingDirectionAtStart != userInput.RunDirection();
             skill.SetMoveBackward(isBackward);
         }
     }
 }