Beispiel #1
0
    private void OnLoadHellLevel(ref LifeComponent playerLife)
    {
        //Keep hand on CurrentWeapon / Map
        WeaponTypeToGoBackTo = GameVariables.Player.CurrentWeaponHeld;
        LastMap = EventsHolder.LevelEvents.CurrentLevel;

        FadeSystem.OnFadeEnd += () =>
        {
            //Toggle PlayerWeapons
            SwapWeaponSystem.SwapWeaponBetweenWorld(WeaponType.HellShotgun, LastMap,
                                                    MapType.Level_Hell);
        };

        ChangeWorldDelaySystem.OnChangeWorld += () =>
        {
            //Start HellWorldSystem
            World.GetExistingSystem <HellWorldSystem>().Enabled = true;

            //Set UI info
            UIManager.ResetPlayerHealth();
            UIManager.ToggleHellTimers(true);
            UIManager.SetWeaponType(WeaponType.HellShotgun);
        };

        //Reset Player Life
        playerLife.Reset();
        EntityManager.SetComponentData(GameVariables.Player.Entity, playerLife);

        //Set new MapType
        MapEvents.LoadMap(MapType.Level_Hell, true);

        //??
        EventsHolder.LevelEvents.LevelEvent = LevelInfo.LevelEventType.OnStart;
    }
        public static void RestartGame()
        {
            EntityManager manager = World.DefaultGameObjectInjectionWorld.EntityManager;

            //Toggle PlayerWeapons
            ChangeWorldDelaySystem.OnChangeWorld += () =>
            {
                //Reset UI
                UIManager.ResetPlayerHealth();
                UIManager.ToggleHellTimers(false);
            };

            //Reset Life
            LifeComponent playerLife = manager.GetComponentData <LifeComponent>(GameVariables.Player.Entity);

            playerLife.Reset();
            manager.SetComponentData(GameVariables.Player.Entity, playerLife);
            //Reset Weapons ammo
            WeaponInitializer.Initialize();
            UIManager.ReloadAllWeapons();
            UIManager.SetWeaponType(WeaponType.Pistol);
            //Reset Death count
            //TODO
            //Load Menu MapType
            MapEvents.LoadMap(MapType.LevelMenu, true);
        }
Beispiel #3
0
    private static void OnEnterPortal(InteractableInfo info)
    {
#if UNITY_EDITOR
        Debug.Log("Entered Portal");
#endif
        //Get PortalComponent
        PortalData data =
            World.DefaultGameObjectInjectionWorld.EntityManager
            .GetComponentData <PortalData>(info.TriggerEntity);

        //Get PortalInfo
        MapInfo.Portal portal = MapHolder.MapsInfo[MapEvents.CurrentTypeLoaded].Portals[data.Value];

        if (!TryEnterPortal(portal.MapTypeLeadingTo, portal.PortalIdLeadingTo))
        {
#if UNITY_EDITOR
            Debug.Log("The Portal ur trying to teleport to doesnt exist yet...");
#endif
            return;
        }

        //Get PortalInfo of other map
        MapInfo.Portal objectivePortal = MapHolder.MapsInfo[portal.MapTypeLeadingTo].Portals[portal.PortalIdLeadingTo];

        //Change Map
        MapEvents.LoadMap(portal.MapTypeLeadingTo);

        //Set player position/rotation
        GlobalEvents.PlayerEvents.SetPlayerPosition(objectivePortal.Position);
        GlobalEvents.PlayerEvents.SetPlayerRotation(objectivePortal.Rotation);
    }
        public static void StartHellLevel(int difficulty, int deathCount)
        {
            //TODO explain to player he needs to survive X amount of time to respawn
#if UNITY_EDITOR
            Debug.Log("Current Difficulty : " + difficulty + ", Current Death Count : " + deathCount);
#endif

            //TODO start Soundtrack for hell level
            MapEvents.LoadMap(MapType.Level_Hell, true);
            UIManager.ResetPlayerHealth();
        }
Beispiel #5
0
    public static void OnExitHellLevel()
    {
        //Set UI info
        UIManager.ResetPlayerHealth();
        UIManager.ToggleHellTimers(false);

        FadeSystem.OnFadeEnd += () =>
        {
            //Toggle PlayerWeapons
            SwapWeaponSystem.SwapWeaponBetweenWorld(WeaponTypeToGoBackTo, MapType.Level_Hell, LastMap);
        };

        ChangeWorldDelaySystem.OnChangeWorld += () =>
        {
            //Set UI info
            UIManager.ResetPlayerHealth();
            UIManager.SetWeaponType(WeaponTypeToGoBackTo);
        };

        //Set new MapType
        MapEvents.LoadMap(LastMap, true);
    }