コード例 #1
0
 public override void ProcessInput(PlayerMovementFSM pc, PlayerMovementFSM.Inputs input)
 {
     if (input == PlayerMovementFSM.Inputs.SpaceBar || input == PlayerMovementFSM.Inputs.RightMouseClick)
     {
         PauseMovement();
     }
 }
コード例 #2
0
    void Start()
    {
        stateMachine = new PlayerMovementFSM();
        stateMachine.playerTransform = transform;
        ic = gameObject.GetComponent <InventoryController>();

        GameManager.Instance.PlayerReady(this);
    }
コード例 #3
0
 public override void ProcessInput(PlayerMovementFSM pc, PlayerMovementFSM.Inputs input)
 {
     if (input == PlayerMovementFSM.Inputs.RightMouseClick)
     {
         pc.ClearPath();
     }
     if (pc.currentPath != null)
     {
         pc.TransitionToState(pc.moving);
     }
     if (input == PlayerMovementFSM.Inputs.LeftMouseClick)
     {
         pc.currentPath = GameManager.Instance.fieldScript.GetPath(TileField.IndexOfPosition(pc.playerTransform.position, EditorManager.Instance.gameSettings.tileWidth, EditorManager.Instance.gameSettings.tileHeight), TileField.IndexOfPosition(Camera.main.ScreenToWorldPoint(Input.mousePosition), EditorManager.Instance.gameSettings.tileWidth, EditorManager.Instance.gameSettings.tileHeight));
     }
 }
コード例 #4
0
 public override void SetPath(PlayerMovementFSM pc, Vector2 startIndex, Vector2 endIndex)
 {
     if (pc.currentPath.Destination.Index == endIndex)
     {
         pc.TransitionToState(pc.moving);
     }
     else
     {
         Path newPausedPath = GameManager.Instance.fieldScript.GetPath(startIndex.ToInt2(), endIndex.ToInt2());
         if (newPausedPath == null)
         {
             return;
         }
         pc.ChangePath(newPausedPath);
     }
 }
コード例 #5
0
    public override void ProcessInput(PlayerMovementFSM pc, PlayerMovementFSM.Inputs input)
    {
        Debug.Log("Paused");
        if (input == PlayerMovementFSM.Inputs.SpaceBar)
        {
            pc.TransitionToState(pc.moving);

            return;
        }
        if (input == PlayerMovementFSM.Inputs.RightMouseClick)
        {
            pc.TransitionToState(pc.idle);

            return;
        }
        if (input == PlayerMovementFSM.Inputs.LeftMouseClick)
        {
            return;
        }
    }
コード例 #6
0
 private void GoToNextTile(PlayerMovementFSM pc)
 {
     if (MoveToTile(currentPath.CurrentTile, pc.playerTransform))
     {
         if (currentPath.CurrentTile == currentPath.Destination)
         {
             pc.EndPath(currentPath);
             pc.TransitionToState(pc.idle);
         }
         else if (movementPaused)
         {
             pc.TransitionToState(pc.paused);
             pc.ChangePath(null);
         }
         else
         {
             currentPath.NextPosition();
             pc.ChangePath(null);
         }
     }
 }
コード例 #7
0
 public override void EnterState(PlayerMovementFSM pc)
 {
     pc.ClearPath();
 }
コード例 #8
0
 public abstract void ProcessInput(PlayerMovementFSM pc, PlayerMovementFSM.Inputs input);
コード例 #9
0
 public abstract void CancelMovement(PlayerMovementFSM pc);
コード例 #10
0
 public abstract void SetPath(PlayerMovementFSM pc, Vector2 startIndex, Vector2 endIndex);
コード例 #11
0
 public abstract void Tick(PlayerMovementFSM pc);
コード例 #12
0
 public override void EnterState(PlayerMovementFSM pc)
 {
 }
コード例 #13
0
 public override void SetPath(PlayerMovementFSM pc, Vector2 startIndex, Vector2 endIndex)
 {
 }
コード例 #14
0
 public override void Tick(PlayerMovementFSM pc)
 {
     GoToNextTile(pc);
 }
コード例 #15
0
 public override void Tick(PlayerMovementFSM pc)
 {
 }
コード例 #16
0
 public abstract void EnterState(PlayerMovementFSM pc);
コード例 #17
0
 public override void CancelMovement(PlayerMovementFSM pc)
 {
 }
コード例 #18
0
 public override void EnterState(PlayerMovementFSM pc)
 {
     currentPath = pc.currentPath;
     currentPath.NextPosition();
     movementPaused = false;
 }