Пример #1
0
        public override void Execute(object parameter)
        {
            Logging.DebugLogger.WriteLine($"{GetType().Name}.{nameof(Execute)}({parameter})");
            var result = MessageBox.Show("Are you sure you want to transform this tile?", "Warning!",
                                         MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.No)
            {
                return;
            }
            if (!(parameter is ITile tile))
            {
                MessageBox.Show($"Could not transform to {nameof(NoteTile)}, parameter was of type {parameter.GetType()}.");
                return;
            }

            if (tile.Button == null)
            {
                MessageBox.Show($"Could not transform to {nameof(NoteTile)}, not connected to a button yet.");
                return;
            }

            var newTile = new NoteTile(tile.Id, tile.Column, tile.Row, tile.Text, tile.Background, tile.Foreground, "");

            tile.Button.Update(newTile);
            Settings.ReplaceTile(tile, newTile);
            new EditTileCommand().Execute(newTile);
        }
Пример #2
0
 public NoteWindow(NoteTile tile)
 {
     InitializeComponent();
     _tile  = tile;
     Width  = Math.Max(tile.WindowWidth, 0); // avoid exception on negative values
     Height = Math.Max(tile.WindowHeight, 0);
     Title  = $"Note: {tile.Text}";
     MainGrid.Children.Add(_txtNote);
     SetupTextBox();
 }
Пример #3
0
    void hitAKey(int note)
    {
        Collider[] cols = Physics.OverlapBox(transform.position + transform.forward * 0.5f, Vector3.one * 0.05f, new Quaternion(), GenerateMap.NoteMask);
        if (cols.Length > 0)
        {
            Collider col   = cols[0];
            NoteTile sNote = col.GetComponentInParent <NoteTile>();
            if (sNote.note == note && !sNote.hasBeenHit)
            {
                int tmpNote = sNote.note;
                sNote.hasBeenHit = true;
                GenerateMap.score++;
                HUD.SetScore(GenerateMap.score);

                col.transform.parent.GetChild(1).GetComponent <MeshRenderer>().enabled = false;

                if (GenerateMap.noteToEvent[tmpNote] == EventType.Loot)
                {
                    col.GetComponentInChildren <Animator>().SetTrigger("Open");
                    _animator.SetTrigger("Attack");
                }
                if (GenerateMap.noteToEvent[tmpNote] == EventType.Monster)
                {
                    col.GetComponentInChildren <Enemy>().Die();
                    _animator.SetTrigger("Attack");
                }
                if (GenerateMap.noteToEvent[tmpNote] == EventType.Jump)
                {
                    _animator.SetTrigger("Jump");
                }

                AddToCombo();
                GenerateMap.notesPlayed++;
            }
            else if (sNote.note != note && !sNote.hasBeenHit)
            {
                sNote.hasBeenHit = true;
                LoseCombo();
                GenerateMap.notesPlayed++;
            }
            lastCollider.GetComponentInParent <NoteTile>().hasBeenHit = true;
        }
        if (!isMoving)
        {
            HUD.HideStartMessage();
        }
        isMoving = true;
    }
Пример #4
0
    private void Select()
    {
        isSelected       = true;
        render.color     = selectedColor;
        previousSelected = GetComponent <NoteTile>();

        Debug.Log(render.sprite.name);
        if (render.sprite.name == "blue 0")
        {
            //Instantiate(padManagers[0], spawnPoint, Quaternion.identity);
            Debug.Log("Fired!");
        }


        SFXManager.instance.PlaySFX(Clip.Select);
        mainCamera.GetComponent <CameraShake>().shakecamera();
        StartCoroutine(StopShakingCamera());
    }
Пример #5
0
 private void Deselect()
 {
     isSelected       = false;
     render.color     = Color.white;
     previousSelected = null;
 }