Exemplo n.º 1
0
 public World(int exSystemID, WorldType worldTypeID, long languageID, string name)
 {
     this._languageID = languageID;
     this._name = name;
     this._exSystemID = exSystemID;
     this._worldTypeID = worldTypeID;
 }
 public static LevelClearState? Get(WorldType world, Level level)
 {
     var key = MakeKey(world, level);
     if (!PlayerPrefs.HasKey(key))
         return null;
     return (LevelClearState)Enum.Parse(typeof (LevelClearState), PlayerPrefs.GetString(key));
 }
        public void SetWorld(WorldType type)
        {
            World = type;

            var data = DB._.GetWorld(type);
            _image.sprite = data.LoadSprite();
        }
        public void SetWorld(WorldType type)
        {
            World = type;

            var data = DB._.GetWorld(type);
            _worldName.text = data.Name;
        }
        private WorldButton SpawnWorldButton(WorldType world)
        {
            var go = Instantiate(_worldButtonPrf.gameObject);
            go.transform.SetParent(_worldContent, false);

            var button = go.GetComponent<WorldButton>();
            button.SetWorld(world);

            return button;
        }
Exemplo n.º 6
0
        public World_ GetWorld(WorldType type)
        {
            var typeInt = (int)type - 1;
            if (typeInt < 0 || typeInt >= World.Count)
            {
                Debug.LogError("Trying to access World of index: " + typeInt);
                return World[0];
            }

            return World[(int)type - 1];
        }
    // Use this for initialization
    void Awake()
    {
        instance = this;
        WorldType[] worlds = gameObject.GetComponentsInChildren<WorldType>();

        System.Random gen = new System.Random();
        bulletWorld = worlds[gen.Next(worlds.Length)];
        enemyWorld = worlds[gen.Next(worlds.Length)];
        friendlyWorld = worlds[gen.Next(worlds.Length)];

        startText = populateText(flavorTexts[gen.Next(flavorTexts.Length)]);
    }
Exemplo n.º 8
0
        public BaseWorldReversion()
        {
            mPreviousCheatOverride = GameUtils.CheatOverrideCurrentWorld;
            mPreviousWorldType = GameUtils.GetCurrentWorldType();

            switch (mPreviousWorldType)
            {
                case WorldType.Vacation:
                case WorldType.University:
                case WorldType.Future:
                    GameUtils.CheatOverrideCurrentWorld = GameUtils.GetCurrentWorld();

                    GameUtils.WorldNameToType[GameUtils.CheatOverrideCurrentWorld] = WorldType.Base;

                    mAltered = true;
                    break;
            }
        }
 private static string MakeKey(WorldType world, Level level)
 {
     return "LevelClear." + world.ToNumber() + "_" + level.ToNumber();
 }
 public static void Set(WorldType world, Level level, LevelClearState state)
 {
     PlayerPrefs.SetString(MakeKey(world, level), state.ToString());
 }
Exemplo n.º 11
0
 public World(string levelSelectorScene, WorldType worldType, int levelAmount)
 {
     this.levelSelectorScene = levelSelectorScene;
     this.worldType = worldType;
     this.levelAmount = levelAmount;
 }
 public WorldAndLevel(WorldType world, Level level)
 {
     World = world;
     Level = level;
 }
Exemplo n.º 13
0
        private void Client_EntitySystemService_WorldCreateBegin(EntitySystemClientNetworkService sender,
            WorldType worldType, string mapVirtualFileName)
        {
            //close all windows
            foreach (Control control in controlManager.Controls)
                control.SetShouldDetach();

            //show map loading window
            if (!string.IsNullOrEmpty(mapVirtualFileName))
            {
                string mapDirectory = Path.GetDirectoryName(mapVirtualFileName);
                string guiPath = Path.Combine(mapDirectory, "Description\\MapLoadingWindow.gui");
                if (!VirtualFile.Exists(guiPath))
                    guiPath = "Gui\\MapLoadingWindow.gui";
                Control mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl(guiPath);
                if (mapLoadingWindow != null)
                {
                    mapLoadingWindow.Text = mapVirtualFileName;
                    controlManager.Controls.Add(mapLoadingWindow);
                }

                client_mapLoadingWindow = mapLoadingWindow;
            }

            RenderScene();

            DeleteAllGameWindows();

            MapSystemWorld.MapDestroy();

            //unload all reloadable textures
            TextureManager.Instance.UnloadAll(true, false);

            if (!EntitySystemWorld.Instance.WorldCreate(WorldSimulationTypes.ClientOnly,
                worldType, sender.NetworkingInterface))
            {
                Log.Fatal("GameEngineApp: Client_EntitySystemService_WorldCreateBegin: " +
                    "EntitySystemWorld.WorldCreate failed.");
            }
        }
Exemplo n.º 14
0
        public bool ServerOrSingle_MapLoad(string fileName, WorldType worldType,
            bool noChangeWindows)
        {
            GameNetworkServer server = GameNetworkServer.Instance;

            Control mapLoadingWindow = null;

            //show map loading window
            if (!noChangeWindows)
            {
                string mapDirectory = Path.GetDirectoryName(fileName);
                string guiPath = Path.Combine(mapDirectory, "Description\\MapLoadingWindow.gui");
                if (!VirtualFile.Exists(guiPath))
                    guiPath = "Gui\\MapLoadingWindow.gui";
                mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl(guiPath);
                if (mapLoadingWindow != null)
                {
                    mapLoadingWindow.Text = fileName;
                    controlManager.Controls.Add(mapLoadingWindow);
                }
            }

            DeleteAllGameWindows();

            bool mapWasDestroyed = Map.Instance != null;

            MapSystemWorld.MapDestroy();

            if (server != null)
            {
                //destroy world for server
                if (EntitySystemWorld.Instance != null)
                    EntitySystemWorld.Instance.WorldDestroy();

                if (mapWasDestroyed)
                    server.EntitySystemService.WorldWasDestroyed(true);
            }

            //update sound listener
            //SoundWorld.Instance.SetListener(new Vec3(10000, 10000, 10000), Vec3.Zero, Vec3.XAxis, Vec3.ZAxis);
            if (SoundWorld.Instance != null)
                SoundWorld.Instance.SetListener(new Vec3(1, 1, 1), Vec3.Zero, Vec3.XAxis, Vec3.ZAxis);

            if (!noChangeWindows)
                RenderScene();

            //unload all reloadable textures
            TextureManager.Instance.UnloadAll(true, false);

            //create world if need
            if (World.Instance == null || World.Instance.Type != worldType)
            {
                WorldSimulationTypes worldSimulationType;
                EntitySystemWorld.NetworkingInterface networkingInterface = null;

                if (server != null)
                {
                    worldSimulationType = WorldSimulationTypes.ServerAndClient;
                    networkingInterface = server.EntitySystemService.NetworkingInterface;
                }
                else
                    worldSimulationType = WorldSimulationTypes.Single;

                if (!EntitySystemWorld.Instance.WorldCreate(worldSimulationType, worldType,
                    networkingInterface))
                {
                    Log.Fatal("GameEngineApp: MapLoad: EntitySystemWorld.WorldCreate failed.");
                }
            }

            //Subcribe to callbacks during map loading. We will render scene from callback.
            LongOperationCallbackManager.Subscribe(LongOperationCallbackManager_LoadingCallback,
                mapLoadingWindow);

            //load map
            if (!MapSystemWorld.MapLoad(fileName))
            {
                if (mapLoadingWindow != null)
                    mapLoadingWindow.SetShouldDetach();

                LongOperationCallbackManager.Unsubscribe();

                return false;
            }

            //inform clients about world created
            if (server != null)
                server.EntitySystemService.WorldWasCreated();

            //Simulate physics for 5 seconds. That the physics has fallen asleep.
            if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle())
                SimulatePhysicsForLoadedMap(5);

            //Update fog and shadow settings. This operation can be slow because need update all
            //shaders if fog type or shadow technique changed.
            Map.Instance.UpdateSceneManagerFogAndShadowSettings();

            //Ensure that all materials are fully initialized.
            ShaderBaseMaterial.FinishInitializationOfEmptyMaterials();

            ActivateScreenFadingIn();

            LongOperationCallbackManager.Unsubscribe();

            //Error
            foreach (Control control in controlManager.Controls)
            {
                if (control is MessageBoxWindow && !control.IsShouldDetach())
                    return false;
            }
            if (GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
            {
                if (!noChangeWindows)
                {
                    //CreateGameWindowForMap();

                    //add spawn window
                    foreach (Control control in controlManager.Controls)
                        control.SetShouldDetach();

                    controlManager.Controls.Add(new PlayerSpawnWindow());
                }
            }
            else
            {
                if (!noChangeWindows)
                    CreateGameWindowForMap();
            }

            //play music
            if (!noChangeWindows)
            {
                if (GameMap.Instance != null)
                    GameMusic.MusicPlay(GameMap.Instance.GameMusic, true);
            }

            EntitySystemWorld.Instance.ResetExecutedTime();

            return true;
        }
Exemplo n.º 15
0
    /*Create a simple world*/
    private bool LoadSingleCreate(WorldType world)
    {
        //	SpaceCell spaceSystem = new SpaceCell (new Vector3 (-100, -100, -100),new Vector3 (100, 100, 100), null);

        //Create a couple of objects.
        GameObject newObj;

        newObj = GameObject.Instantiate (Resources.Load ("World")) as GameObject;
        newObj.transform.position = new Vector3 (0, 0, 0);
        newObj.name = "World";

        GameObject path = new GameObject ();
        path.AddComponent<SpacePath> ();
        path.name = "SpacePath";

        newObj = GameObject.Instantiate (Resources.Load ("SpaceScene")) as GameObject;
        newObj.transform.position = new Vector3 (0, 0, 0);
        newObj.name = "SpaceScene";

        newObj = GameObject.Instantiate (Resources.Load ("DebugCursorConsole")) as GameObject;
        newObj.transform.position = new Vector3 (0, 0, 0);
        newObj.name = "DebugCursorConsole";

        newObj = GameObject.Instantiate (Resources.Load ("SystemLight")) as GameObject;
        newObj.transform.position = new Vector3 (0, 0, 0);
        newObj.name = "SystemLight";
        //path.GetComponent<SpacePath>().GetLastPoint();

        newObj = GameObject.Instantiate (Resources.Load ("Environment/WarpOrb")) as GameObject;
        newObj.transform.position = new Vector3 (4000, 0, 0);
        newObj.name = "WarpOrb";

        //Actors in the scene
        for (int i =0; i < 100; i++)
        {
            float tZ = UnityEngine.Random.Range (-150, 150);
            float tY = UnityEngine.Random.Range (-1, 1);
            float rX = UnityEngine.Random.Range (0, 360);
            float rY = UnityEngine.Random.Range (0, 360);
            float rz = UnityEngine.Random.Range (0, 360);
            float pos = UnityEngine.Random.Range (100, 4000);

        //	newObj = CompoundObjectFactory.Create("Asteroid "+i,CompoundObjectFactory.COType.Asteroid) as GameObject;
        //	newObj.transform.position = new Vector3 (pos, 4,tZ );
            //newObj.transform.rotation.eulerAngles = new Vector3(rX,rY,rz);
            newObj.transform.rotation = Quaternion.Euler(rX,rY,rz);
             pos = UnityEngine.Random.Range (100, 4000);
             tZ = UnityEngine.Random.Range (-150, 150);
             tY = UnityEngine.Random.Range (-1, 1);
            newObj = CompoundObjectFactory.Create("SpaceCloudExample ",CompoundObjectFactory.COType.Cloud) as GameObject;
            newObj.transform.position = new Vector3 (pos, 4, tZ);
        }
        newObj = CompoundObjectFactory.Create("Robot",CompoundObjectFactory.COType.Player) as GameObject;
        newObj.transform.position = new Vector3 (10, 0, 0);

        if(world == WorldType.dev_engineTest)
        {
            GameObject engineTest = GameObject.Instantiate(Resources.Load("Debug/EngineTest")) as GameObject;
            engineTest.transform.parent = newObj.transform;//.transform.FindChild("Body").gameObject;
        }

        return true;
    }
Exemplo n.º 16
0
        void Client_EntitySystemService_WorldCreateBegin( EntitySystemClientNetworkService sender,
            WorldType worldType, string mapVirtualFileName)
        {
            //show map loading window
            EControl mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\MapLoadingWindow.gui" );
            if( mapLoadingWindow != null )
            {
                mapLoadingWindow.Text = mapVirtualFileName;
                controlManager.Controls.Add( mapLoadingWindow );
            }
            RenderScene();

            DeleteAllGameWindows();

            MapSystemWorld.MapDestroy();

            if( !EntitySystemWorld.Instance.WorldCreate( WorldSimulationTypes.ClientOnly,
                worldType, sender.NetworkingInterface ) )
            {
                Log.Fatal( "GameEngineApp: Client_EntitySystemService_WorldCreateBegin: " +
                    "EntitySystemWorld.WorldCreate failed." );
            }
        }
Exemplo n.º 17
0
        public bool ServerOrSingle_MapLoad( string fileName, WorldType worldType,
            bool noChangeWindows)
        {
            GameNetworkServer server = GameNetworkServer.Instance;

            EControl mapLoadingWindow = null;

            //show map loading window
            if( !noChangeWindows )
            {
                mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl(
                    "Gui\\MapLoadingWindow.gui" );
                if( mapLoadingWindow != null )
                {
                    mapLoadingWindow.Text = fileName;
                    controlManager.Controls.Add( mapLoadingWindow );
                }
                RenderScene();
            }

            DeleteAllGameWindows();

            MapSystemWorld.MapDestroy();

            //create world if need
            if( World.Instance == null || World.Instance.Type != worldType )
            {
                WorldSimulationTypes worldSimulationType;
                EntitySystemWorld.NetworkingInterface networkingInterface = null;

                if( server != null )
                {
                    worldSimulationType = WorldSimulationTypes.ServerAndClient;
                    networkingInterface = server.EntitySystemService.NetworkingInterface;
                }
                else
                    worldSimulationType = WorldSimulationTypes.Single;

                if( !EntitySystemWorld.Instance.WorldCreate( worldSimulationType, worldType,
                    networkingInterface ) )
                {
                    Log.Fatal( "GameEngineApp: MapLoad: EntitySystemWorld.WorldCreate failed." );
                }
            }

            //load map
            if( !MapSystemWorld.MapLoad( fileName ) )
            {
                if( mapLoadingWindow != null )
                    mapLoadingWindow.SetShouldDetach();
                return false;
            }

            //inform clients about world created
            if( server != null )
                server.EntitySystemService.InformClientsAfterWorldCreated();

            //Simulate physics for 5 seconds. That the physics has fallen asleep.
            if( EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle() )
                SimulatePhysicsForLoadedMap( 5 );

            //Error
            foreach( EControl control in controlManager.Controls )
            {
                if( control is MessageBoxWindow && !control.IsShouldDetach() )
                    return false;
            }

            if( !noChangeWindows )
                CreateGameWindowForMap();

            //play music
            if( !noChangeWindows )
            {
                if( GameMap.Instance != null )
                    GameMusic.MusicPlay("Sounds//Music//Ants.ogg", true);
                    //GameMusic.MusicPlay( GameMap.Instance.GameMusic, true );
            }

            EntitySystemWorld.Instance.ResetExecutedTime();

            return true;
        }
Exemplo n.º 18
0
 public GenLayerBiome(long seed, GenLayer parentGenLayer, WorldType worldType, string biomeAttriStr) : base(seed)
 {
     parent         = parentGenLayer;
     field_175973_g = null;
 }
 public TransitionData(WorldType world)
 {
     World = world;
 }
Exemplo n.º 20
0
        public bool MapLoad( string fileName, WorldType worldType, bool noChangeWindows )
        {
            EControl mapLoadingWindow = null;

            if( !noChangeWindows )
            {
                mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl(
                    "Gui\\MapLoadingWindow.gui" );
                if( mapLoadingWindow != null )
                {
                    mapLoadingWindow.Text = fileName;
                    ScreenControlManager.Instance.Controls.Add( mapLoadingWindow );
                }
                RenderScene();
            }

            //delete all GameWindow's
            DeleteAllGameWindows();

            MapSystemWorld.MapDestroy();

            WorldType needWorldType = worldType;
            if( needWorldType == null )
                needWorldType = GetWorldType();

            if( World.Instance == null || World.Instance.Type != needWorldType )
            {
                if( needWorldType == null )
                {
                    if( mapLoadingWindow != null )
                        mapLoadingWindow.SetShouldDetach();
                    return false;
                }

                if( !EntitySystemWorld.Instance.WorldCreate( WorldSimulationType.Single,
                    needWorldType ) )
                {
                    Log.Fatal( "EntitySystemWorld.Instance.WorldCreate failed." );
                }
            }

            if( !MapSystemWorld.MapLoad( fileName ) )
            {
                if( mapLoadingWindow != null )
                    mapLoadingWindow.SetShouldDetach();
                return false;
            }

            //Simulate physics for 5 seconds. That the physics has fallen asleep.
            if( PhysicsWorld.Instance != null )
            {
                PhysicsWorld.Instance.EnableCollisionEvents = false;

                const float seconds = 5;

                for( float time = 0; time < seconds; time += Entity.TickDelta )
                {
                    PhysicsWorld.Instance.Simulate( Entity.TickDelta );

                    //WaterPlane specific
                    foreach( WaterPlane waterPlane in WaterPlane.Instances )
                        waterPlane.TickPhysicsInfluence( false );
                }

                PhysicsWorld.Instance.EnableCollisionEvents = true;
            }

            //Error
            foreach( EControl control in ScreenControlManager.Instance.Controls )
            {
                if( control is MessageBoxWindow )
                    return false;
            }

            if( !noChangeWindows )
                CreateGameWindowForMap();

            //play music
            if( string.Compare( fileName, "Maps\\MainMenu\\Map.map", true ) != 0 )
                GameMusic.MusicPlay("Sounds\\Vietheroes\\NewLegend.mp3", true);

            return true;
        }
Exemplo n.º 21
0
        void Client_EntitySystemService_WorldCreateBegin( EntitySystemClientNetworkService sender,
			WorldType worldType, string mapVirtualFileName )
        {
            MapSystemWorld.MapDestroy();

            if( !EntitySystemWorld.Instance.WorldCreate( WorldSimulationTypes.ClientOnly,
                worldType, sender.NetworkingInterface ) )
            {
                Log.Fatal( "GameEngineApp: Client_EntitySystemService_WorldCreateBegin: " +
                    "EntitySystemWorld.WorldCreate failed." );
            }
        }
Exemplo n.º 22
0
 public LevelDef(WorldType world, Level level, Difficulty difficulty)
 {
     World = world;
     Level = level;
     Difficulty = difficulty;
 }
 public YieldModifyingSMFR(WorldType worldType, Key key, TileYieldModifierPriority tileModifierPriority) : base(worldType, key)
 {
     _tileModifierPriority = tileModifierPriority;
 }
Exemplo n.º 24
0
 public void LoadWorld(WorldType world)
 {
     WorldTeardown ();
     LoadSingleCreate(world);
 }