Пример #1
0
 void Update()
 {
     if (Input.GetKeyDown(restartKey))
     {
         GameSequence.Restart();
     }
 }
Пример #2
0
    private void LocalSetGameSequence(int intNewGameSequence)
    {
        GameSequence newGameSequence = (GameSequence)intNewGameSequence;

        _gameSequence = newGameSequence;
        OnChangeGameSequence?.Invoke(newGameSequence);
    }
Пример #3
0
    void Awake()
    {
        ads = AdsSingleton.GetInstance;
        //ads = AdsSingleton.GetInstance;

        titlePanel    = GameObject.FindWithTag(Tags.UITitlePanel).GetComponent <NGUIPanel>();
        radyPanel     = GameObject.FindWithTag(Tags.UIRadyPanel).GetComponent <NGUIPanel>();
        playPanel     = GameObject.FindWithTag(Tags.UIPlayPanel).GetComponent <NGUIPanel>();
        gameOverPanel = GameObject.FindWithTag(Tags.UIGameOverPanel).GetComponent <NGUIPanel>();

        screenFader = GameObject.FindWithTag(Tags.ScreenFader).GetComponent <ScreenFader>();

        if (DebugManager.FunctionLog)
        {
            Debug.Log(this.ToString() + " Awake");
        }
        gameData = GameDataSingleton.Instance;

        InitializeDelegateLists();
        InitializeButtonDelegate();

        screenFader.SetStateBlack();
        sequence = gameData.StartSeq;

        if (isTutorial)
        {
            sequence = GameSequence.Restart;
        }
    }
Пример #4
0
 void OnTouchStart()
 {
     if (!GameSequence.IsGameStarted())
     {
         return;
     }
     isTouching_ = true;
 }
Пример #5
0
 void OnTouchEnd()
 {
     if (!GameSequence.IsGameStarted())
     {
         return;
     }
     isTouching_ = false;
     touchCount_ = 0;
 }
Пример #6
0
    void Awake()
    {
        mainCamera = GameObject.Find("Main Camera");
        gameList   = gameList.GetComponent <gameList>();

        User user = new User();

        seq = new GameSequence(user, inputRoom, gameList);
    }
Пример #7
0
 private void RestartSequence()
 {
     // Sequences
     sequence = new GameSequence();
     // Restart helpers
     index       = 0;
     currentStep = 0;
     SetEnergy(currentStep);
     // Warm and Start
     Warm();
 }
Пример #8
0
    void Update()
    {
        switch (gameSequence)
        {
        case GameSequence.Invalide:

            gameSequence = GameSequence.Init;
            break;

        case GameSequence.Init:

            playerCard.SetPlayerDeck();
            cpuCard.SetCPUdeck();
            gameSequence = GameSequence.Deal;
            break;

        case GameSequence.Start:

            gameSequence = GameSequence.Deal;
            break;

        case GameSequence.Deal:
            playerCard.SetPlayerCard();
            cpuCard.SetCPUCard();
            Debug.Log(playerCard.playerCard.Number);
            Debug.Log(cpuCard.cpuCard.Number);
            gameSequence = GameSequence.PlayerJudge;

            if (playerJudge.Judge)
            {
                gameSequence = GameSequence.Show;
            }
            break;

        case GameSequence.Show:

            if (playerJudge.High)
            {
                if (playerCard.playerCard.Number > cpuCard.cpuCard.Number)
                {
                    Debug.Log("勝ち");
                }
                else
                {
                    Debug.Log("負け");
                }
            }
            playerJudge.Judge = false;
            gameSequence      = GameSequence.Start;
            break;
        }
    }
Пример #9
0
    void Update()
    {
        if (!GameSequence.IsGameStarted())
        {
            return;
        }

        if (isTouching_)
        {
            ++touchCount_;
        }
        if (touchCount_ == touchDuration)
        {
            StartCoroutine(Bomb());
        }
    }
Пример #10
0
    void SetSequence(GameSequence targetSeq)
    {
        switch (targetSeq)
        {
        case GameSequence.Rady:
            SetUp_Rady();
            break;

        case GameSequence.Playing:
            SetUp_Play();
            break;

        case GameSequence.GameOver:
            SetUp_GameOver();
            break;
        }
        sequence = targetSeq;
    }
    void Update()
    {
        while (GameSequence.IsGameStarted())
        {
            return;
        }

        if (isTouching_)
        {
            ++touchCount_;
        }
        if (touchCount_ > touchDuration)
        {
            GameSequence.StartGame();
            var obj = Instantiate(startEffect);
            obj.transform.position = transform.position;
            Destroy(this);
        }
    }
Пример #12
0
        void ProcessLevel(CanvasAnimatedUpdateEventArgs args)
        {
            if (_gameState == GameState.LevelUp)
            {
                _currentLevel++;
                if (_currentLevel > _gameSequence.Length - 1)
                    _currentLevel = _gameSequence.Length - 1;
                _currentBeatTime = 0;
                _currentSequence = _gameSequence[_currentLevel];
                _currentElapsedTime = TimeSpan.Zero;

                _gameState = GameState.ThreeTwoOneGo;
            }

            if (_gameState != GameState.ThreeTwoOneGo && _gameState2 != GameState.GotPoints)
                return;

            if (!_tribal.IsPlaying)
            {
                _tribal.Play();
            }

            if (_tapType == SpheroTapType.DoubleTap)
            {
                _tapType = SpheroTapType.None;
            }

            _previousElapsedTime = _elapsedTime;
            _elapsedTime = args.Timing.ElapsedTime;
            _currentElapsedTime += _elapsedTime;
            _rewardElapsedTime += _elapsedTime;

            if ((_gameState2 == GameState.GotPoints || _gameState2 == GameState.Failed) &&
                _currentElapsedTime.TotalMilliseconds > 2000)
            {
                _gameState2 = GameState.None;
                _rewardElapsedTime = TimeSpan.Zero;
            }

            if (_gameState2 == GameState.CheckMovement &&
                _rewardElapsedTime.TotalMilliseconds > 1000)
            {
                int beat = _currentBeatTime - 1;
                if (beat < 0)
                    beat = 0;
                if (_currentMovType == _currentSequence.Movements[beat])
                {
                    _gameState2 = GameState.GotPoints;
                    _currentIdxReward = RAND.Next(0, _rewardMessage.Length - 1);
                    _points += (_currentIdxReward + 1) * _currentLevel * beat;
                }
                else
                {
                    _currentMovType = SpheroMovementType.None;
                    _gameState2 = GameState.Failed;
                    _numFails++;
                }
            }

            if (_currentBeatTime < _currentSequence.Times)
            {
                _posSpheroSeq.X -= 1; // TODO syncronize the movement with the song and active color

                if (_currentElapsedTime.TotalMilliseconds > _currentSequence.Tempo ||
                    _currentElapsedTime.TotalMilliseconds > _currentSequence.Tempo + _currentSequence.TempoColorSwitch)
                {
                    _currentColor = _currentSequence.Colors[_currentBeatTime];
                    if (_currentElapsedTime.TotalMilliseconds > _currentSequence.Tempo + _currentSequence.TempoColorSwitch)
                        _currentElapsedTime = TimeSpan.Zero;

                    _robot.SetRGBLED(_currentColor.R,
                                     _currentColor.G,
                                     _currentColor.B);

                    _prevBeatTime = _currentBeatTime;
                    _currentBeatTime++;

                    _gameState2 = GameState.CheckMovement;

                    if (_currentBeatTime == _currentSequence.Times)
                        _gameState = GameState.LevelUp;
                }
            }

            if (_currentBeatTime >= _currentSequence.Times &&
                _movType == SpheroMovementType.ShakeIt)
            {
                _movType = SpheroMovementType.None;
                _currentMovType = SpheroMovementType.None;
                _tribal.Stop();

                _currentBeatTime = 0;
                _currentLevel = 0;
                _currentElapsedTime = TimeSpan.Zero;
            }

            if (_numFails > 6)
            {
                _gameState = GameState.GameOver;
                _movType = SpheroMovementType.None;
                _tribal.Stop();

                _currentColor = Colors.Red;
                _currentBeatTime = 0;
                _currentBeatTime = 0;
                _currentLevel = 0;
                _currentElapsedTime = TimeSpan.Zero;
            }
        }
Пример #13
0
    /// <summary>
    /// ゲームシーケンスを変更する。新しいシーケンスを返すイベントが発火する。
    /// </summary>
    /// <param name="newGameSequence"></param>
    private void RpcSetGameSequence(GameSequence newGameSequence, PhotonTargets photonTargets = PhotonTargets.All)
    {
        int intNewGameSequence = (int)newGameSequence;

        this.photonView.RPC("LocalSetGameSequence", photonTargets, intNewGameSequence);
    }
Пример #14
0
    void Update()
    {
        switch (gameSequence)
        {
        case GameSequence.Invalide:

            gameSequence = GameSequence.Init;
            break;

        case GameSequence.Init:


            playerCard.SetPlayerDeck();
            cpuCard.SetCPUDeck();
            gameSequence = GameSequence.Deal;

            break;

        case GameSequence.Start:

            gameJudge.GameJudgeTextInit();
            gameSequence = GameSequence.Deal;
            break;



        case GameSequence.Deal:
            playerCard.SetPlayerCard();
            cpuCard.SetCPUCard();
            Debug.Log(playerCard.playerCard.Number);
            Debug.Log(cpuCard.cpuCard.Number);
            gameSequence = GameSequence.PlayerJudge;
            break;

        case GameSequence.PlayerJudge:

            if (playerJudge.Judge)
            {
                gameSequence = GameSequence.Show;
            }
            break;

        case GameSequence.Show:

            cpuCard.ShowCPUCard();

            if (playerJudge.High)
            {
                if (playerCard.playerCard.Number > cpuCard.cpuCard.Number)
                {
                    gameJudge.GameJudgeTextView(true);
                }
                else
                {
                    gameJudge.GameJudgeTextView(false);
                }
            }

            else
            {
                if (playerCard.playerCard.Number < cpuCard.cpuCard.Number)
                {
                    gameJudge.GameJudgeTextView(true);
                }
                else
                {
                    gameJudge.GameJudgeTextView(false);
                }
            }
            waitTime -= Time.deltaTime;

            if (waitTime < 0f)
            {
                playerJudge.Judge = false;

                if (dealer.GameEnd(playerCard.GetPlayerDeck()))
                {
                    gameSequence = GameSequence.Result;
                }
                else
                {
                    gameSequence = GameSequence.Start;
                }

                gameSequence = GameSequence.Start;
                waitTime     = 3f;
            }
            break;
        }
    }
    void Update()
    {
        switch (gameSequence)
        {
        case GameSequence.Invalide:

            gameSequence = GameSequence.Init;
            break;

        case GameSequence.Init:

            // PlayerとCPUにデッキをディールする
            playerCard.SetPlayerDeck();
            cpuCard.SetCPUDeck();
            gameSequence = GameSequence.Deal;
            break;

        case GameSequence.Start:
            gameJudge.GameJudgeTextInit();
            gameSequence = GameSequence.Deal;
            break;

        case GameSequence.Deal:

            // PlayerとCPUにカードをディールする
            playerCard.SetPlayerCard();
            cpuCard.SetCPUCard();

            gameSequence = GameSequence.PlayerJudge;
            break;

        case GameSequence.PlayerJudge:

            // 数を予想してボタンを押したらShowに進む
            if (playerJudge.Judge)
            {
                gameSequence = GameSequence.Show;
            }
            break;

        case GameSequence.Show:

            // プレイヤーが確認したらStartに戻って次のゲーム
            cpuCard.ShowCPUCard();

            bool isWin = false;

            if (playerJudge.High)
            {
                if (playerCard.playerCard.Number > cpuCard.cpuCard.Number)
                {
                    isWin = true;
                }
            }
            else
            {
                if (playerCard.playerCard.Number < cpuCard.cpuCard.Number)
                {
                    isWin = true;
                }
            }

            gameJudge.GameJudgeTextView(isWin);
            waitTime -= Time.deltaTime;
            if (waitTime < 0f)
            {
                playerJudge.Judge = false;

                if (dealer.GameEnd(playerCard.GetPlayerDeck()))
                {
                    gameSequence = GameSequence.Result;
                }
                else
                {
                    gameSequence = GameSequence.Start;
                }

                scoreViewer.AddScoreViewer(isWin);
                waitTime = 1f;
            }

            break;

        case GameSequence.Result:

            bool isResultWin = false;

            if (scoreViewer.playerScore > scoreViewer.cpuScore)
            {
                isResultWin = true;
            }
            gameJudge.GameResultTextView(isResultWin);
            break;
        }
    }
Пример #16
0
    // Update is called once per frame
    void Update()
    {
        //if(Input.GetKeyDown(KeyCode.F8)) {
        //    game_mode = GameMode.Minigame;
        //    game_sequence = GameSequence.Balcony;
        //    cheers_game.SetActive(true);
        //}
        //if(Input.GetKeyDown(KeyCode.F9)) {
        //    game_mode = GameMode.Talking;
        //    game_sequence = GameSequence.Livingroom;
        //    cheers_game.SetActive(false);
        //}
        if (Input.GetKeyDown(KeyCode.F6))
        {
            AndroidStatus.happiness -= 0.1f;
        }
        if (Input.GetKeyDown(KeyCode.F7))
        {
            AndroidStatus.happiness += 0.1f;
        }
        if (Input.GetKeyDown(KeyCode.F5))
        {
            if (mood_debug != null)
            {
                mood_debug.gameObject.SetActive(true);
            }
            if (happiness_debug != null)
            {
                happiness_debug.gameObject.SetActive(true);
            }
        }
        if (Input.GetKeyDown(KeyCode.F4))
        {
            if (mood_debug != null)
            {
                mood_debug.gameObject.SetActive(false);
            }

            if (happiness_debug != null)
            {
                happiness_debug.gameObject.SetActive(false);
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (game_mode == GameMode.Talking)
            {
                SetDialogue(new Question.StringEmotion {
                    breadText = "Are you leaving me?", emotionState = FaceSystem.Emotion.sad
                });
                game_mode = GameMode.Leave;
            }
            else
            {
                Application.Quit();
            }
        }

        outputDia.text = readLine;

        readLine = ReadCurrentDialogue();
        if (fullLine != readLine)
        {
            return;
        }

        if (happiness_debug != null)
        {
            happiness_debug.text = "" + AndroidStatus.happiness;
        }

        if (game_mode == GameMode.Leave)
        {
            PlayerAnswer pa = InputManager.yesAndNo.GetAnswer();
            if (pa == PlayerAnswer.Yes)
            {
                Application.Quit();
            }
            else if (pa == PlayerAnswer.No)
            {
                game_mode = GameMode.Talking;
            }
        }

        if (game_mode == GameMode.Talking)
        {
            if (AndroidStatus.happiness >= 1.0f)
            {
                if (game_sequence == GameSequence.Livingroom)
                {
                    currentTalkingElement = null;
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Let's head out to the balcony?", emotionState = FaceSystem.Emotion.happy
                    });
                    game_mode = GameMode.Minigame;
                }

                if (game_sequence == GameSequence.Balcony)
                {
                    currentTalkingElement = null;
                    SetDialogue(new Question.StringEmotion {
                        breadText = "A toast, to us!", emotionState = FaceSystem.Emotion.happy
                    });
                    cheers_game.SetActive(true);
                    game_mode = GameMode.Minigame;
                }

                if (game_sequence == GameSequence.Bedroom)
                {
                    currentTalkingElement = null;
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Let's take this all the way", emotionState = FaceSystem.Emotion.blush
                    });
                    sex_game.SetActive(true);
                    game_mode = GameMode.Minigame;
                }
            }
            else if (AndroidStatus.happiness <= -1.0f)
            {
                game_mode = GameMode.Failure;
            }
        }

        if (game_mode == GameMode.Minigame)
        {
            if (game_sequence == GameSequence.Livingroom)
            {
                PlayerAnswer pa = InputManager.yesAndNo.GetAnswer();

                if (pa == PlayerAnswer.Yes)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "^^'", emotionState = FaceSystem.Emotion.blush
                    });
                    game_mode = GameMode.BackToTalking;
                }
                else if (pa == PlayerAnswer.No)
                {
                    game_mode = GameMode.Failure;
                }
            }
            else if (game_sequence == GameSequence.Balcony)
            {
                CheersGame cg = cheers_game.GetComponent <CheersGame>();

                if (cg.won)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Shall take this to the bedroom", emotionState = FaceSystem.Emotion.blush
                    });
                    game_mode = GameMode.BackToTalking;
                }
                else if (cg.lost)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Why do you have to ruin every special moment we have?", emotionState = FaceSystem.Emotion.sad
                    });
                    game_mode = GameMode.Failure;
                }
                else if (cg.won == false && cg.lost == false && cg.attempts != prev_cheer_attempts)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Can't you aim!?", emotionState = FaceSystem.Emotion.angry
                    });
                    prev_cheer_attempts = cg.attempts;
                }
            }
            else if (game_sequence == GameSequence.Bedroom)
            {
                SexHandler sh = sex_game.GetComponent <SexHandler>();
                if (sh.finalized)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "You do care!", emotionState = FaceSystem.Emotion.happy
                    });
                    game_mode = GameMode.BackToTalking;
                }
            }
        }

        if (game_mode == GameMode.Failure)
        {
            if (fail_state.active == false)
            {
                fail_state.SetActive(true);
                SetDialogue(new Question.StringEmotion {
                    breadText = "...", emotionState = FaceSystem.Emotion.serious
                });
            }
        }

        if (game_mode == GameMode.BackToTalking)
        {
            if (InputManager.PushToTalk())
            {
                if (game_sequence == GameSequence.Livingroom)
                {
                    change_scene.NextScene();
                    game_sequence           = GameSequence.Balcony;
                    game_mode               = GameMode.Talking;
                    AndroidStatus.happiness = 0.0f;
                }
                else if (game_sequence == GameSequence.Balcony)
                {
                    change_scene.NextScene();
                    cheers_game.SetActive(false);
                    game_sequence           = GameSequence.Bedroom;
                    game_mode               = GameMode.Talking;
                    AndroidStatus.happiness = 0.0f;
                }
                else if (game_sequence == GameSequence.Bedroom)
                {
                    AndroidStatus.happiness = 100000000.0f;
                }
            }
        }

        if (game_mode == GameMode.Talking)
        {
            if (!currentTalkingElement || currentTalkingElement.GoNext())
            {
                //Debug.Log("HEREH: ");
                if (currentTalkingElement is Question)
                {
                    TalkingElement nextElement = null;

                    if (currentTalkingElement.correctlyAnswered)
                    {
                        if (currentTalkingElement.GetType() == typeof(Question))
                        {
                            Question q = (Question)currentTalkingElement;
                            AndroidStatus.happiness += q.correct_happiness_boost;
                        }
                        nextElement = currentTalkingElement.rightAnswerNode;
                    }
                    else
                    {
                        if (currentTalkingElement.GetType() == typeof(Question))
                        {
                            Question q = (Question)currentTalkingElement;
                            AndroidStatus.happiness += q.incorrect_happiness_loss;
                        }
                        nextElement = currentTalkingElement.wrongAnswerNode;
                    }

                    if (nextElement != null)
                    {
                        SetTalkingElement(nextElement);
                        Debug.Log("Not nUll");
                    }
                    else
                    {
                        SetTalkingElement(AndroidStatus.GetTalkingElement());
                        Debug.Log("Next Element");
                    }
                }
                else
                {
                    SetTalkingElement(AndroidStatus.GetTalkingElement());
                }
            }
        }

        androidState.Update();
        if (game_mode == GameMode.Talking)
        {
            if (currentTalkingElement)
            {
                var next = currentTalkingElement.GetText();
                if (next != null && next.breadText != originalFullLine)
                {
                    SetDialogue(next);
                }
            }
        }
    }
Пример #17
0
 void OnActivated()
 {
     GameSequence.FinishGame();
     Destroy(gameObject);
 }
Пример #18
0
 void Awake()
 {
     Instance = this;
 }