Example #1
0
 public Splash(Patterns.FiniteStateMachine fsm, int id, SplashScreen menu)
     : base()
 {
     m_fsm  = fsm;
     m_menu = menu;
     ID     = id;
     Name   = "Splash";
 }
    public void LoadMiniGame(int index)
    {
        // manually call exit because there are no other states.
        m_fsm.GetCurrentState().Exit();
        m_fsm = null;

        string sceneName = "mini_" + index.ToString();

        Source.Stop();
        // for now we only have the 8 puzzle game.
        SceneManager.LoadScene(sceneName);
    }
Example #3
0
    void Awake()
    {
        Logo = LogoGameobject.GetComponent <Image>();
        Color c = Logo.color;

        c.a = 0.0f;
        LogoGameobject.SetActive(false);

        Source = GetComponent <AudioSource>();

        // create the FiniteStateMachine.
        m_fsm = new Patterns.FiniteStateMachine();
        m_fsm.Add(new Splash_FADEIN(m_fsm, (int)Splash.StateTypes.FADEIN, this));
        m_fsm.Add(new Splash_FADEOUT(m_fsm, (int)Splash.StateTypes.FADEOUT, this));
        m_fsm.Add(new Splash_STAY(m_fsm, (int)Splash.StateTypes.STAY, this));
        m_fsm.Add(new Splash_MAINBACKGROUND(m_fsm, (int)Splash.StateTypes.MAINBACKGROUND, this));

        m_fsm.SetCurrentState((int)Splash.StateTypes.FADEIN);
    }
Example #4
0
 public GameState_WAIT(Patterns.FiniteStateMachine fsm, int id, PuzzleBoard puzzle) : base(fsm, id, puzzle)
 {
 }
Example #5
0
 public GameState_ASTAR_SOLUTION(Patterns.FiniteStateMachine fsm, int id, PuzzleBoard puzzle) : base(fsm, id, puzzle)
 {
 }
Example #6
0
 public GameState_SHOW_REWARD_AD(Patterns.FiniteStateMachine fsm, int id, PuzzleBoard puzzle) : base(fsm, id, puzzle)
 {
 }
Example #7
0
 public GameState_NEXT_PUZZLE_IMAGE(Patterns.FiniteStateMachine fsm, int id, PuzzleBoard puzzle) : base(fsm, id, puzzle)
 {
 }
Example #8
0
 public GameState(Patterns.FiniteStateMachine fsm, int id, PuzzleBoard puzzle) : base()
 {
     m_fsm   = fsm;
     ID      = id;
     _puzzle = puzzle;
 }
Example #9
0
    // Start is called before the first frame update
    void Awake()
    {
        _puzzleSet1 = new GameObject("PuzzleSet1");
        _puzzleSet2 = new GameObject("PuzzleSet2");

        Filler      = FillerGameObject.GetComponent <Image>();
        audioSource = GetComponent <AudioSource>();

        _frame        = PuzzleLayout.CreateFrame(FrameName1);
        _puzzleLayout = new PuzzleLayout(170.0f, 170.0f, PuzzleRowsOrCols);
        _frame.transform.SetParent(_puzzleSet1.transform);
        _puzzleLayout.gameObject.transform.SetParent(_puzzleSet1.transform);

        _frame2 = PuzzleLayout.CreateFrame(FrameName2);
        _frame2.transform.SetParent(_puzzleSet2.transform);
        _puzzleLayout2 = new PuzzleLayout(170.0f, 170.0f, PuzzleRowsOrCols);
        _puzzleLayout2.gameObject.transform.SetParent(_puzzleSet2.transform);

        _puzzleSet2.transform.position = new Vector3(0.0f, -600.0f, 0.0f);
        _puzzleSet2.SetActive(false);

        ID = Random.Range(0, MaxImageCount);
        LoadPuzzleImage();

        Neighbours.Instance.CreateGraphForNPuzzle(PuzzleRowsOrCols);

        _fsm = new Patterns.FiniteStateMachine();
        _fsm.Add(new GameState_FADEIN(_fsm, (int)GameState.StateID.FADEIN, this));
        _fsm.Add(new GameState_WAIT(_fsm, (int)GameState.StateID.WAIT, this));
        _fsm.Add(new GameState_PLAYING(_fsm, (int)GameState.StateID.PLAYING, this));
        _fsm.Add(new GameState_WIN(_fsm, (int)GameState.StateID.WIN, this));
        _fsm.Add(new GameState_SHOW_AD(_fsm, (int)GameState.StateID.SHOW_AD, this));
        _fsm.Add(new GameState_COMPARE(_fsm, (int)GameState.StateID.COMPARE, this));
        _fsm.Add(new GameState_RANDOMIZE(_fsm, (int)GameState.StateID.RANDOMIZE, this));
        _fsm.Add(new GameState_NEXT_PUZZLE_IMAGE(_fsm, (int)GameState.StateID.NEXT_PUZZLE_IMAGE, this));
        _fsm.Add(new GameState_SHOW_HINT(_fsm, (int)GameState.StateID.SHOW_HINT, this));
        _fsm.Add(new GameState_CANCEL(_fsm, (int)GameState.StateID.CANCEL, this));
        _fsm.Add(new GameState_SHOW_REWARD_AD(_fsm, (int)GameState.StateID.SHOW_REWARD_AD, this));
        _fsm.Add(new GameState_ASTAR_SOLUTION(_fsm, (int)GameState.StateID.ASTAR_SOLUTION, this));

        _fsm.SetCurrentState((int)GameState.StateID.FADEIN);
        audioSource.Play();

        //mBottomMenu = GameApp.Instance.mBottomMenu;
        //mBottomMenu.SetActive(true);
        //mBottomMenu.btnNext.gameObject.SetActive(false);
        //mBottomMenu.btnPrev.onClick.AddListener(LoadMenu);
        mGameMenuHandler.SetActiveBtnHome(true);

#if FARAMIRA_USE_ADS
        // initialize ADs
#if UNITY_IPHONE
        Advertisement.AddListener(this);
        Advertisement.Initialize(GameID_iOS, testMode);
#endif

#if UNITY_ANDROID
        Advertisement.AddListener(this);
        Advertisement.Initialize(GameID_Android, testMode);
#endif
#endif
    }
Example #10
0
 public Splash_FADEIN(Patterns.FiniteStateMachine fsm, int id, SplashScreen menu)
     : base(fsm, id, menu)
 {
     Name = "Splash_FADEIN";
 }
Example #11
0
    //private float m_duration1 = 4.0f;
    //private float m_duration2 = 5.0f;

    public Splash_MAINBACKGROUND(Patterns.FiniteStateMachine fsm, int id, SplashScreen menu)
        : base(fsm, id, menu)
    {
        Name = "Splash_MAINBACKGROUND";
    }
Example #12
0
 public MainMenuState_FADEOUT(Patterns.FiniteStateMachine fsm, int id, SplashScreen menu)
     : base(fsm, id, menu)
 {
     Name = "MainMenuState_FADEOUT";
 }