示例#1
0
 // Use this for initialization
 void Start()
 {
     PatrolManager.instance.OnPatrolCountChanged += UpdateUI;
     _levelEditor.OnInfoChanged += UpdateInfo;
     _addSentinel.onClick.AddListener(delegate {
         _levelEditor.AddSentinel();
     });
     _addCamera.onClick.AddListener(delegate {
         _levelEditor.AddCamera();
     });
     _erase.onClick.AddListener(delegate {
         _levelEditor.Erase();
     });
     _start.onClick.AddListener(delegate {
         _isEditMode = false;
         _addSentinel.gameObject.active  = false;
         _addCamera.gameObject.active    = false;
         _start.gameObject.active        = false;
         _cameraText.gameObject.active   = false;
         _sentinelText.gameObject.active = false;
         _info.gameObject.active         = false;
         _erase.gameObject.active        = false;
         _openEditor.gameObject.active   = true;
         // _pauseButton.gameObject.active = true;
         _pauseToggle.gameObject.active = true;
         // _timeSlider.gameObject.active = true;
         _timeScaleToggle.gameObject.active = true;
         _timeLabel.gameObject.active       = true;
         if (GameController.instance != null)
         {
             GameController.instance.StartTimer();
         }
         StartCoroutine(ChangeCameraPos());
     });
     _openEditor.onClick.AddListener(delegate {
         _isEditMode = true;
         _addSentinel.gameObject.active  = true;
         _addCamera.gameObject.active    = true;
         _start.gameObject.active        = true;
         _cameraText.gameObject.active   = true;
         _sentinelText.gameObject.active = true;
         _info.gameObject.active         = true;
         _erase.gameObject.active        = true;
         _openEditor.gameObject.active   = false;
         // _pauseButton.gameObject.active = false;
         _pauseToggle.gameObject.active = false;
         // _timeSlider.gameObject.active = false;
         _timeScaleToggle.gameObject.active = false;
         _timeLabel.gameObject.active       = false;
         // _timeSlider.value = 1f;
         _timeScaleToggle.isOn = false;
         StartCoroutine(ChangeCameraPos());
     });
     _pauseToggle.onValueChanged.AddListener((isOn) => {
         GameManager.instance.SetPaused(isOn);
     });
     // _pauseButton.onClick.AddListener (delegate {
     //  _isPaused = !_isPaused;
     //  GameManager.instance.SetPaused (_isPaused);
     //  if (_isPaused)
     //      _pauseButtonText.text = "Play";
     //  else
     //      _pauseButtonText.text = "Pause";
     // });
     // _timeSlider.minValue = 0.25f;
     // _timeSlider.maxValue = 4;
     // _timeSlider.value = 1;
     _timeScaleToggle.isOn = false;
     // _timeSlider.onValueChanged.AddListener (delegate (float value) { GameManager.instance.ChangeTimeScale (value); });
     _timeScaleToggle.onValueChanged.AddListener(delegate(bool value) { var timeScale = value ? 4f : 1f; GameManager.instance.ChangeTimeScale(timeScale); });
 }