コード例 #1
0
ファイル: MicrobeStage.cs プロジェクト: luminarium/Thrive
    public void ResolveNodeReferences()
    {
        if (NodeReferencesResolved)
        {
            return;
        }

        world       = GetNode <Node>("World");
        HUD         = GetNode <MicrobeHUD>("MicrobeHUD");
        tutorialGUI = GetNode <MicrobeTutorialGUI>("TutorialGUI");
        rootOfDynamicallySpawned = GetNode <Node>("World/DynamicallySpawned");
        Camera       = world.GetNode <MicrobeCamera>("PrimaryCamera");
        Clouds       = world.GetNode <CompoundCloudSystem>("CompoundClouds");
        worldLight   = world.GetNode <DirectionalLight>("WorldLight");
        guidanceLine = GetNode <GuidanceLine>(GuidanceLinePath);
        pauseMenu    = GetNode <PauseMenu>(PauseMenuPath);

        // These need to be created here as well for child property save load to work
        TimedLifeSystem = new TimedLifeSystem(rootOfDynamicallySpawned);
        ProcessSystem   = new ProcessSystem(rootOfDynamicallySpawned);
        microbeAISystem = new MicrobeAISystem(rootOfDynamicallySpawned);
        FluidSystem     = new FluidSystem(rootOfDynamicallySpawned);
        spawner         = new SpawnSystem(rootOfDynamicallySpawned);

        NodeReferencesResolved = true;
    }
コード例 #2
0
 public PatchManager(SpawnSystem spawnSystem, ProcessSystem processSystem,
                     CompoundCloudSystem compoundCloudSystem, TimedLifeSystem timedLife, DirectionalLight worldLight,
                     GameProperties currentGame)
 {
     this.spawnSystem         = spawnSystem;
     this.processSystem       = processSystem;
     this.compoundCloudSystem = compoundCloudSystem;
     this.timedLife           = timedLife;
     this.worldLight          = worldLight;
     this.currentGame         = currentGame;
 }
コード例 #3
0
    public PatchManager(SpawnSystem spawnSystem, ProcessSystem processSystem,
                        CompoundCloudSystem compoundCloudSystem, TimedLifeSystem timedLife,
                        DirectionalLight worldLight, GameProperties currentGame)
    {
        this.spawnSystem         = spawnSystem;
        this.processSystem       = processSystem;
        this.compoundCloudSystem = compoundCloudSystem;
        this.timedLife           = timedLife;
        this.worldLight          = worldLight;

        CloudSpawner   = new CompoundCloudSpawner(compoundCloudSystem);
        ChunkSpawner   = new ChunkSpawner(compoundCloudSystem);
        MicrobeSpawner = new MicrobeSpawner(compoundCloudSystem, currentGame);
    }
コード例 #4
0
ファイル: MicrobeStage.cs プロジェクト: ichabodphage/Thrive
    public override void _Process(float delta)
    {
        FluidSystem.Process(delta);
        TimedLifeSystem.Process(delta);
        ProcessSystem.Process(delta);
        microbeAISystem.Process(delta);

        if (gameOver)
        {
            // Player is extinct and has lost the game
            // Show the game lost popup if not already visible
            HUD.ShowExtinctionBox();

            return;
        }

        if (Player != null)
        {
            spawner.Process(delta, Player.Translation);
            Clouds.ReportPlayerPosition(Player.Translation);
        }
        else
        {
            if (!spawnedPlayer)
            {
                GD.PrintErr("MicrobeStage was entered without spawning the player");
                SpawnPlayer();
            }
            else
            {
                // Respawn the player once the timer is up
                playerRespawnTimer -= delta;

                if (playerRespawnTimer <= 0)
                {
                    HandlePlayerRespawn();
                }
            }
        }

        // Start auto-evo if not already and settings have auto-evo be started during gameplay
        if (Settings.Instance.RunAutoEvoDuringGamePlay)
        {
            GameWorld.IsAutoEvoFinished(true);
        }
    }
コード例 #5
0
ファイル: MicrobeStage.cs プロジェクト: ichabodphage/Thrive
    /// <summary>
    ///   This should get called the first time the stage scene is put
    ///   into an active scene tree. So returning from the editor
    ///   might be safe without it unloading this.
    /// </summary>
    public override void _Ready()
    {
        world = GetNode <Node>("World");
        HUD   = GetNode <MicrobeHUD>("MicrobeHUD");
        rootOfDynamicallySpawned = GetNode <Node>("World/DynamicallySpawned");
        spawner         = new SpawnSystem(rootOfDynamicallySpawned);
        Camera          = world.GetNode <MicrobeCamera>("PrimaryCamera");
        Clouds          = world.GetNode <CompoundCloudSystem>("CompoundClouds");
        worldLight      = world.GetNode <DirectionalLight>("WorldLight");
        TimedLifeSystem = new TimedLifeSystem(rootOfDynamicallySpawned);
        ProcessSystem   = new ProcessSystem(rootOfDynamicallySpawned);
        microbeAISystem = new MicrobeAISystem(rootOfDynamicallySpawned);
        FluidSystem     = new FluidSystem(rootOfDynamicallySpawned);

        HUD.Init(this);

        // Do stage setup to spawn things and setup all parts of the stage
        SetupStage();
    }
コード例 #6
0
ファイル: MicrobeStage.cs プロジェクト: luminarium/Thrive
    public override void _Process(float delta)
    {
        // https://github.com/Revolutionary-Games/Thrive/issues/1976
        if (delta <= 0)
        {
            return;
        }

        FluidSystem.Process(delta);
        TimedLifeSystem.Process(delta);
        ProcessSystem.Process(delta);
        microbeAISystem.Process(delta);

        if (gameOver)
        {
            guidanceLine.Visible = false;

            // Player is extinct and has lost the game
            // Show the game lost popup if not already visible
            HUD.ShowExtinctionBox();

            return;
        }

        if (Player != null)
        {
            spawner.Process(delta, Player.Translation, Player.Rotation);
            Clouds.ReportPlayerPosition(Player.Translation);

            TutorialState.SendEvent(TutorialEventType.MicrobePlayerOrientation,
                                    new RotationEventArgs(Player.Transform.basis, Player.RotationDegrees), this);

            TutorialState.SendEvent(TutorialEventType.MicrobePlayerCompounds,
                                    new CompoundBagEventArgs(Player.Compounds), this);

            TutorialState.SendEvent(TutorialEventType.MicrobePlayerTotalCollected,
                                    new CompoundEventArgs(Player.TotalAbsorbedCompounds), this);

            elapsedSinceCompoundPositionCheck += delta;

            if (elapsedSinceCompoundPositionCheck > Constants.TUTORIAL_COMPOUND_POSITION_UPDATE_INTERVAL)
            {
                elapsedSinceCompoundPositionCheck = 0;

                if (TutorialState.WantsNearbyCompoundInfo())
                {
                    TutorialState.SendEvent(TutorialEventType.MicrobeCompoundsNearPlayer,
                                            new CompoundPositionEventArgs(Clouds.FindCompoundNearPoint(Player.Translation, glucose)),
                                            this);
                }

                guidancePosition = TutorialState.GetPlayerGuidancePosition();
            }

            if (guidancePosition != null)
            {
                guidanceLine.Visible   = true;
                guidanceLine.LineStart = Player.Translation;
                guidanceLine.LineEnd   = guidancePosition.Value;
            }
            else
            {
                guidanceLine.Visible = false;
            }
        }
        else
        {
            guidanceLine.Visible = false;

            if (!spawnedPlayer)
            {
                GD.PrintErr("MicrobeStage was entered without spawning the player");
                SpawnPlayer();
            }
            else
            {
                // Respawn the player once the timer is up
                playerRespawnTimer -= delta;

                if (playerRespawnTimer <= 0)
                {
                    HandlePlayerRespawn();
                }
            }
        }

        // Start auto-evo if stage entry finished, don't need to auto save,
        // settings have auto-evo be started during gameplay and auto-evo is not already started
        if (TransitionFinished && !wantsToSave && Settings.Instance.RunAutoEvoDuringGamePlay)
        {
            GameWorld.IsAutoEvoFinished(true);
        }

        // Save if wanted
        if (TransitionFinished && wantsToSave)
        {
            if (!CurrentGame.FreeBuild)
            {
                SaveHelper.AutoSave(this);
            }

            wantsToSave = false;
        }
    }