Class: TonScene

ゲームのシーン(場面)遷移を管理します。

Interfaces

interface IScene

シーンクラスが実装すべきインターフェースです。

Scene Template

class TonSceneTemplate

新しいシーンを作成するためのテンプレートクラスです(TonSceneTemplate.cs)。
このファイルをコピー&リネームし、クラス名を変更するだけですぐに新しいシーンとして利用できます。

Methods

void Change(IScene nextScene, float durationOut = 0.0f, float durationIn = -1.0f, Color fadeColor = default)

指定したシーンへ遷移します。フェードアウト→フェードインのアニメーションを伴います。

Sample Code

// Implementation of a Scene
public class TitleScene : IScene
{
    public void Initialize() { /* Load Resources */ }
    public void Update(GameTime gameTime)
    {
        // Transition to GameScene when 'A' is pressed
        if (Ton.Input.IsJustPressed("A"))
        {
            // Change scene over 1.0 seconds, fading through Black
            Ton.Scene.Change(new GameScene(), 1.0f, Color.Black);
        }
    }
    public void Draw() { /* Draw Title */ }
    public void Terminate() { /* Cleanup */ }
}

// In Game1.Initialize()
// Set initial scene
Ton.Scene.Change(new TitleScene(), 0f); // Instant change