/// <summary>
    /// Switch between the scenes
    /// </summary>
    /// <param name="newScene"></param>
    public void changeScene(ScenesType newScene)
    {
        EventManager.raise <ScenesType>(EventType.END_SCENE, actualScene);
        EventManager.raise(EventType.STOP_SOUND);

        eventRaised = false;
        actualScene = newScene;

        switch (newScene)
        {
        case ScenesType.MAIN_MENU:
            goToMainMenu();
            break;

        case ScenesType.BATTLE:
            goToBattle();
            break;

        case ScenesType.MAP:
            goToMap();
            break;

        case ScenesType.SHOP:
            goToShop();
            break;

        default:
            Debug.Log("Probleme dans changeScene");
            break;
        }
    }
Exemple #2
0
        public void ChangeScene(ScenesType type)
        {
            //_nextScene = type;

            //if (CurrentScene == null)
            //    Switch();
            //else
            //    CurrentScene.Dispose();

            CurrentScene?.Destroy();
            CurrentScene = null;

            switch (type)
            {
            case ScenesType.Login:
                Engine.IsFullScreen        = false;
                Engine.WindowWidth         = 640;
                Engine.WindowHeight        = 480;
                Engine.AllowWindowResizing = false;
                CurrentScene = new LoginScene();
                break;

            case ScenesType.Game:
                Engine.AllowWindowResizing = true;
                Engine.IsFullScreen        = true;
                CurrentScene = new GameScene();
                break;
            }

            CurrentScene?.Load();
        }
Exemple #3
0
 void newSceneLoaded(ScenesType newScene)
 {
     if (newScene == ScenesType.MAP)
     {
         instantiatePNJs();
     }
 }
Exemple #4
0
    void thinkToYourself(ScenesType lol)
    {
        Menu broomTaken = new Menu(
            new List <Pair <Callback, String> > {
            new Pair <Callback, String>(() => { EventManager.raise(EventType.MENU_EXIT); }, "..."),
        },
            "Balai récupéré !"
            );
        Menu swordTaken = new Menu(
            new List <Pair <Callback, String> > {
            new Pair <Callback, String>(() => { EventManager.raise(EventType.MENU_EXIT); EventManager.raise <Menu>(EventType.MENU_ENTERED, broomTaken); }, "Je vais prendre le balai"),
            new Pair <Callback, String>(() => { EventManager.raise(EventType.MENU_EXIT); EventManager.raise <Menu>(EventType.MENU_ENTERED, broomTaken); }, "Je vais prendre le balai")
        },
            "Vous n'avez pas la force nécessaire pour manier cette épée."
            );

        Menu choice = new Menu(
            new List <Pair <Callback, String> > {
            new Pair <Callback, String>(() => { EventManager.raise(EventType.MENU_EXIT); EventManager.raise <Menu>(EventType.MENU_ENTERED, broomTaken); }, "Je vais prendre le balai"),
            new Pair <Callback, String>(() => { EventManager.raise(EventType.MENU_EXIT); EventManager.raise <Menu>(EventType.MENU_ENTERED, swordTaken); }, "Je vais prendre l'épée"),
        },
            "Prendre le balai ou l'épée ?"
            );

        EventManager.removeActionFromEvent <ScenesType>(EventType.NEW_SCENE, thinkToYourself);
        EventManager.raise <Menu>(EventType.MENU_ENTERED, choice);
    }
Exemple #5
0
 void hideHero(ScenesType newScene)
 {
     if (newScene == ScenesType.MAP)
     {
         this.gameObject.GetComponent <SpriteRenderer>().enabled = false;
     }
 }
Exemple #6
0
        public void ChangeScene(ScenesType type)
        {
            CurrentScene?.Dispose();
            CurrentScene = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();

            switch (type)
            {
            case ScenesType.Login:
                Engine.WindowWidth  = 640;
                Engine.WindowHeight = 480;
                CurrentScene        = new LoginScene();

                break;

            case ScenesType.Game:
                Engine.WindowWidth  = 800;
                Engine.WindowHeight = 800;
                CurrentScene        = new GameScene();

                break;
            }

            CurrentScene.Load();
        }
Exemple #7
0
        public void ChangeScene(ScenesType type)
        {
            //_nextScene = type;

            //if (CurrentScene == null)
            //    Switch();
            //else
            //    CurrentScene.Dispose();

            CurrentScene?.Dispose();
            CurrentScene = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();

            switch (type)
            {
            case ScenesType.Login:
                Engine.IsFullScreen = false;
                Engine.WindowWidth  = 640;
                Engine.WindowHeight = 480;
                CurrentScene        = new LoginScene();
                break;

            case ScenesType.Game:
                Engine.IsFullScreen = true;
                CurrentScene        = new GameScene();
                break;
            }

            CurrentScene.Load();
        }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        mainMenu = new Menu
                   (
            new List <Pair <Callback, String> > {
            new Pair <Callback, String>(() =>
            {
                sceneManager.quitGame();
            }, "Exit"),
            new Pair <Callback, String>(() =>
            {
                EventManager.raise(EventType.MENU_EXIT);
                sceneManager.changeScene(ScenesType.SHOP);
            }, "Play")
        },
            "mainMenu"
                   );
        DontDestroyOnLoad(this.gameObject);

        mainMenuStartPos = new Vector3(0, -2.1f, 1);
        mainMenuOffset   = new Vector3(0, 2.1f, 0);

        fightStartPos = new Vector3(-6.5f, -2.1f, 1);
        fightOffset   = new Vector3(0, 0.75f, 0);

        dialogueStartPos = new Vector3(-6.75f, -1f, 1);
        dialogueOffset   = new Vector3(0, 0.75f, 0);

        actualScene = ScenesType.MAIN_MENU;

        EventManager.addActionToEvent <ScenesType>(EventType.NEW_SCENE, sceneChanged);
        EventManager.addActionToEvent <Menu>(EventType.MENU_ENTERED, menuToPrint);
        EventManager.addActionToEvent(EventType.MENU_EXIT, onMenuExit);
        EventManager.raise <Menu>(EventType.MENU_ENTERED, mainMenu);
    }
Exemple #9
0
        public static void ChangeScene(ScenesType type)
        {
            CurrentScene?.Dispose();
            CurrentScene = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GameLoop game = Service.Get <GameLoop>();

            switch (type)
            {
            case ScenesType.Login:
                game.WindowWidth  = 640;
                game.WindowHeight = 480;
                CurrentScene      = new LoginScene();

                break;

            case ScenesType.Game:
                game.WindowWidth  = 1000;
                game.WindowHeight = 800;
                CurrentScene      = new GameScene();

                break;
            }

            CurrentScene.Load();
        }
Exemple #10
0
 protected Scene(ScenesType type)
 {
     SceneType = type;
     Game      = Service.Get <GameLoop>();
     Device    = Game.GraphicsDevice;
     UIManager = Service.Get <UIManager>();
 }
Exemple #11
0
 protected Scene(ScenesType type)
 {
     ChainActions = new List <Func <bool> >();
     SceneType    = type;
     Game         = Service.Get <GameLoop>();
     Device       = Game.GraphicsDevice;
     UIManager    = Service.Get <UIManager>();
     InputManager = Service.Get <InputManager>();
 }
 //预加载
 public void PreLoadWindow(ScenesType type)
 {
     foreach (var item in windowDIC.Values)
     {
         if (item.GetScenesType() == type)
         {
             item.PreLoad();
         }
     }
 }
 //隐藏掉某个类型的所有窗口
 public void HideAllWindow(ScenesType type, bool isDestroy = false)
 {
     foreach (var item in windowDIC.Values)
     {
         if (item.GetScenesType() == type)
         {
             item.Close(isDestroy);
         }
     }
 }
    // Use this for initialization
    void Start()
    {
        currentType = ScenesType.MAIN_MENU;
        DontDestroyOnLoad(this.gameObject);
        EventManager.addActionToEvent <ScenesType>(EventType.NEW_SCENE, OnSceneChanged);
        EventManager.addActionToEvent <Menu>(EventType.MENU_ENTERED, OnMenuEntered);
        EventManager.addActionToEvent(EventType.MENU_EXIT, OnMenuExit);

        EventManager.addActionToEvent(EventType.CINEMATIC_BEGIN, () => { isInCinematic = true; });
        EventManager.addActionToEvent(EventType.CINEMATIC_ENDED, () => { isInCinematic = false; });
    }
Exemple #15
0
    void sceneLoaded(ScenesType oldScene)
    {
        if (oldScene == ScenesType.BATTLE)
        {
            EventManager.removeActionFromEvent <ScenesType>(EventType.NEW_SCENE, sceneLoaded);

            EventManager.raise <Menu>(EventType.MENU_ENTERED, menu);
            EventManager.raise <SoundsType>(EventType.PLAY_SOUND_LOOP, SoundsType.MUSIQUE_PNJ);
            EventManager.addActionToEvent <int>(EventType.DAMAGE_ENNEMY, hitMonster);
            EventManager.raise <int>(EventType.LOOSE_LIFE_ENNEMY, nbPvs);
            inBattle = true;
        }
    }
Exemple #16
0
    void sceneEnded(ScenesType sceneEnded)
    {
        if (sceneEnded == ScenesType.MAIN_MENU)
        {
            this.gameObject.GetComponent <SpriteRenderer>().enabled = true;
        }
        else if (sceneEnded == ScenesType.SHOP)
        {
            this.gameObject.transform.localScale = new Vector3(1, 1, 1);
            this.gameObject.transform.position   = new Vector3(-2.6f, 0.9f, -2);

            EventManager.addActionToEvent <ScenesType>(EventType.NEW_SCENE, thinkToYourself);
        }
    }
Exemple #17
0
        public void ChangeScene(ScenesType type)
        {
            //_nextScene = type;

            //if (CurrentScene == null)
            //    Switch();
            //else
            //    CurrentScene.Dispose();

            CurrentScene?.Destroy();
            CurrentScene = null;

            switch (type)
            {
            case ScenesType.Login:
                Engine.IsMaximized         = false;
                Engine.WindowWidth         = 640;
                Engine.WindowHeight        = 480;
                Engine.AllowWindowResizing = false;
                CurrentScene = new LoginScene();

                break;

            case ScenesType.Game:

                Engine.AllowWindowResizing = true;
                Engine.SetPreferredBackBufferSize(Engine.Profile.Current.WindowClientBounds.X, Engine.Profile.Current.WindowClientBounds.Y);

                if (!Engine.Profile.Current.RestoreLastGameSize)
                {
                    Engine.IsMaximized = true;
                }
                else
                {
                    Engine.WindowWidth  = Engine.Profile.Current.WindowClientBounds.X;
                    Engine.WindowHeight = Engine.Profile.Current.WindowClientBounds.Y;
                }

                CurrentScene = new GameScene();

                break;
            }

            CurrentScene?.Load();
        }
Exemple #18
0
        public void ChangeScene(ScenesType type)
        {
            CurrentScene?.Destroy();
            CurrentScene = null;

            switch (type)
            {
            case ScenesType.Login:
                Engine.IsMaximized         = false;
                Engine.WindowWidth         = 640;
                Engine.WindowHeight        = 480;
                Engine.AllowWindowResizing = false;
                CurrentScene = new LoginScene();

                break;

            case ScenesType.Game:

                Engine.AllowWindowResizing = true;

                if (!Bootstrap.StartInLittleWindow)
                {
                    if (Engine.Profile.Current != null)
                    {
                        Engine.SetPreferredBackBufferSize(Engine.Profile.Current.WindowClientBounds.X, Engine.Profile.Current.WindowClientBounds.Y);

                        if (!Engine.Profile.Current.RestoreLastGameSize)
                        {
                            Engine.IsMaximized = true;
                        }
                        else
                        {
                            Engine.WindowWidth  = Engine.Profile.Current.WindowClientBounds.X;
                            Engine.WindowHeight = Engine.Profile.Current.WindowClientBounds.Y;
                        }
                    }
                }

                CurrentScene = new GameScene();

                break;
            }

            CurrentScene?.Load();
        }
Exemple #19
0
        public void ChangeScene(ScenesType type)
        {
            CurrentScene?.Dispose();
            CurrentScene = null;

            switch (type)
            {
            case ScenesType.Login:
                CurrentScene = new LoginScene();

                break;

            case ScenesType.Game:
                CurrentScene = new GameScene();

                break;
            }

            CurrentScene.Load();
        }
Exemple #20
0
 void sceneBegin(ScenesType sceneBegin)
 {
     if (sceneBegin == ScenesType.SHOP)
     {
         this.gameObject.GetComponent <SpriteRenderer>().enabled = true;
     }
     if (sceneBegin == ScenesType.BATTLE)
     {
         EventManager.raise <int>(EventType.LOOSE_LIFE_PLAYER, lifePoint);
         if (Camera.main.GetComponent <CameraFollow>() != null)
         {
             Camera.main.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, Camera.main.transform.position.z);
             Camera.main.GetComponent <CameraFollow>().stopCamera = true;
         }
     }
     else
     if (Camera.main.GetComponent <CameraFollow>() != null)
     {
         Camera.main.GetComponent <CameraFollow>().stopCamera = false;
     }
 }
Exemple #21
0
    public GameColor SelectColor(ScenesType scene)
    {
        switch (scene)
        {
        case ScenesType.MONDAY:
            playerName = "mushroom";
            colorList.colorOfTileOne       = new Color(140 / 255f, 126 / 255f, 120 / 255f);
            colorList.colorOfTileTwo       = new Color(191 / 255f, 166 / 255f, 149 / 255f);
            colorList.colorOfWall          = new Color(193 / 255f, 104 / 255f, 93 / 255f);
            colorList.colorOfMeshRenderOne = new Color(239 / 255f, 83 / 255f, 80 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(239 / 255f, 154 / 255f, 154 / 255f);
            colorList.colorOfSpikes        = new Color(255 / 255f, 67 / 255f, 70 / 255f);
            break;

        case ScenesType.TUESDAY:
            playerName = "cheese";
            colorList.colorOfTileOne       = new Color(120 / 255f, 94 / 255f, 77 / 255f);
            colorList.colorOfTileTwo       = new Color(188 / 255f, 157 / 255f, 137 / 255f);
            colorList.colorOfWall          = new Color(255 / 255f, 146 / 255f, 52 / 255f);
            colorList.colorOfMeshRenderOne = new Color(111 / 255f, 56 / 255f, 38 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(232 / 255f, 170 / 255f, 140 / 255f);
            colorList.colorOfSpikes        = new Color(98 / 255f, 59 / 255f, 28 / 255f);
            break;

        case ScenesType.WENESDAY:
            playerName = "block";
            colorList.colorOfTileOne       = new Color(173 / 255f, 172 / 255f, 167 / 255f);
            colorList.colorOfTileTwo       = new Color(142 / 255f, 139 / 255f, 140 / 255f);
            colorList.colorOfWall          = new Color(47 / 255f, 48 / 255f, 50 / 255f);
            colorList.colorOfMeshRenderOne = new Color(47 / 255f, 48 / 255f, 50 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(140 / 255f, 126 / 255f, 120 / 255f);
            colorList.colorOfSpikes        = new Color(255 / 255f, 11 / 255f, 67 / 255f);
            break;

        case ScenesType.THURSDAY:
            playerName = "cube_sushi";
            colorList.colorOfTileOne       = new Color(56 / 255f, 68 / 255f, 56 / 255f);
            colorList.colorOfTileTwo       = new Color(204 / 255f, 187 / 255f, 161 / 255f);
            colorList.colorOfWall          = new Color(0 / 255f, 0 / 255f, 0 / 255f);
            colorList.colorOfMeshRenderOne = new Color(114 / 255f, 126 / 255f, 107 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(0 / 255f, 9 / 255f, 2 / 255f);
            colorList.colorOfSpikes        = new Color(255 / 255f, 168 / 255f, 0 / 255f);
            break;

        case ScenesType.FRIDAY:
            playerName = "cube_cake";
            colorList.colorOfTileOne       = new Color(206 / 255f, 136 / 255f, 136 / 255f);
            colorList.colorOfTileTwo       = new Color(188 / 255f, 117 / 255f, 117 / 255f);
            colorList.colorOfWall          = new Color(53 / 255f, 23 / 255f, 19 / 255f);
            colorList.colorOfMeshRenderOne = new Color(120 / 255f, 52 / 255f, 52 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(68 / 255f, 11 / 255f, 12 / 255f);
            colorList.colorOfSpikes        = new Color(60 / 255f, 0 / 255f, 0 / 255f);
            break;

        case ScenesType.SATERDAY:
            playerName = "cube_watermelon";
            colorList.colorOfTileOne       = new Color(255 / 255f, 189 / 255f, 196 / 255f);
            colorList.colorOfTileTwo       = new Color(227 / 255f, 102 / 255f, 102 / 255f);
            colorList.colorOfWall          = new Color(6 / 255f, 79 / 255f, 30 / 255f);
            colorList.colorOfMeshRenderOne = new Color(120 / 255f, 52 / 255f, 52 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(68 / 255f, 11 / 255f, 12 / 255f);
            colorList.colorOfSpikes        = new Color(43 / 255f, 24 / 255f, 0 / 255f);
            break;

        case ScenesType.SUNDAY:
            playerName = "cube_bread";
            colorList.colorOfTileOne       = new Color(152 / 255f, 94 / 255f, 56 / 255f);
            colorList.colorOfTileTwo       = new Color(186 / 255f, 134 / 255f, 101 / 255f);
            colorList.colorOfWall          = new Color(255 / 255f, 146 / 255f, 52 / 255f);
            colorList.colorOfMeshRenderOne = new Color(86 / 255f, 30 / 255f, 3 / 255f);
            colorList.colorOfMeshRenderTwo = new Color(232 / 255f, 170 / 255f, 140 / 255f);
            colorList.colorOfSpikes        = new Color(98 / 255f, 59 / 255f, 28 / 255f);
            break;
        }
        return(colorList);
    }
Exemple #22
0
 public LoadSceneCommand(MonoBehaviour monoBehaviourClass, ScenesType scenesType)
 {
     _monoBehaviourToRunCoroutine = monoBehaviourClass;
     _scenesType = scenesType;
 }
 private void OnSceneChanged(ScenesType type)
 {
     currentType = type;
 }
Exemple #24
0
 void sceneChanged(ScenesType newScene)
 {
     actualScene = newScene;
 }