// Update is called once per frame
 private void Update()
 {
     m_currentPhase = m_stateManager.GetCurrentPhase();
     if (m_currentPhase != Phases.PLAY)
     {
         return;
     }
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentGamePhase != GamePhases.PLAY)
     {
         return;
     }
     m_selectedLevel = m_stateManager.GetSelectedLevel();
     if (m_selectedLevel != Levels.EASY)
     {
         return;
     }
     m_needKeyTextFlashTimer = Math.Max(m_needKeyTextFlashTimer - Time.deltaTime, 0);
     if (m_needKeyTextFlashTimer <= 0f)
     {
         m_actionObjects[(int)ObjectPositions.STORAGE_DOOR_POSITION].SetActive(false);
     }
     m_characterPosition         = m_characterMovement.GetCharacterPosition();                                               // Get character position
     m_camera.transform.position = new Vector3(m_characterPosition.x, m_characterPosition.y, m_camera.transform.position.z); // Track the character with camera
     CheckDistance();
     m_isChestCorrectlyEntered     = m_chestPasscode.GetIsChestCorrectlyEntered();
     m_isHallwayCodeEnterCorrectly = m_passcodePad.GetIsCorrect();
     if (m_isCharacterInMuseum is false && m_isHallwayCodeEnterCorrectly is true)
     {
         FindObjectOfType <AudioManager>().Play("DoorOpen");
         m_characterMovement.SetCharacterPosition(m_museumStartPos.transform.position);
         m_isCharacterInMuseum = true;
     }
 }
Ejemplo n.º 2
0
        public Move EvaluateBoard(GamePhases currentPhase)
        {
            Coordinate sourceCoordinate    = Coordinate.Empty;
            Coordinate targetCoordinate    = Coordinate.Empty;
            IList <ValuedCoordinate> spots = new List <ValuedCoordinate>();

            foreach (Coordinate coordinate in this._protoBoard.GetAllCoordinates())
            {
                ProtoSpot protoSpot = this._protoBoard.GetCoordinate(coordinate.Level, coordinate.X, coordinate.Y);
                spots.Add(new ValuedCoordinate(coordinate, protoSpot));
            }

            switch (currentPhase)
            {
            case GamePhases.Set: {
                spots            = RunEvaluatorSet(spots, this._setEvaluators);
                targetCoordinate = PickRandomCoordinate(spots);
            }
            break;

            case GamePhases.Draw:
                break;

            case GamePhases.Jump:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(currentPhase), currentPhase, null);
            }

            return(new Move(sourceCoordinate, targetCoordinate));
        }
Ejemplo n.º 3
0
 // Update is called once per frame
 private void Update()
 {
     m_currentPhase = m_stateManager.GetCurrentPhase();
     if (m_currentPhase != Phases.PLAY)
     {
         return;
     }
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentGamePhase != GamePhases.PLAY)
     {
         return;
     }
     m_selectedLevel = m_stateManager.GetSelectedLevel();
     if (m_selectedLevel != Levels.EASY)
     {
         return;
     }
     if (m_escapeDoorPad.activeSelf is true)
     {
         if (Input.anyKey)
         {
             if (m_textIndex < m_codeTextArr.Length && Input.inputString.Length == 1 &&
                 int.Parse(Input.inputString) >= 0 && int.Parse(Input.inputString) <= 9)
             {
                 m_codeTextArr[m_textIndex].GetComponent <Text>().text = Input.inputString;
                 m_enteredText += Input.inputString;
                 m_textIndex++;
             }
         }
     }
 }
Ejemplo n.º 4
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width / 6, 0, Screen.width * 2 / 3, Screen.height * 0.3f), style);
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Pause", GUILayout.Height(Screen.height * 0.1f))) {
            GamePhase = GamePhase == GamePhases.MainMenu ? GamePhases.Game : GamePhases.MainMenu;
            print("hubahuba");
        }

        if (GUILayout.Button("move: " + controlMode.ToString(), GUILayout.Height(Screen.height * 0.1f))) {
            int cm = (int)controlMode + 1;
            if (cm >= ControlModesLength) {
                cm = 0;
            }
            controlMode = (ControlModes)cm;
        }

        GUILayout.Label("ACC: " + Input.acceleration.ToString(), GUILayout.Height(Screen.height * 0.1f));

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        if (_gamePhase == GamePhases.MainMenu) {

        }
    }
Ejemplo n.º 5
0
    void GamePhaseChanged(GamePhases gamePhase)
    {
        switch (gamePhase)
        {
        case GamePhases.Fight:
            foreach (Player input in _Input)
            {
                input.controllers.maps.SetAllMapsEnabled(false);
                input.controllers.maps.SetMapsEnabled(true, "Fight");
            }
            StartCoroutine(FightPhase());
            break;

        case GamePhases.Splice:
            foreach (Player input in _Input)
            {
                input.controllers.maps.SetAllMapsEnabled(false);
                input.controllers.maps.SetMapsEnabled(true, "Splice");
            }
            foreach (CreatureLinks link in playerCreatures)
            {
                link.enabled = true;
                link.ResetCreature();
            }
            StartCoroutine(SplicePhase());
            break;
        }
    }
 // Update is called once per frame
 private void Update()
 {
     m_currentPhase = m_stateManager.GetCurrentPhase();
     if (m_currentPhase != Phases.PLAY)
     {
         return;
     }
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentGamePhase != GamePhases.PLAY)
     {
         return;
     }
     m_selectedLevel = m_stateManager.GetSelectedLevel();
     if (m_selectedLevel != Levels.EASY)
     {
         return;
     }
     if (m_chestPasscodePad.activeSelf is true)
     {
         if (Input.anyKey)
         {
             // Check if text did not exceed text length limits. And character is between 0
             // and 9.
             if (m_textIndex < m_enteredText.Length && Input.inputString.Length == 1 &&
                 int.Parse(Input.inputString) >= 0 && int.Parse(Input.inputString) <= 9)
             {
                 m_enteredText[m_textIndex].GetComponent <TMPro.TextMeshProUGUI>().text =
                     Input.inputString;
                 m_enteredTextStr += Input.inputString;
                 m_textIndex++;
             }
         }
     }
 }
Ejemplo n.º 7
0
 void GamePhaseChanged(GamePhases gamePhase)
 {
     if (gamePhase == GamePhases.Splice)
     {
         PlayerUnReady();
     }
 }
Ejemplo n.º 8
0
 // Update is called once per frame
 private void Update()
 {
     m_currentPhase     = m_stateManager.GetCurrentPhase();
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentPhase == Phases.SELECT_LEVEL && m_currentGamePhase == GamePhases.EXIT)
     {
         m_character.SetActive(false);
         m_levelSelectionGO.SetActive(true);
         // m_levelSelection.SetIsLevelActive(false);
     }
     if (m_currentPhase == Phases.PLAY && m_currentGamePhase == GamePhases.PLAY)
     {
         if (Input.GetKeyDown(KeyCode.Q))
         {
             Application.Quit();
         }
     }
     if (m_currentPhase != Phases.START_GAME)
     {
         return;
     }
     if (m_levels[(int)m_selectedLevel].activeSelf is false)
     {
         m_selectedLevel = m_stateManager.GetSelectedLevel();
         SetupLevel();
         ChangePhases();
         // m_isLevelSetup = true;
     }
 }
Ejemplo n.º 9
0
        public void EvaluatePhase_Phase2_2StonesWhite()
        {
            // Arrange
            // Most of Arrangement is done via TestInitialize of the BaseClass
            // The Second part is done via the Initialize Method of this class
            this.Controller.Set(new Coordinate(0, 0, 0), this.Player);
            this.Controller.Set(new Coordinate(1, 0, 0), this.Player);
            this.Controller.Set(new Coordinate(2, 0, 0), this.Player);
            this.Controller.Set(new Coordinate(2, 2, 2), this.Player);

            this.Controller.Set(new Coordinate(0, 2, 0), this.Player);
            this.Controller.Set(new Coordinate(1, 2, 2), this.Player);
            this.Controller.Set(new Coordinate(2, 2, 2), this.Player);
            this.Controller.Set(new Coordinate(1, 0, 1), this.Player);

            this.Controller.Unset(new Coordinate(0, 0, 0), this.Player2, this.Player);
            this.Controller.Unset(new Coordinate(1, 0, 0), this.Player2, this.Player);
            this.Controller.Unset(new Coordinate(2, 0, 0), this.Player2, this.Player);

            this.Controller.Unset(new Coordinate(2, 2, 2), this.Player2, this.Player);
            this.Controller.Unset(new Coordinate(1, 2, 2), this.Player2, this.Player);

            //Act
            GamePhases phase = this._evaluator.EvaluatePhase(this.Player);

            //Assert
            Assert.AreEqual(GamePhases.Jump, phase);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Used for initialization
 /// </summary>
 protected void Start()
 {
     _currentInstane           = this;
     this.CurrentCoreHealth    = this.TotalCoreHealth;
     this._currentPhase        = GamePhases.Build;
     this._collectDataInterval = LevelSettings.TotalDefenseDuration / GeneralSettings.EndGraphSections;
     StartCoroutine(this.CollectData());
 }
Ejemplo n.º 11
0
 /// <summary>
 /// When the game is finished, this method is called
 /// </summary>
 public void OnGameEnds(float _winner_points)
 {
     current_game_phase = GamePhases.finished;
     game_canvas.gameObject.SetActive(false);
     winner_text.text  = is_player_one_winner ? "Player one wins with " : "Player two wins with ";
     winner_text.text += _winner_points.ToString() + " points.";
     game_end_canvas.gameObject.SetActive(true);
 }
Ejemplo n.º 12
0
 public void OnGamePhaseChange(GamePhases current)
 {
     if (!isLocalPlayer)
     {
         return;
     }
     this.CurrentGamePhase = current;
     this.UiPhase.text     = CurrentGamePhase.ToString();
 }
Ejemplo n.º 13
0
 public void NextPhase()
 {
     phaseIndex++;
     if(phaseIndex > 4)
     {
         phaseIndex = 1;
     }
     gamePhase = (GamePhases)phaseIndex;
     UpdatePhase();
 }
Ejemplo n.º 14
0
 void Update()
 {
     if(gamePhase == GamePhases.outSidePlay)
     {
         if(Input.GetKeyDown(KeyCode.Space))
         {
             gamePhase = GamePhases.p1Turn;
             UpdatePhase();
         }
     }
 }
Ejemplo n.º 15
0
    protected virtual void TriggerPhaseTransition(GamePhases nextGamePhase)
    {
        GamePhaseBehavior_BASE currentPhaseBehavior = _gamePhaseDictionaryReference[currentGamePhase];
        GamePhaseBehavior_BASE nextPhaseBehavior    = _gamePhaseDictionaryReference[nextGamePhase];

        if (nextGamePhase != currentGamePhase || !currentPhaseBehavior.isPhaseActive)
        {
            currentPhaseBehavior.EndPhase();
            nextPhaseBehavior.StartPhase();
        }
    }
Ejemplo n.º 16
0
 public void StartActionPhase()
 {
     CurrentPhase = GamePhases.ActionPhase;
     foreach (var player in Players)
     {
         player.CurrentGamePhase = CurrentPhase;
     }
     CreatePhaseSortedUnitList();
     ActivateNextUnitAction(true);
     RoundTimerActive = true;
 }
Ejemplo n.º 17
0
 void startGame()
 {
     _currentPhase             = GamePhases.Main1;
     cp.AllowedLandsToBePlayed = 1;            //it's normaly set in the untap phase...
     cp.UpdateUi();
     State = EngineStates.CurrentPlayer;
     MagicEvent(new PhaseEventArg {
         Type   = MagicEventType.BeginPhase,
         Phase  = _currentPhase,
         Player = cp
     });
 }
Ejemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        gamePhase = GamePhases.Execute;
        //Set up click locations for future use during gameplay
        clickLocations   = new Vector3[10];
        bodyPartsClicked = new GameObject[10];
        lineRenderers    = new GameObject[10];

        //Get body part gameobjects
        GetPlayerParts();

        canSelect = true;
    }
Ejemplo n.º 19
0
    void FindPhase()
    {
        if (gamePhase == GamePhases.Player1)
        {
            if (players[0].played)
            {
                for (int y = 0; y < players[1].buttons.Length; y++)
                {
                    players[1].buttons[y].interactable = true;
                }

                gamePhase = GamePhases.Player2;
            }
        }

        if (gamePhase == GamePhases.Player2)
        {
            if (players[1].played)
            {
                for (int y = 0; y < players[2].buttons.Length; y++)
                {
                    players[2].buttons[y].interactable = true;
                }

                gamePhase = GamePhases.Player3;
            }
        }
        if (gamePhase == GamePhases.Player3)
        {
            if (players[2].played)
            {
                for (int y = 0; y < players[3].buttons.Length; y++)
                {
                    players[3].buttons[y].interactable = true;
                }
                gamePhase = GamePhases.Player4;
            }
        }
        if (gamePhase == GamePhases.Player4)
        {
            if (players[3].played)
            {
                for (int y = 0; y < players[0].buttons.Length; y++)
                {
                    players[0].buttons[y].interactable = true;
                }

                gamePhase = GamePhases.Player1;
            }
        }
    }
 // Update is called once per frame
 private void Update()
 {
     m_currentPhase     = m_stateManager.GetCurrentPhase();
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentPhase == Phases.SELECT_LEVEL && m_currentGamePhase == GamePhases.EXIT)
     {
         m_levelSelection.SetActive(true);
     }
     if (m_currentPhase == Phases.PLAY_GAME && m_isPlayGameSetup is false)
     {
         m_gameIntro.SetActive(true);
         m_gameIntroButtons.SetActive(true);
         m_levelSelection.SetActive(false);
     }
 }
Ejemplo n.º 21
0
 public void ChangeToDay()
 {
     if (gameTimeUI.isTimerShown)
     {
         gameTimeUI.isTimerShown = false;
     }
     camera.setCameraToGamePhase(false);
     votingArea.PlayersCanMove();
     //votingArea.CheckVotes();
     player.dayPickUp = true;
     player.nightHide = false;
     gamePhase        = GamePhases.Day;
     timer            = dayTime;
     Debug.Log("Switching to Day");
 }
Ejemplo n.º 22
0
    void GamePhaseChanged(GamePhases gamePhase)
    {
        switch (gamePhase)
        {
        case GamePhases.Fight:
            splicePhaseUI.SetBool("Open", false);
            fightPhaseUI.SetBool("Open", true);
            break;

        case GamePhases.Splice:
            splicePhaseUI.SetBool("Open", true);
            fightPhaseUI.SetBool("Open", false);
            break;
        }
    }
Ejemplo n.º 23
0
    public void SetGamePhase(GamePhases inputPhase)
    {
        Debug.Log("SetGamePhase" + inputPhase.ToString());
        if (currentPhase != null)
        {
            EndGamePhaseBehavior();
        }

        gamePhase = inputPhase;
        switch (gamePhase)
        {
        case GamePhases.StartScreen:
            currentPhase = startScreenBehavior;
            break;

        case GamePhases.LoadScreen:
            currentPhase = loadScreenBehavior;
            tutorialManager.tutorialIndex = 0;
            tutorialManager.ResetTutorialCompletionData();
            break;

        case GamePhases.GenerateTrack:
            currentPhase = generateTrackBehavior;
            break;

        case GamePhases.PlayerInteraction:
            currentPhase = playerInteractionBehavior;
            break;

        case GamePhases.GradeSubmission:
            currentPhase = gradeSubmissionBehavior;
            break;

        case GamePhases.GradeReport:
            currentPhase = gradeReportBehavior;
            break;

        case GamePhases.EndScreen:
            currentPhase = endScreenBehavior;
            break;

        case GamePhases.CloseGame:
            currentPhase = exitGameBehavior;
            break;
        }

        BeginGamePhaseBehavior();
    }
Ejemplo n.º 24
0
 public void PlayerReadyToFight(int index, bool ready)
 {
     if (index == 0)
     {
         player1Ready = ready;
     }
     if (index == 1)
     {
         player2Ready = ready;
     }
     if (player1Ready && player2Ready)
     {
         gamePhase = GamePhases.Fight;
         OnGamePhaseChanged(gamePhase);
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Called when the game phase changes
        /// </summary>
        /// <param name="newPhase">The new  phase</param>
        public void OnGamePhaseChange(GamePhases newPhase)
        {
            var isFight = newPhase == GamePhases.Fight;

            if (!isFight)
            {
                for (int i = this.CurrentEnemies.Count - 1; i >= 0; i--)
                {
                    var targetEnemy = this.CurrentEnemies[i];
                    if (targetEnemy != null)
                    {
                        Destroy(targetEnemy.gameObject);
                    }
                }
            }

            this._shouldSpawn = isFight;
        }
Ejemplo n.º 26
0
    public void TriggerPhaseTransition(GamePhases inputPhase)
    {
        if (_currentPhaseBehavior)
        {
            _currentPhaseBehavior.EndPhase();
        }

        foreach (GamePhaseBehavior gpb in gamePhaseBehaviors)
        {
            if (gpb.phase == inputPhase)
            {
                gpb.StartPhase();
                _currentPhaseBehavior = gpb;
                if (sharedUIReference)
                {
                    sharedUIReference.SetSharedUIDisplay(_currentPhaseBehavior.sharedUI);
                }
            }
        }
    }
Ejemplo n.º 27
0
        public void DrawCards(int drawCount, GamePhases currentPhase)
        {
            int cardDrawCount = drawCount;

            if (currentPhase == GamePhases.Beginning_Draw)
            {
                foreach (Effect drawEffect in ActiveEffects.FindAll(o => o.EffectType == EffectTypes.DrawPhaseExtraCards))
                {
                    cardDrawCount += drawEffect.Value;
                }
            }

            List <Card> cardsDrawn = new List <Card>();

            if (cardDrawCount > Library.Cards.Count)
            {
                FailedDraw = true;
                cardsDrawn.AddRange(Library.Draw(Library.Cards.Count));
            }
            else
            {
                cardsDrawn.AddRange(Library.Draw(cardDrawCount));
            }

            foreach (Card card in cardsDrawn)
            {
                card.OnEffectTriggered        += Card_EffectTriggered;
                card.OnCardPhasedIn           += Card_CardPhasedIn;;
                card.OnCardPhasedOut          += Card_CardPhasedOut;
                card.OnCardTapped             += Card_CardTapped;
                card.OnCardUntapped           += Card_CardUntapped;
                card.OnCardDestroyed          += Card_CardDestroyed;
                card.OnPendingActionTriggered += Card_PendingActionTriggered;
                card.OnEffectTrigger          += Card_EffectTrigger;
            }

            Hand.Add(cardsDrawn);
        }
    // Update is called once per frame
    private void Update()
    {
        m_currentPhase = m_stateManager.GetCurrentPhase();
        if (m_currentPhase != Phases.PLAY)
        {
            return;
        }
        m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
        if (m_currentGamePhase != GamePhases.PLAY)
        {
            return;
        }
        // Vector3 cameraPosition =
        // gameObject.transform.Find("CharacterCameraPos").transform.position;
        // m_camaera.transform.position = cameraPosition;
        // Get input movements:
        m_movement.x = Input.GetAxisRaw("Horizontal");
        m_movement.y = Input.GetAxisRaw("Vertical");

        m_animator.SetFloat("horizontal", m_movement.x);
        m_animator.SetFloat("vertical", m_movement.y);
        m_animator.SetFloat("speed", m_movement.sqrMagnitude);
    }
Ejemplo n.º 29
0
 // Update is called once per frame
 void Update()
 {
     m_currentPhase = m_stateManager.GetCurrentPhase();
     if (m_currentPhase != Phases.PLAY)
     {
         return;
     }
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentGamePhase != GamePhases.PLAY)
     {
         return;
     }
     m_selectedLevel = m_stateManager.GetSelectedLevel();
     if (m_selectedLevel != Levels.EASY)
     {
         return;
     }
     if (m_passcodePad.activeSelf is true)
     {
         UpdateText();
         DoFlicks();
     }
 }
 // Update is called once per frame
 private void Update()
 {
     m_currentPhase = m_stateManager.GetCurrentPhase();
     if (m_currentPhase != Phases.PLAY)
     {
         return;
     }
     m_currentGamePhase = m_stateManager.GetCurrentGamePhase();
     if (m_currentGamePhase != GamePhases.PLAY)
     {
         return;
     }
     m_selectedLevel = m_stateManager.GetSelectedLevel();
     if (m_selectedLevel != Levels.INTRODUCTION)
     {
         return;
     }
     m_characterPosition         = m_characterMovement.GetCharacterPosition();
     m_camera.transform.position = new Vector3(m_characterPosition.x, m_characterPosition.y, m_camera.transform.position.z);
     CalculateDistance();
     CheckDistance();
     UpdateText();
     DoFlicks();
 }
Ejemplo n.º 31
0
        private void CountDown()
        {
            if (countdownValue > 0)
            {
                countdownValue--;
                if(GamePhase == GamePhases.Started || GamePhase == GamePhases.Demo)
                    countdownLabel.Content = countdownValue;
                else if (GamePhase == GamePhases.Countdown)
                    InstructionLabel.Content = "Avoid vortices in " + countdownValue.ToString() + "!";
            }
            else
            {
                countdownTimer.Enabled = false;

                if (GamePhase == GamePhases.Started || GamePhase == GamePhases.Demo)
                {
                    GamePhase = GamePhases.GameOver;
                    vortices.StopFlow();
                    feedback.StopFans();
                    StartButton.Visibility = System.Windows.Visibility.Visible;
                    GameOver_fadeinout(GameOverLabel);
                }
                else if (GamePhase == GamePhases.Countdown)
                    StartGame();
            }
        }
Ejemplo n.º 32
0
        public static void SendChangeWinStateMessage(Player player, GamePhases state, Team team, byte id, bool immediate)
        {
            SendMessageHeader(MessageType.ChangeWinState, id);

            Storage.PacketWriter.Write((byte)state);
            Storage.PacketWriter.Write((byte)team);

            if(immediate)
            {
                SendOneOffMessage(player);
            }
        }
Ejemplo n.º 33
0
 void WinGame(int player)
 {
     //Win state
     gamePhase = GamePhases.outSidePlay;
 }
Ejemplo n.º 34
0
 // Start is called before the first frame update
 void Awake()
 {
     current_game_phase = GamePhases.playing; remaining_seconds = game_duration_in_seconds; generateListaShot();
 }
Ejemplo n.º 35
0
 public void ResetGame()
 {
     StartButton.Visibility = System.Windows.Visibility.Visible;
     countdownTimer.Enabled = false;
     GamePhase = GamePhases.Standby;
     countdownValue = GameTime;
     swimDistance = 0;
     distanceLabel.Content = swimDistance;
     vortices.speed = 0.3;
     vortices.StopFlow();
     feedback.StopFans();
 }
Ejemplo n.º 36
0
        private void HandleGameTimer(int param)
        {
            try
            {

                angleLabel.Content = Math.Round(fish1.inputAngle,2);
                spedLabel.Content = Math.Round(vortices.speed,2);

                // Every so often, notify what our actual framerate is

                updateDistance(); // in top right corner

                // if you change this, remember to change dataRate variable in turnFish()
                //if ((frameCount % 2) == 0) // if fps is 50, this means "at 25 Hz"
                if (GamePhase != GamePhases.Started)
                    roboticfish.RobotAngle = 0;
                roboticfish.turnFish(); // move the robot fish, if necessary

                // Draw new Wpf scene by adding all objects to canvas
                playfield.Children.Clear();

                if (GamePhase == GamePhases.Demo)
                    fish1.inputAngle = recommendedAngle;

                double offsetChange = fish1.maxFishOffset / 150.0 * vortices.speed * actualFrameTime * fish1.inputAngle / 600.0;

                if (!fish1.MoveHorizontally(offsetChange, screenRect.Width, actualFrameTime / 1000.0, vortices.scaledSpeed))
                    fish1.UpdateTail(actualFrameTime / 1000.0);
                playfield.Children.Add(fish1);

                // p.Status = (Status)_r.Next(1, 9);

                //Canvas.SetLeft(p, fish1.NosePosition.X - p.ActualWidth/2);
                //Canvas.SetTop(p, fish1.NosePosition.Y - 2*p.ActualHeight);
                //playfield.Children.Add(p);

                switch (GamePhase)
                {
                    case GamePhases.Demo:
                    case GamePhases.Started:
                        {
                            // Calculate vortex strength and apply to feedback system
                            if ((frameCount % 10) == 0)
                                TactileFeedback();
                            // make the flow faster
                            if ((frameCount % 25) == 0)
                            {
                                vortices.speed += 0.1;
                            }
                            oldangle = fish1.inputAngle;
                            vortices.Draw(playfield.Children);
                            break;
                        }
                    case GamePhases.InstructionsLeftPose:
                        {
                            if (Math.Abs(shadowFish.fishOffset - fish1.fishOffset) < 10)
                            {
                                GamePhase = GamePhases.InstructionsRightPose;

                                shadowFish.TurnFish(30);
                                shadowFish.MoveHorizontally(500, screenRect.Width, 1.0, vortices.scaledSpeed);
                                shadowFish.HeadAngle = -30 * 0.3;
                                shadowFish.BodyAngle = shadowFish.HeadAngle;
                                shadowFish.BodyAngle2 = shadowFish.BodyAngle;
                                shadowFish.TailAngle = shadowFish.BodyAngle2 * 1.2;
                                shadowFish.Angle = 30 * 1.4;
                                InstructionLabel.Content = "Good! Once more!";
                            }
                            playfield.Children.Add(shadowFish);
                            break;
                        }
                    case GamePhases.InstructionsRightPose:
                        {
                            if (Math.Abs(shadowFish.fishOffset - fish1.fishOffset) < 10)
                            {
                                GamePhase = GamePhases.Countdown;
                                countdownValue = 6;
                                shadowFish.Visibility = System.Windows.Visibility.Hidden;
                                countdownTimer.Enabled = true;
                            }
                            playfield.Children.Add(shadowFish);
                            break;
                        }
                    case GamePhases.GameOver:

                        vortices.Draw(playfield.Children);

                        break;
                }

            }
            catch (Exception)
            {

               // throw;
            }
        }
Ejemplo n.º 37
0
 public void StartDemo()
 {
     StartGame();
     GamePhase = GamePhases.Demo;
 }
Ejemplo n.º 38
0
	void Start ()
    {
        gamePhase = GamePhases.outSidePlay;
        cam = Camera.main.transform;
        camPos = cam.position;
	}
Ejemplo n.º 39
0
        private void ButtonPressed()
        {
            switch (GamePhase)
            {
                case GamePhases.Standby:
                    {
                        GamePhase = GamePhases.InstructionsLeftPose;
                        vortices.speed = 5.0;

                        shadowFish.FishClone(fish1);
                        Canvas.SetTop(shadowFish, Canvas.GetTop(fish1));
                        shadowFish.Visibility = System.Windows.Visibility.Visible;
                        shadowFish.TurnFish(-30);
                        shadowFish.MoveHorizontally(-500, screenRect.Width, 1.0, vortices.scaledSpeed);
                        shadowFish.HeadAngle = 30 * 0.3;
                        shadowFish.BodyAngle = shadowFish.HeadAngle;
                        shadowFish.BodyAngle2 = shadowFish.BodyAngle;
                        shadowFish.TailAngle = shadowFish.BodyAngle2 * 1.2;
                        shadowFish.Angle = -30 * 1.4;
                        InstructionLabel.Content = "Try to match the shadow!";
                        InstructionLabel.Visibility = System.Windows.Visibility.Visible;
                        break;
                    }
                case GamePhases.InstructionsLeftPose:
                case GamePhases.InstructionsRightPose:
                    StartGame();
                    break;
                case GamePhases.Started:
                    ResetGame();
                    vortices.speed = 5.0;
                    break;
                case GamePhases.GameOver: // TODO display high scores or some other indication ("Very good!"/"Try harder!")
                    GamePhase = GamePhases.Standby;
                    vortices.speed = 5.0;
                    break;
            }
        }
Ejemplo n.º 40
0
 public void StartGame()
 {
     InstructionLabel.Visibility = System.Windows.Visibility.Hidden;
     shadowFish.Visibility = System.Windows.Visibility.Hidden;
     StartButton.Visibility = System.Windows.Visibility.Hidden;
     countdownTimer.Enabled = true;
     GamePhase = GamePhases.Started;
     countdownValue = GameTime;
     swimDistance = 0;
     distanceLabel.Content = swimDistance;
     vortices.speed = StartSpeed;
     vortices.StartFlow();
 }
Ejemplo n.º 41
0
 void Awake()
 {
     instance  = this;
     gamePhase = GamePhases.Splice;
 }
Ejemplo n.º 42
0
 void GameOver_Completed(object sender, EventArgs e)
 {
     vortices.speed = 4.7;
     GamePhase = GamePhases.Standby;
 }
Ejemplo n.º 43
0
 public void GameOver()
 {
     gamePhase = GamePhases.Splice;
     OnGamePhaseChanged(gamePhase);
 }
Ejemplo n.º 44
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if(_oldPhase != Phase)
            {
                ResetPlayerState();
                DisableAllTools();
                _oldPhase = Phase;
            }

            UpdateStun(gameTime);
            UpdateInput(gameTime);
            UpdatePosition(gameTime);
            UpdateAngle();

            if(Stunned && !_wasStunned)
            {
                Storage.Game.Effect.CurrentTechnique = Storage.Game.Effect.Techniques["Blur"];
                Storage.AnimationController.Add(new Animation(this, "Blurriness", 0.004f),
                                                StunTimeRemaining.TotalMilliseconds / 2.0f);
            }
            else if(!Stunned && _wasStunned)
            {
                Storage.AnimationController.Add(
                    new Animation(this, "Blurriness", 0.000001f)
                    {
                        CompletedDelegate =
                            () => Storage.Game.Effect.CurrentTechnique = Storage.Game.Effect.Techniques["None"]
                    }, 750);
            }

            _wasStunned = Stunned;
        }