Ejemplo n.º 1
0
 private static void AddIfNotExists <T, V>(GameEventsEnum name)
 {
     if (actionList.ContainsKey(name) == false)
     {
         actionList[name] = new EventController <T, V>();
     }
 }
Ejemplo n.º 2
0
 public static void Register(GameEventsEnum name, Action callback)
 {
     AddIfNotExists(name);
     actionList[name].Add(callback);
 }
Ejemplo n.º 3
0
 public static void Register <T, V, U, X>(GameEventsEnum name, Action <T, V, U, X> callback)
 {
     AddIfNotExists <T, V, U, X>(name);
     actionList[name].Add(callback);
 }
Ejemplo n.º 4
0
 public static void Raise <T, V, U, X>(T data, V data2, U data3, X data4, GameEventsEnum name)// where T : struct
 {
     AddIfNotExists <T, V, U>(name);
     actionList[name].Raise(data, data2, data3, data4);
 }
Ejemplo n.º 5
0
 public static void Raise <T, V>(T data, V data2, GameEventsEnum name)// where T : struct
 {
     AddIfNotExists <T, V>(name);
     actionList[name].Raise(data, data2);
 }
Ejemplo n.º 6
0
    public static void Raise(GameEventsEnum name)// where T : struct
    {
        AddIfNotExists(name);

        actionList[name].Raise();
    }
Ejemplo n.º 7
0
    public void newEvent(GameEventsEnum e)
    {
        switch (currentState)
        {
        case GameStateEnum.PauseMenu:

            switch (e)
            {
            case GameEventsEnum.GameKeyExit:
                exitGame();
                break;

            case GameEventsEnum.GameKeyConfirm:
            case GameEventsEnum.GameKeyFire:
                continueGame();
                canvasStates.showHelpText(5.0f);
                break;

            default:
                noStateChange();
                break;
            }

            break;

        case GameStateEnum.StartMenu:

            switch (e)
            {
            case GameEventsEnum.GameKeyExit:
                exitGame();
                break;

            case GameEventsEnum.GameKeyConfirm:
            case GameEventsEnum.GameKeyFire:
                continueGame();
                canvasStates.showHelpText();
                break;

            default:
                noStateChange();
                break;
            }

            break;

        case GameStateEnum.Running:

            switch (e)
            {
            case GameEventsEnum.GameKeyExit:
                pauseGame();
                break;

            case GameEventsEnum.GameKeyPause:
                pauseGame();
                break;

            case GameEventsEnum.GameOver:
                gameOver();
                break;

            default:
                noStateChange();
                break;
            }

            break;

        case GameStateEnum.GameOver:

            switch (e)
            {
            case GameEventsEnum.GameKeyExit:
                exitGame();
                break;

            case GameEventsEnum.GameKeyConfirm:
                restartGame();
                break;

            default:
                noStateChange();
                break;
            }

            break;
        }
    }
Ejemplo n.º 8
0
    public static void Raise <T>(GameEventsEnum name, T data)// where T : struct
    {
        AddIfNotExists <T>(name);

        actionList[name].Raise(data);
    }