Пример #1
0
    public static void HandleConnect(ConnectMessage message)
    {
        switch (message.GameState)
        {
            case CurrentGameState.ResourceLoading:
                GameController.Instance.ActionsQueue.AddAction(new ObserverPlayGame());
                break;
            case CurrentGameState.WaitingForGame:
                LoadingScreenController.Instance.IsPressed = true;
                GameController.Instance.ActionsQueue.AddAction(new ObserverPlayGame());
                break;
            case CurrentGameState.ActiveGame:
                ObserverData.GameActive = true;
                LoadingScreenController.Instance.IsPressed = true;
                BallCreator.Instance.CreateAllNextFrame = message.BallsList;

                var empty = new EmptyAction();
                empty.Start += (action)=>
                {
                    PlayerData.Points = message.PlayerInfo.Points;
                    PlayerData.Health = message.PlayerInfo.Health;
                    PlayerData.LevelTimer = message.PlayerInfo.Timer;
                    PlayerData.Level = message.PlayerInfo.Level;
                };
                GameController.Instance.ActionsQueue.AddAction(empty);

                break;
            case CurrentGameState.LevelUp:
                GameController.Instance.ActionsQueue.AddAction(new ObserverLevelUp());
                break;
            case CurrentGameState.EndGame:
                break;
        }
    }
Пример #2
0
    public void LoadAll()
    {
        LoadBundlesQueue.AddAction(new Loader(BundleType.Prefab, "Ball.unity3d"));
        LoadBundlesQueue.AddAction(new Loader(BundleType.Material, "BallMaterial.unity3d"));
        LoadBundlesQueue.AddAction(new Loader(BundleType.Text, "WinText.unity3d"));
        LoadBundlesQueue.AddAction(new Loader(BundleType.Sound, "SoundPack.unity3d"));

        LoadBundlesQueue.AddAction(new ProcessLoadedBundles());

        var emptyAction = new EmptyAction();
        emptyAction.Finish += (action) =>
        {
            BundlesManager.AreBundlesLoaded = true;
        };
        LoadBundlesQueue.AddAction(emptyAction);
    }
Пример #3
0
    public void GenerateTextures()
    {
        for (var i = 0; i < Settings.TexturesCount; i++)
        {
            TexturesQueue.AddAction(new GenerateTexture(32));
            TexturesQueue.AddAction(new GenerateTexture(64));
            TexturesQueue.AddAction(new GenerateTexture(128));
            TexturesQueue.AddAction(new GenerateTexture(256));
        }

        var emptyAction = new EmptyAction();
        emptyAction.Finish += (action) =>
        {
            TexturesManager.IsGenerationComplete = true;
        };
        TexturesQueue.AddAction(emptyAction);
    }