public void LoadWorld(int n)
    {
        if (System.IO.File.Exists(GetWorldFilePath(n)))
        {
            gameManagerUnity.DestroyWorld();

            AvailableConfigurations configurations = GameManagerUnity.LoadConfiguration();

            gameManagerUnity.LoadCustomTextures();

            byte[] data = System.IO.File.ReadAllBytes(GetWorldFilePath(n));

            CubeWorld.Configuration.Config config = new CubeWorld.Configuration.Config();
            config.tileDefinitions   = configurations.tileDefinitions;
            config.itemDefinitions   = configurations.itemDefinitions;
            config.avatarDefinitions = configurations.avatarDefinitions;
            config.extraMaterials    = configurations.extraMaterials;

            gameManagerUnity.extraMaterials = config.extraMaterials;

            gameManagerUnity.world = new CubeWorld.World.CubeWorld(gameManagerUnity.objectsManagerUnity, gameManagerUnity.fxManagerUnity);
            gameManagerUnity.world.Load(config, data);
            worldGeneratorProcess = null;

            gameManagerUnity.surroundingsUnity.CreateSurroundings(gameManagerUnity.world.configSurroundings);

            gameManagerUnity.State = GameManagerUnity.GameManagerUnityState.GENERATING;
        }
    }
    public CWFxManagerUnity(GameManagerUnity gameManagerUnity)
    {
        this.gameManagerUnity = gameManagerUnity;

        goContainer = new GameObject();
        goContainer.name = "FxContainer";

        effects["explosion"] = Resources.Load("Effects/FxExplosion", typeof(GameObject)) as GameObject;
        sounds["explosion"] = new AudioClip[] { Resources.Load("Effects/SoundExplosion", typeof(AudioClip)) as AudioClip };
        sounds["hitmetal"] = new AudioClip[] { Resources.Load("Effects/SoundHitMetal", typeof(AudioClip)) as AudioClip, Resources.Load("Effects/SoundHitMetal2", typeof(AudioClip)) as AudioClip };
        sounds["hit"] = new AudioClip[] { Resources.Load("Effects/SoundHit", typeof(AudioClip)) as AudioClip };
        effectsComponents["vibration"] = typeof(FxVibration);
    }
    public CWFxManagerUnity(GameManagerUnity gameManagerUnity)
    {
        this.gameManagerUnity = gameManagerUnity;

        goContainer      = new GameObject();
        goContainer.name = "FxContainer";

        effects["explosion"]           = Resources.Load("Effects/FxExplosion", typeof(GameObject)) as GameObject;
        sounds["explosion"]            = new AudioClip[] { Resources.Load("Effects/SoundExplosion", typeof(AudioClip)) as AudioClip };
        sounds["hitmetal"]             = new AudioClip[] { Resources.Load("Effects/SoundHitMetal", typeof(AudioClip)) as AudioClip, Resources.Load("Effects/SoundHitMetal2", typeof(AudioClip)) as AudioClip };
        sounds["hit"]                  = new AudioClip[] { Resources.Load("Effects/SoundHit", typeof(AudioClip)) as AudioClip };
        effectsComponents["vibration"] = typeof(FxVibration);
    }
        public override bool Generate(CubeWorld.World.CubeWorld world)
        {
            mutiplayerClientGameplay.Update(0.0f);

            if (mutiplayerClientGameplay.initializationDataReceived)
            {
                GameManagerUnity gameManagerUnity = worldManagerUnity.gameManagerUnity;

                gameManagerUnity.world          = new CubeWorld.World.CubeWorld(gameManagerUnity.objectsManagerUnity, gameManagerUnity.fxManagerUnity);
                gameManagerUnity.world.gameplay = mutiplayerClientGameplay;

                CubeWorld.World.CubeWorld.MultiplayerConfig config = gameManagerUnity.world.LoadMultiplayer(mutiplayerClientGameplay.initializationData);

                mutiplayerClientGameplay.initializationData = null;

                gameManagerUnity.extraMaterials = config.extraMaterials;
                gameManagerUnity.surroundingsUnity.CreateSurroundings(gameManagerUnity.world.configSurroundings);

                return(true);
            }

            return(false);
        }
 public WorldManagerUnity(GameManagerUnity gameManagerUnity)
 {
     this.gameManagerUnity = gameManagerUnity;
 }
Example #6
0
 public MainMenu(GameManagerUnity gameManagerUnity)
 {
     this.gameManagerUnity = gameManagerUnity;
 }
Example #7
0
    void DrawGenerator()
    {
        if (availableConfigurations == null)
        {
            availableConfigurations = GameManagerUnity.LoadConfiguration();
            currentDayInfoOffset    = 0;
            currentGeneratorOffset  = 0;
            currentSizeOffset       = 0;
            currentGameplayOffset   = 0;
        }

        MenuSystem.BeginMenu("Random World Generator");

        MenuSystem.Button("Gameplay: " + GameplayFactory.AvailableGameplays[currentGameplayOffset].name, delegate()
        {
            currentGameplayOffset = (currentGameplayOffset + 1) % GameplayFactory.AvailableGameplays.Length;
        }
                          );

        MenuSystem.Button("World Size: " + availableConfigurations.worldSizes[currentSizeOffset].name, delegate()
        {
            currentSizeOffset = (currentSizeOffset + 1) % availableConfigurations.worldSizes.Length;
        }
                          );

        MenuSystem.Button("Day Length: " + availableConfigurations.dayInfos[currentDayInfoOffset].name, delegate()
        {
            currentDayInfoOffset = (currentDayInfoOffset + 1) % availableConfigurations.dayInfos.Length;
        }
                          );

        if (GameplayFactory.AvailableGameplays[currentGameplayOffset].hasCustomGenerator == false)
        {
            MenuSystem.Button("Generator: " + availableConfigurations.worldGenerators[currentGeneratorOffset].name, delegate()
            {
                currentGeneratorOffset = (currentGeneratorOffset + 1) % availableConfigurations.worldGenerators.Length;
            }
                              );
        }

#if !UNITY_WEBPLAYER
        MenuSystem.Button("Host Multiplayer: " + (multiplayer ? "Yes" : "No"), delegate()
        {
            multiplayer = !multiplayer;
        }
                          );
#endif

        MenuSystem.LastButton("Generate!", delegate()
        {
            lastConfig = new CubeWorld.Configuration.Config();
            lastConfig.tileDefinitions   = availableConfigurations.tileDefinitions;
            lastConfig.itemDefinitions   = availableConfigurations.itemDefinitions;
            lastConfig.avatarDefinitions = availableConfigurations.avatarDefinitions;
            lastConfig.dayInfo           = availableConfigurations.dayInfos[currentDayInfoOffset];
            lastConfig.worldGenerator    = availableConfigurations.worldGenerators[currentGeneratorOffset];
            lastConfig.worldSize         = availableConfigurations.worldSizes[currentSizeOffset];
            lastConfig.extraMaterials    = availableConfigurations.extraMaterials;
            lastConfig.gameplay          = GameplayFactory.AvailableGameplays[currentGameplayOffset];

#if !UNITY_WEBPLAYER
            if (multiplayer)
            {
                MultiplayerServerGameplay multiplayerServerGameplay = new MultiplayerServerGameplay(lastConfig.gameplay.gameplay, true);

                GameplayDefinition g = new GameplayDefinition("", "", multiplayerServerGameplay, false);

                lastConfig.gameplay = g;

                gameManagerUnity.RegisterInWebServer();
            }
#endif

            gameManagerUnity.worldManagerUnity.CreateRandomWorld(lastConfig);

            availableConfigurations = null;

            state = MainMenuState.NORMAL;
        }
                              );

        MenuSystem.EndMenu();
    }
	public CWObjectsManagerUnity (GameManagerUnity gameManagerUnity)
	{
		this.gameManagerUnity = gameManagerUnity;
	}
	public SectorManagerUnity (GameManagerUnity gameManagerUnity)
	{
		this.gameManagerUnity = gameManagerUnity;
	}
 public WorldManagerUnity(GameManagerUnity gameManagerUnity)
 {
     this.gameManagerUnity = gameManagerUnity;
 }
 public CWObjectsManagerUnity(GameManagerUnity gameManagerUnity)
 {
     this.gameManagerUnity = gameManagerUnity;
 }
Example #12
0
 public MainMenu(GameManagerUnity gameManagerUnity)
 {
     this.gameManagerUnity = gameManagerUnity;
 }
Example #13
0
 public SectorManagerUnity(GameManagerUnity gameManagerUnity)
 {
     this.gameManagerUnity = gameManagerUnity;
 }