예제 #1
0
 private void Start()
 {
     MinimapInstance = miniMap;
     SetCurrentState(EditorState.INIT);
     // Set static objects from unity editor //
     BarPrefab       = barPrefab;
     NotePrefab      = notePrefab;
     controlsDiagram = GameObject.FindGameObjectWithTag("ControlsWindow").
                       GetComponent <ControlsDiagram>();
     controlsDiagram.UpdateMe(EditorState.INIT);
     BeatMap.currentDebugText = debugText;
     BeatMap.staticMats       = materials;
     isVrPlayer           = isVrPlayerOverride;
     spawnPositions       = new Vector3[4, 3];
     spawnPositions[0, 0] = spawnBlocks[1].position;
     spawnPositions[0, 1] = spawnBlocks[5].position;
     spawnPositions[0, 2] = spawnBlocks[9].position;
     spawnPositions[1, 0] = spawnBlocks[0].position;
     spawnPositions[1, 1] = spawnBlocks[4].position;
     spawnPositions[1, 2] = spawnBlocks[8].position;
     spawnPositions[2, 0] = spawnBlocks[2].position;
     spawnPositions[2, 1] = spawnBlocks[6].position;
     spawnPositions[2, 2] = spawnBlocks[10].position;
     spawnPositions[3, 0] = spawnBlocks[3].position;
     spawnPositions[3, 1] = spawnBlocks[7].position;
     spawnPositions[3, 2] = spawnBlocks[11].position;
     BeatMap.Log("Spawn position0 - " + spawnPositions[0, 0]);
     mainCamera    = Camera.main;
     NoteContainer = new GameObject("NoteContainer");
     Log("Main camera - " + mainCamera.name);
     audioSource = GetComponent <AudioSource>();
     leftSaber.Initialize(isVrPlayer);
     rightSaber.Initialize(isVrPlayer);
 }
예제 #2
0
        private void OnTriggerEnter(Collider other)
        {
            if (IsOnCooldown() || BeatMap.Inverted != noteDetails.inverted)
            {
                Debug.LogWarning("Note is on cooldown");
                return;
            }
            saberTouched = other.GetComponent <Saber>();
            if (saberTouched != null)
            {
                bool refresh = false;
                currentCooldown += Time.deltaTime;
                BeatMap.EditorState currentState = BeatMap.GetCurrentState();
                // During playback, remove notes as they are hit //
                if (noteDetails.IsVisible() && (currentState == BeatMap.EditorState.Playback ||
                                                currentState == BeatMap.EditorState.Recording))
                {
                    Debug.LogWarning("INversion map-note - " + BeatMap.Inverted + "-" + noteDetails.inverted);
                    Debug.LogWarning("Current beat - " + BeatMap.GetCurrentBeat());
                    Debug.LogWarning("Note beat - " + noteDetails.timeToSpawn);
                    Debug.LogWarning("Difference - " + (BeatMap.GetCurrentBeat() - noteDetails.timeToSpawn));
                    saberTouched.addVibration(.5f, .05f, false);
                    meshRenderer.enabled = false;
                    noteDetails.inverted = !noteDetails.inverted;
                    Debug.LogWarning("Note changed to " + noteDetails.inverted);
                    refresh = true;
                }
                // During editing, highlight if the Note color has already been set //
                else if (currentState == BeatMap.EditorState.Editing && !noteDetails.inverted)
                {
                    saberTouched.Attach(gameObject);
                }

                // During editing if set to neutral, record saber direction and color //
                if ((currentState == BeatMap.EditorState.Editing || currentState == BeatMap.EditorState.Recording) &&
                    noteDetails.color == NoteColor.NONE)
                {
                    SlashDirection direction = saberTouched.GetSlashDirection(this);
                    NoteColor      color     = saberTouched.GetSaberColor();
                    noteDetails.color          = color;
                    noteDetails.slashDirection = direction;
                    refresh = true;
                }
                if (refresh)
                {
                    Refresh();
                    Debug.LogWarning("Notiying mini map of change inverted?- " + noteDetails.inverted);
                    MiniMap.AddNoteChange(noteDetails);
                }
            }
        }