Пример #1
0
 public void GameUndo()
 {
     if (!isUndo && !isRestart && IsPlaying)
     {
         if (PlayerData.undoCount > 0)
         {
             StartCoroutine("UndoDelay");
             if (playingRecords.Count == 0)
             {
                 Debug.Log("원지점입니다.");
                 GameSystemManager.ShowAlertMessage(new AlertMessage(2, LocalizationManager.GetText("Alert_WarningUndoStart"), null, null, null));
             }
             else
             {
                 PlayingRecord record = playingRecords.Pop();
                 controller.UndoMove(record);
                 PlayerData.UseUndoCount();
                 UpdateUI();
             }
         }
         else
         {
             GameSystemManager.ShowAlertMessage(new AlertMessage(2, LocalizationManager.GetText("Alert_WarningUndo"), null, null, null));
         }
     }
 }
Пример #2
0
    public void UndoMove(PlayingRecord record)
    {
        switch ((MapManager.Direction)record.direction)
        {
        case MapManager.Direction.Up:
            Target.transform.rotation = Quaternion.Euler(new Vector3(0, 180, 0));
            break;

        case MapManager.Direction.Down:
            Target.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
            break;

        case MapManager.Direction.Left:
            Target.transform.rotation = Quaternion.Euler(new Vector3(0, 90, 0));
            break;

        case MapManager.Direction.Right:
            Target.transform.rotation = Quaternion.Euler(new Vector3(0, 270, 0));
            break;
        }
        // 큐브이동
        if (record.searchPos != Vector3.zero)
        {
            if (MapManager.instance.IsGoalNode(record.searchPos, record.targetPos, (MapManager.Direction)record.direction))
            {
                MapManager.instance.GoalBlock(record.searchPos, record.targetPos);
                SoundManager.PlaySound(SoundManager.Sound.PlayerGoal, Target.position);
            }
            else
            {
                MapManager.instance.MoveBlock(record.searchPos, record.targetPos);
                SoundManager.PlaySound(SoundManager.Sound.PlayerPush, Target.position);
            }
            StartCoroutine(Moving(record.currentPos));
        }
        // 캐릭터만 이동
        else
        {
            SoundManager.PlaySound(SoundManager.Sound.PlayerMove, Target.position);
            StartCoroutine(Moving(record.currentPos));
        }
        GameManager.instance.RemoveMoveCount();
    }