Пример #1
0
    void PrepareSession()
    {
        if (sessionPrepared)
        {
            return;
        }
        bool activateEventTracker = false;

        switch (gameMode)
        {
        case GameMode.Survival:
        {
            uicontroller.ChangeUIMode(UIMode.Standart, true);
            difficulty = startSettings.DefineDifficulty();
            SetDefaultValues();
            var cgs         = startSettings.GetChunkGenerationSettings();
            var chunkAction = cgs.preparingActionMode;
            if (chunkAction != ChunkPreparingAction.NoAction)
            {
                if (chunkAction == ChunkPreparingAction.Load)
                {
                    LoadTerrain(SaveSystemUI.GetTerrainsPath() + '/' + cgs.GetTerrainName() + '.' + SaveSystemUI.TERRAIN_FNAME_EXTENSION);
                }
                else
                {
                    mainChunk = Constructor.ConstructChunk(cgs);
                    var slist = mainChunk.GetSurfaces();
                    if (slist != null)
                    {
                        geologyModule.SpreadMinerals(slist);
                    }
                    mainChunk.InitializeNature().FirstLifeformGeneration(Chunk.chunkSize * Chunk.chunkSize * 500f);
                }
            }
            //
            var fcm = FollowingCamera.main;
            fcm.CameraToStartPosition();
            fcm.ResetTouchRightBorder();
            fcm.CameraRotationBlock(false);
            warProximity   = 0.01f;
            layerCutHeight = Chunk.chunkSize; prevCutHeight = layerCutHeight;
            //
            switch (startSettings.DefineFoundingType())
            {
            case StartFoundingType.Zeppelin:
            {
                Zeppelin.CreateNew();
                AnnouncementCanvasController.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.SetLandingPoint));
                break;
            }

            case StartFoundingType.Headquarters:
            {
                Plane sb   = mainChunk.GetRandomSurface();
                int   xpos = sb.pos.x;
                int   zpos = sb.pos.z;

                Structure s;
                if (testMode)
                {
                    s = HeadQuarters.GetHQ(6);
                    weNeedNoResources = true;
                }
                else
                {
                    weNeedNoResources = false;
                    s = HeadQuarters.GetHQ(1);
                }

                Plane b = mainChunk.GetHighestSurfacePlane(xpos, zpos);
                s.SetBasement(b, PixelPosByte.zero);


                sb = mainChunk.GetNearestUnoccupiedSurface(b.pos);
                StorageHouse firstStorage = Structure.GetStructureByID(Structure.STORAGE_0_ID) as StorageHouse;
                firstStorage.SetBasement(sb, PixelPosByte.zero);
                SetStartResources();
                break;
            }
            }
            fcm.WeNeedUpdate();
            activateEventTracker = true;
            break;
        }

        case GameMode.Editor:
        {
            uicontroller.ChangeUIMode(UIMode.Editor, true);
            mainChunk = new GameObject("chunk").AddComponent <Chunk>();
            int size = Chunk.chunkSize;
            int[,,] blocksArray = new int[size, size, size];
            size /= 2;
            blocksArray[size, size, size] = ResourceType.STONE_ID;
            mainChunk.Rebuild(blocksArray);
            FollowingCamera.main.CameraToStartPosition();
            break;
        }

        case GameMode.Scenario:
        {
            uicontroller.ChangeUIMode(UIMode.Standart, true);
            switch (startSettings.GetScenarioType())
            {
            case ScenarioType.Embedded:
            {
                switch ((EmbeddedScenarioType)startSettings.GetSecondSubIndex())
                {
                case EmbeddedScenarioType.Tutorial:
                {
                    gameRules = GameRules.GetTutorialRules();
                    LoadTerrainFromAssets(TutorialScenarioNS.TutorialScenario.tutorialTerrainName);
                    TutorialScenarioNS.TutorialUI.Initialize();
                    break;
                }
                }
                break;
            }
            }
            activateEventTracker = true;
            FollowingCamera.main.CameraToStartPosition();
            break;
        }
        }
        if (activateEventTracker)
        {
            eventTracker = new EventChecker();
        }

        startSettings   = null;
        sessionPrepared = true;
        if (testMode)
        {
            AnnouncementCanvasController.MakeAnnouncement("game master loaded");
        }
        autosaveTimer = AUTOSAVE_TIME;
    }
Пример #2
0
 public override void OKButton()
 {
     GameMaster.realMaster.eventTracker.buildingConstructionEvent += this.BuildingCheck;
     Zeppelin.CreateNew();
 }
Пример #3
0
 // Start is called before the first frame update
 void Awake()
 {
     zeppelin = GetComponent <Zeppelin>();
     thruster = GameObject.Find("Not the Balloon Part").GetComponent <PropellerThrust>();
 }