LoginSignup
5
4

More than 5 years have passed since last update.

Unity カードゲームのフェーズ管理

Last updated at Posted at 2019-04-03
GameMaster.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameMaster : MonoBehaviour {
    enum Phase{
        INIT,
        DRAW,
        STANDBY,
        BATTLE,
        END,
    };

    Phase phase;
    void Start () {
        phase = Phase.INIT;
    }   
    void Update () {
        switch(phase){
            case Phase.INIT:
            InitPhase();
            break;
            case Phase.DRAW:
            DrawPhase();
            break;
            case Phase.STANDBY:
            StandbyPhase();
            break;
            case Phase.BATTLE:
            BattlePhase();
            break;
            case Phase.END:
            EndPhase();
            break;
        }       
    }
    void InitPhase(){
        Debug.Log("InitPhase");
        phase = Phase.DRAW;
    }
    void DrawPhase(){
        Debug.Log("DrawPhase");
        phase = Phase.STANDBY;
    }
    void StandbyPhase(){
        Debug.Log("StandbyPhase");
        phase = Phase.BATTLE;
    }
    void BattlePhase(){
        Debug.Log("BattlePhase");
        phase = Phase.END;
    }
    void EndPhase(){
        Debug.Log("EndPhase");
        phase = Phase.DRAW;
    }
}


スタジオしまづでゲームの作り方を学びたい人向けのサロン▶︎https://camp-fire.jp/projects/view/149191

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4