GameController.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using DG.Tweening;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. //using VacuumShaders.CurvedWorld;
  7. public class GameController : MonoBehaviour
  8. {
  9. [Serializable]
  10. private class PathSequence
  11. {
  12. public Vector3 state;
  13. public float time;
  14. }
  15. [SerializeField]
  16. private float _maxHeightDiff;
  17. [SerializeField]
  18. private float _maxWidthDiff;
  19. [SerializeField]
  20. private float _rangeBetweenSwitch;
  21. [SerializeField]
  22. private LevelPart _levelPart;
  23. [SerializeField]
  24. private int _parts;
  25. private float _moved;
  26. [SerializeField]
  27. private List<PathSequence> _pathSequences;
  28. private int _index;
  29. public bool IsPlay;
  30. internal bool isPause;
  31. internal bool isPlay;
  32. public LevelPart last { get; private set; }
  33. internal void ReportMove(float magnitude)
  34. {
  35. _moved += magnitude;
  36. if (_moved > _rangeBetweenSwitch)
  37. {
  38. _moved = 0;
  39. // DOTween.To(() => _curvedWorld.upDownSize, x=> _curvedWorld.upDownSize = x, _pathSequences[_index].vertical, 3 );
  40. // DOTween.To(() => _curvedWorld.leftRightSize, x=> _curvedWorld.leftRightSize = x, _pathSequences[_index].horizontal, 3 );
  41. //DOTween.To(() => _curvedWorld.bendSize.x, x => _curvedWorld.SetBendSizeX(x), _pathSequences[_index].state.x, _pathSequences[_index].time);
  42. //DOTween.To(() => _curvedWorld.bendSize.y, y => _curvedWorld.SetBendSizeY(y), _pathSequences[_index].state.y, _pathSequences[_index].time);
  43. //DOTween.To(() => _curvedWorld.bendSize.z, z => _curvedWorld.SetBendSizeZ(z), _pathSequences[_index].state.z, _pathSequences[_index].time);
  44. _index++;
  45. if (_index >= _pathSequences.Count)
  46. {
  47. _index = 0;
  48. }
  49. }
  50. }
  51. [SerializeField]
  52. //private CurvedWorld_Controller _curvedWorld;
  53. public static GameController instance { get; private set; }
  54. private void Awake()
  55. {
  56. instance = this;
  57. //_levelPart.gameObject.SetActive(false);
  58. //for (int i = 0; i < _parts; i++)
  59. //{
  60. // var el = Instantiate(_levelPart);
  61. // if (i == _parts - 1)
  62. // {
  63. // last = el;
  64. // last.SetIndex(i, true);
  65. // }
  66. // else
  67. // {
  68. // el.SetIndex(i, false);
  69. // }
  70. //}
  71. }
  72. }