示例#1
0
        private void OnGUI()
        {
            try {
                _persistenceService = ServiceLocator.Get <PersistenceService>();
                _songService        = ServiceLocator.Get <SongService>();
                _beatInputService   = ServiceLocator.Get <BeatInputService>();
            } catch (Exception) {
                GUILayout.Label("Enter play mode to enable this window.");
                return;
            }


            _persistenceToolsEnabled = EditorGUILayout.Foldout(_persistenceToolsEnabled, "Persistence", true);
            if (_persistenceToolsEnabled)
            {
                DrawPersistence();
            }

            _beatInputToolsEnabled = EditorGUILayout.Foldout(_beatInputToolsEnabled, "Beat", true);
            if (_beatInputToolsEnabled)
            {
                DrawBeatInput();
            }
            _levelToolsEnabled = EditorGUILayout.Foldout(_levelToolsEnabled, "Level", true);
            if (_levelToolsEnabled)
            {
                DrawLevel();
            }
        }
示例#2
0
        // Use this for initialization
        private void Start()
        {
            _audioService     = ServiceLocator.Get <AudioService>();
            _beatInputService = ServiceLocator.Get <BeatInputService>();
            _gameStateService = ServiceLocator.Get <GameStateService>();
            _beatHitImages    = new BeatImageDictionary {
                { NoteQuality.Good, hitGood },
                { NoteQuality.Miss, hitMiss },
                { NoteQuality.Perfect, hitNice }
            };
            Action <object> overlayFade = CreateFadeDelegate(beatBlendOverlayImage);

            _overlayFadeHashtable["onupdate"] = overlayFade;
            overlayFade(0f);
            _beatInputService.NoteHit           += NoteHit;
            _beatInputService.BeatLost          += BeatLost;
            _beatInputService.ExecutionStarting += ExecutionStarting;
            _beatInputService.ExecutionStarted  += ExecutionStarted;
            _beatInputService.ExecutionAborted  += ExecutionAborted;
            _beatInputService.ExecutionFinished += ExecutionFinished;
            _gameStateService.GameFinishing     += OnGameFinishing;
            _gameStateService.GameStarted       += OnGameStarted;
            updateClickLocation = () => {
                if (Input.touches.Length > 0)
                {
                    _latestTouchPosition = Input.touches[0].position;
                }
                if (Input.GetMouseButtonDown(0))
                {
                    _latestTouchPosition = Input.mousePosition;
                }
            };
            _initialIndicatorPos = songIndicator.transform.position;
        }
示例#3
0
        private void Start()
        {
            _beatInputService              = ServiceLocator.Get <BeatInputService>();
            _gameStateService              = ServiceLocator.Get <GameStateService>();
            _canvasGroup                   = GetComponent <CanvasGroup>();
            _canvasGroup.alpha             = 0;
            _gameStateService.GameStarted += OnGameStarted;
            RectTransform rectTransform = GetComponent <RectTransform>();

            _indicatorWidth        = rectTransform.rect.width;
            _halfIndicatorWidth    = _indicatorWidth * .5f;
            _quarterIndicatorWidth = _indicatorWidth * .25f;
            _indicatorLines        = new List <RectTransform>();
            _lineCanvasGroups      = new List <CanvasGroup>();
            float[] beats = songData.beats;
            foreach (float beat in beats)
            {
                float         xPos          = beat * _quarterIndicatorWidth;
                RectTransform indicatorLine = Instantiate(indicatorLinePrefab, transform);
                indicatorLine.anchoredPosition = new Vector2(xPos, indicatorLine.anchoredPosition.y);
                _indicatorLines.Add(indicatorLine);
                _lineCanvasGroups.Add(indicatorLine.GetComponent <CanvasGroup>());
            }
            metronomeDiffIndicator.transform.SetSiblingIndex(metronomeDiffIndicator.transform.childCount - 1);
            CalcIndicatorPosition(_beatInputService.MetronomeDiff / BeatInputService.NOTE_TIME);
            Color color = metronomeDiffIndicator.color;

            _indicatorColorGreen.a = color.a;
            _indicatorColorWhite.a = color.a;
        }
示例#4
0
        private void DrawBeatInput()
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField("Has beat", _beatInputService.HasBeat ? "yes" : "no");
            EditorGUILayout.Slider("Metronome Diff", -_beatInputService.MetronomeDiff / BeatInputService.HALF_NOTE_TIME, -1, 1);
            EditorGUILayout.LabelField("Quality", BeatInputService.CalcNoteQuality(_beatInputService.MetronomeDiff).ToString());
            EditorGUILayout.LabelField("Current Notes", string.Join(", ", _beatInputService.CurrentNotes));
            List <Song> matchingSongs = _songService.CheckSongs(_beatInputService.CurrentNotes.ToArray());

            EditorGUILayout.LabelField("Matching songs", string.Join(", ", matchingSongs.Select(song => song.Name)));
            EditorGUI.indentLevel--;
        }
示例#5
0
 private void Start()
 {
     clips = new QualityClipDictionary {
         { NoteQuality.Bad, badClip },
         { NoteQuality.Good, goodClip },
         { NoteQuality.Miss, missClip },
         { NoteQuality.Perfect, perfectClip }
     };
     _beatInputService           = ServiceLocator.Get <BeatInputService>();
     _beatInputService.NoteHit  += NoteHit;
     _beatInputService.BeatLost += BeatLost;
 }
示例#6
0
 private void Awake()
 {
     _updateFunc       = Constants.Noop;
     _depositsInSight  = new List <ItemDeposit>();
     _enemiesInSight   = new List <Unit>();
     _unitService      = ServiceLocator.Get <UnitService>();
     _beatInputService = ServiceLocator.Get <BeatInputService>();
     _gameStateService = ServiceLocator.Get <GameStateService>();
     _navMeshAgent     = GetComponent <NavMeshAgent>();
     if (_navMeshAgent)
     {
         _navMeshAgent.updateUpAxis   = false;
         _navMeshAgent.updateRotation = false;
     }
     _representation = transform.Find("Representation").gameObject;
 }
示例#7
0
 private void Start()
 {
     _beatInputService = ServiceLocator.Get <BeatInputService>();
     _gameStateService = ServiceLocator.Get <GameStateService>();
 }