Пример #1
0
    private void onGoToMainMenu()
    {
        Singleton.instance.networkManager.Disconnect();

        _fader.FadeOut(0.35f, () =>
        {
            _stateMachine.ChangeState(TacoTuesdayState.MAIN_MENU);
        });
    }
Пример #2
0
 private void ImDone()
 {
     if (!gameStateMachine_Ref.GameOver)
     {
         if (amIPlayerOne)
         {
             if (!gameStateMachine_Ref.GameOver)
             {
                 inGameUIManager_Ref.PlayerTwoPrintText_Ref.canIPrint   = true;
                 inGameUIManager_Ref.playerTwoIntroUIAnim_Ref.isTalking = true;
                 myString = "";
             }
         }
         else
         {
             gameStateMachine_Ref.IntroIsDone = true;
             currentStringToDisplay           = "";
             gameStateMachine_Ref.TurnOffIntroTauntScreen();
         }
     }
     else
     {
         gameStateMachine_Ref.ChangeState(new BeginState(gameStateMachine_Ref));
     }
 }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        InputHandler = GameObject.Find("Camera").GetComponent <InputHandler>();

        stateMachine = new GameStateMachine();
        stateMachine.ChangeState(new GameStateBlackTurn());
    }
Пример #4
0
 public void PlayerInput()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         gameStateMachine_Ref.ChangeState(new BeginState(gameStateMachine_Ref));
     }
 }
Пример #5
0
 public void Step(float p_deltaTime)
 {
     if (_asyncLoad.isDone)
     {
         _gameStateMachine.ChangeState(JamStateType.GAMEPLAY);
         _gui.screenFader.FadeIn();
     }
 }
Пример #6
0
    public override void Initialize()
    {
        view.OnStartClicked.AddListener(() =>
        {
            AI.enabled = false;
            sm.ChangeState <InGameState>();
        });

        view.OnStartAIClicked.AddListener(() =>
        {
            AI.enabled = true;
            sm.ChangeState <InGameState>();
        });
        view.OnEggClicked.AddListener(() => Application.OpenURL("https://youtu.be/0XgCsv-y-mc?t=70"));
        view.OnBackKeyClicked.AddListener(() => Application.Quit());
        // who cares about unsubscribing
    }
Пример #7
0
 public void PlayerInput()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         gameStateMachine.ChangeState(new PlayState(gameStateMachine, false));
         gameStateMachine.TurnOnCanvasSection(2);
     }
 }
Пример #8
0
    public void Init(Hashtable changeStateData)
    {
        //Debug.Log ("Entering In Intro State");
        DOTween.Init(true, true, LogBehaviour.ErrorsOnly);
        // More initialization

        _gameStateMachine.ChangeState(JamStateType.MAIN_MENU);
        _gui.screenFader.FadeIn();
    }
Пример #9
0
 public void ResumeGameButtonPressed()
 {
     if (gameStateMachine_Ref != null)
     {
         gameStateMachine_Ref.ChangeState(new PlayState(gameStateMachine_Ref, false));
     }
     else
     {
         Debug.Log("ResumeGameButton is missing a reference to GameStateMachine");
     }
 }
Пример #10
0
    public override void Initialize()
    {
        view.ToMenu.AddListener(() => sm.ChangeState <MenuGameState>());

        view.LeftDown.AddListener(() => { if (!aiEnabled)
                                          {
                                              signalBus.Fire <EmptynessInside>("LeftFlipperDown");
                                          }
                                  });
        view.LeftUp.AddListener(() => { if (!aiEnabled)
                                        {
                                            signalBus.Fire <EmptynessInside>("LeftFlipperUp");
                                        }
                                });
        view.RightDown.AddListener(() => { if (!aiEnabled)
                                           {
                                               signalBus.Fire <EmptynessInside>("RightFlipperDown");
                                           }
                                   });
        view.RightUp.AddListener(() => { if (!aiEnabled)
                                         {
                                             signalBus.Fire <EmptynessInside>("RightFlipperUp");
                                         }
                                 });

        springArea.BallEntered.AddListener(() => { if (!aiEnabled)
                                                   {
                                                       view.SetActiveAcceleratorPanel(true);
                                                   }
                                           });
        springArea.BallLeft.AddListener(() => { if (!aiEnabled)
                                                {
                                                    view.SetActiveAcceleratorPanel(false);
                                                }
                                        });

        view.OnAcceleratorDrag.AddListener((x) =>
        {
            view.SetAcceleratorFill(Mathf.Clamp01(-(x.position - x.pressPosition).y / maxDrag));
        });

        view.OnAcceleratorUp.AddListener((x) =>
        {
            launchForce = Mathf.Clamp01(-(x.position - x.pressPosition).y / maxDrag);
            Debug.Log(x.position - x.pressPosition);
            LaunchTheBall();
            // view.SetActiveAcceleratorPanel(false);
        });
    }
Пример #11
0
        public virtual void Execute()
        {
            m_curTime += Time.deltaTime;
            if (m_isTimeBased && m_curTime >= m_stateDuration)
            {
                if (m_nextState != null)
                {
                    m_fsm.ChangeState(m_nextState.m_stateName);
                }
                return;
            }

            if (OnUpdate != null)
            {
                OnUpdate();
            }
            Update();
        }
    void Initialize()
    {
        // Prevents duplicate GameManagers, but allows for easier testing
        if (Instance != FindObjectOfType<GameManager>())
        {
            gameObject.SetActive(false);
            return;
        }

        // Don't destroy this; other GameManagers in other scenes should be disabled before build and for testing should use GameStateInit
        DontDestroyOnLoad(this);

        // Create new inventory
        if (m_inventory == null)
        {
            m_inventory = new Inventory(slots);
        }

        ///////////////////////

        // Create new CharacterManager
        if (m_characters == null)
        {
            // No auto; let game states search by their own
            m_characters = new CharacterManager(false);
        }

        ///////////////////////

        // Create new CameraController
        if (m_camera == null)
        {
            // Add targets after scene load
            m_camera = new CameraController(/*Human.Link.gameObject, Dog.Link.gameObject*/);

            // Add states, but change on GameStatePlay
            m_camera.AddState(new CameraStateFollow(movementSmooth, rotationSmooth, minY, maxY));
            //Camera.ChangeState("CameraStateFollow");
        }

        ///////////////////////

        // Create a new UI Manager
        if (m_ui == null)
        {
            //BUG: this seems to be null'd after first scene load?
            m_ui = new UIManager(false);
        }

        ///////////////////////

        // Create new GameStateMachine
        if (GameState == null)
        {
            GameState = new GameStateMachine();

            // Add some states
            GameState.AddStatesRange(new GameStatePlay(), new GameStateStart(), new GameStateEnd(), new GameStateLoad(), new GameStateInit());
            GameState.ChangeState(startState); // Set starting statea
            GameState.UpdateState(); // Update to that state immidiately

        }

        ///////////////////////

        // Refresh GameManager once after all systems are initialized
        Refresh();
    }
Пример #13
0
 public void StartGameButtonPressed()
 {
     gameStateMachine_Ref.ChangeState(new PlayState(gameStateMachine_Ref, true));
 }
Пример #14
0
 public override void Initialize()
 {
     view.OnToMenuClicked.AddListener(() => sm.ChangeState <MenuGameState>());
     view.OnRestartClicked.AddListener(() => sm.ChangeState <InGameState>());
 }
Пример #15
0
 public void Init(ErrorMessageView view)
 {
     this.uiView = view;
     view.OnBackClicked.AddListener(() => sm.ChangeState <ListGameState>());
 }
Пример #16
0
 private void onGameOver(GeneralEvent e)
 {
     _stateMachine.ChangeState(TuckState.MAIN_MENU);;
 }
Пример #17
0
 public void ModelSelected(ModelEntry entry)
 {
     sm.ChangeState <LoadingGameState, ModelEntry>(entry);
 }