Exemple #1
0
        public string GetFormattedContent()
        {
            var sb = new StringBuilder();

            Append(sb, MovieVolumePercent.ToString());
            Append(sb, SquareVolumePercent.ToString(), SquareKeepPlaying.ToString(), SquareReleaseSound.ToString());
            Append(sb, CrossVolumePercent.ToString(), CrossKeepPlaying.ToString(), CrossReleaseSound.ToString());
            Append(sb, CircleVolumePercent.ToString(), CircleKeepPlaying.ToString(), CircleReleaseSound.ToString());
            Append(sb, TriangleVolumePercent.ToString(), TriangleKeepPlaying.ToString(), TriangleReleaseSound.ToString());
            Append(sb, LeftVolumePercent.ToString(), LeftKeepPlaying.ToString(), LeftReleaseSound.ToString());
            Append(sb, DownVolumePercent.ToString(), DownKeepPlaying.ToString(), DownReleaseSound.ToString());
            Append(sb, RightVolumePercent.ToString(), RightKeepPlaying.ToString(), RightReleaseSound.ToString());
            Append(sb, UpVolumePercent.ToString(), UpKeepPlaying.ToString(), UpReleaseSound.ToString());
            Append(sb, RVolumePercent.ToString(), RKeepPlaying.ToString(), RReleaseSound.ToString());
            Append(sb, LVolumePercent.ToString(), LKeepPlaying.ToString(), LReleaseSound.ToString());
            Append(sb, BPM.ToString(), BPMRapidChange.ToString());
            Append(sb, DisplayState.ToString());
            Append(sb, MoveState.ToString());
            Append(sb, NoteType.ToString());
            Append(sb, SlideScale.ToString());
            Append(sb,
                   InitializeOrder[0].ToString(),
                   InitializeOrder[1].ToString(),
                   InitializeOrder[2].ToString(),
                   InitializeOrder[3].ToString(),
                   InitializeOrder[4].ToString(),
                   InitializeOrder[5].ToString(),
                   InitializeOrder[6].ToString(),
                   InitializeOrder[7].ToString(),
                   InitializeOrder[8].ToString(),
                   InitializeOrder[9].ToString()
                   );
            return(sb.ToString());
        }
        private void Update()
        {
            // If player is touching screen
            if (Input.GetMouseButton(TOUCH_OR_MOUSE_LEFT_CLICK))
            {
                UpdateSwipe();
            }
            else
            {
                m_PrevMoveState = MoveState.IDLE;
            }

            // Update move state debug text
            m_DebugStateText.text  = m_PrevMoveState.ToString();
            m_DebugStateText.color = MOVE_STATE_TO_DEBUG_TEXT_COLOR[m_PrevMoveState];
        }
Exemple #3
0
    // Called from all users.
    public void BattleLose()
    {
        characterInstance.Die();
        characterInstance.gameObject.SendMessage("setReturn", true);
        var move = Run.Coroutine(Move(characterInstance.GetSpawnTile()));

        Debug.LogWarning(moveState.ToString());
        MultiAudioClip multiAudioClip = characterInstance.GetComponent <MultiAudioClip>();

        multiAudioClip.audioSources[4].Play();

        move.ExecuteWhenDone(() => {
            characterInstance.gameObject.SendMessage("setReturn", false);
            if (moveState == MoveState.Battle && GameManager.gameManagerInstance.isMyCharacterManager(this))
            {
                NetworkManager.SendTurnEndMessage();
            }
            moveState = MoveState.Inactive;
        });
    }
Exemple #4
0
 void OnGUI()
 {
     GUI.Box(new Rect(0, 0, 220, 200), "STAT");
     GUI.Label(new Rect(20, 70, 200, 25), "MoveState : " + moveState.ToString());
     GUI.Label(new Rect(20, 170, 200, 25), "MoveSpeed : " + fMoveSpeed.ToString());
 }
Exemple #5
0
 void OnDrawGizmosSelected()
 {
     if (Application.isPlaying)
     {
         Handles.Label(new Vector3(rend.bounds.center.x - 0.1f, rend.bounds.max.y + 0.2f, 0f), state.ToString());
     }
 }
Exemple #6
0
 public override string ToString()
 {
     return(state.ToString());
 }
        async void PlayMove(int gc, int gr, int bc, int br, int cc, int cr, Boolean isHuman)
        {
            UIEnabled = false;
            // show last turn icon if this is the very first move
            if (lastMoveCol == -1 || lastMoveRow == -1)
            {
                LastTurnImg.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            lastMoveState = game.PlayMove(currentPlayer, bc, br, cc, cr);

            if (game.IsMoveSuccess(lastMoveState))
            {
                // save this as the last move
                lastMoveRow = gr;
                lastMoveCol = gc;

                // stop any flash animations
                ClearFlashing();

                // display turn tip for the *next* player
                //AnimateYourTurn();
                TurnImg.Source = new BitmapImage(new Uri(this.BaseUri, currentPlayer == 1 ? oturnSrc : xturnSrc));
                Animations.PopUIElement(
                    TurnImg,
                    0,
                    1,
                    0,
                    1,
                    0.5 * turnImgWidth,
                    0,
                    0.5 * turnImgHeight,
                    0,
                    Animations.popInEasing);

                // flash viable boards for next turn
                if (game.NextBoardCol == -1)
                {
                    for (int i = 0; i < 9; i++)
                    {
                        for (int j = 0; j < 9; j++)
                        {
                            FlashCell(rects[i, j]);
                        }
                    }
                }
                else
                {
                    for (int i = 3 * cc; i < 3 * (cc + 1); i++)
                    {
                        for (int j = 3 * cr; j < 3 * (cr + 1); j++)
                        {
                            FlashCell(rects[j, i]);
                        }
                    }
                }
            }

            StatusText.Text = lastMoveState.ToString();

            if (game.IsMoveSuccess(lastMoveState))
            {
                // put an X/O
                // get original cell coords first
                FillCell(gr, gc, currentPlayer == 1 ? "X" : "O");

                if (soundEffectsEnabled)
                {
                    // play the corresponding sound effect
                    if (currentPlayer == 1)
                    {
                        wavePlayer.PlayWave("playerX");
                    }
                    else
                    {
                        wavePlayer.PlayWave("playerO");
                    }
                }
            }

            switch (lastMoveState)
            {
            case MoveState.SUCCESS_GAME_ON:

                // nothing further for now
                break;

            case MoveState.SUCCESS_BOARD_WON_GAME_ON:

                // if the winner is not AI, color the board then greet the board winner
                if (!(currentPlayer == -1 && gameMode > GameMode.TwoPlayer))
                {
                    ShowRandomGreeting();
                    ColorBoard(bc, br, (currentPlayer == 1) ? GetColor(GameColor.BoardWonX) : GetColor(GameColor.BoardWonO));
                    await Task.Delay(TimeSpan.FromSeconds(greetingDurationSec));
                }

                // color the won board
                ColorBoard(bc, br, (currentPlayer == 1) ? GetColor(GameColor.BoardWonX) : GetColor(GameColor.BoardWonO));
                break;

            case MoveState.SUCCESS_BOARD_WON_GAME_DRAW:

                // color the won board
                ColorBoard(bc, br, (currentPlayer == 1) ? GetColor(GameColor.BoardWonX) : GetColor(GameColor.BoardWonO));

                // then show the game over (draw) popup
                GameOver();
                break;

            case MoveState.SUCCESS_BOARD_WON_GAME_WON:

                // color the won board
                ColorBoard(bc, br, (currentPlayer == 1) ? GetColor(GameColor.BoardWonX) : GetColor(GameColor.BoardWonO));

                // then show the game over popup
                GameOver();
                break;

            case MoveState.SUCCESS_BOARD_DRAW_GAME_WON:

                // color the won board
                ColorBoard(bc, br, GetColor(GameColor.BoardDraw));

                // then show the game over popup
                GameOver();
                break;

            case MoveState.SUCCESS_BOARD_DRAW_GAME_LOST:

                // color the won board
                ColorBoard(bc, br, GetColor(GameColor.BoardDraw));

                // then show the game over popup
                currentPlayer = -1 * currentPlayer;
                GameOver();
                break;

            case MoveState.SUCCESS_BOARD_WON_GAME_LOST:

                // color the won board
                ColorBoard(bc, br, (currentPlayer == 1) ? GetColor(GameColor.BoardWonX) : GetColor(GameColor.BoardWonO));

                // then show the game over popup
                currentPlayer = -1 * currentPlayer;
                GameOver();
                break;

            case MoveState.SUCCESS_BOARD_DRAW_GAME_DRAW:

                ColorBoard(bc, br, GetColor(GameColor.BoardDraw));

                // then show the game over (draw) popup
                GameOver();
                break;

            case MoveState.SUCCESS_BOARD_DRAW_GAME_ON:

                // color the draw board
                ColorBoard(bc, br, GetColor(GameColor.BoardDraw));
                break;
            }

            if (game.IsSuccessAndGameON(lastMoveState))
            {
                currentPlayer *= -1;
                //System.Diagnostics.Debug.WriteLine("Current player " + currentPlayer);

                if (isHuman && gameMode > GameMode.TwoPlayer)
                {
                    int Cc, Cr;

                    // sleep pretend we're thinking
                    turnProgressBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    // Wait for AI to finish rendering
                    await Task.Delay(TimeSpan.FromSeconds(1));

                    switch (gameMode)
                    {
                    case GameMode.AI_LVL_1:
                        GreedyAI1.Play(game, currentPlayer, ref cc, ref cr, out Cc, out Cr, 1);
                        break;

                    case GameMode.AI_LVL_2:
                        GreedyAI1.Play(game, currentPlayer, ref cc, ref cr, out Cc, out Cr, 2);
                        break;

                    case GameMode.AI_LVL_3:
                        GreedyAI1.Play(game, currentPlayer, ref cc, ref cr, out Cc, out Cr, 3);
                        break;

                    default:
                        Cc = -1;
                        Cr = -1;
                        break;
                    }
                    turnProgressBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

                    if (cc != -1)
                    {
                        PlayMove(cc * 3 + Cc, cr * 3 + Cr, cc, cr, Cc, Cr, false);
                    }
                }
            }
            UIEnabled = true;
        }
Exemple #8
0
 public void SwitchRandomAnimation(MoveState moveState, int maxState = 6)
 {
     currentTrigger = moveState.ToString() + (int)Random.Range(0, maxState);
     anim.SetTrigger(currentTrigger);
 }