Example #1
0
    public void Setup(Slot slot)
    {
        this.slot    = slot;
        this.nameBox = slot.nameBox;

        nameBox.isTouchable = false;

        Vector2 pos = OtherToLocal(nameBox, new Vector2(0, 0));

        AddChild(nameBox);
        nameBox.SetPosition(pos);

        Cell nameCell = CellManager.GetCellFromGrid(3, 6, 2, 2);

        nameBox.anchorCell = nameCell;

        Go.to(nameBox, 0.7f, new TweenConfig()
              .floatProp("x", nameCell.x)
              .floatProp("y", nameCell.y)
              .floatProp("width", nameCell.width)
              .floatProp("height", nameCell.height)
              .setEaseType(EaseType.ExpoInOut)
              //.onComplete(() => {})
              );

        ////////SETUP DELETE

        Cell deleteCell = CellManager.GetCellFromGrid(1, 2, 2, 2);

        AddChild(deleteBox = new Box());
        deleteBox.Init(slot.player, deleteCell.width, deleteCell.height);
        deleteBox.y           = deleteCell.y;
        deleteBox.x           = -Config.WIDTH / 2 - deleteCell.width - 30.0f; //put if offscreen to the left
        deleteBox.isTouchable = false;                                        //don't allow it to be touched until it builds in
        deleteBox.anchorCell  = deleteCell;

        deleteBox.contentContainer.AddChild(deleteSkull = new FSprite("Icons/Skull"));
        deleteSkull.color = Color.black;

        Go.to(deleteBox, 0.4f, new TweenConfig()
              .floatProp("x", deleteCell.x)
              .setEaseType(EaseType.ExpoOut)
              .setDelay(0.3f)
              .onComplete(() => { deleteBox.isTouchable = true; })
              );

        deleteBox.SignalPress += box =>
        {
            FSoundManager.PlaySound("UI/Button1");
            deleteBox.DoTapEffect();
            StartDelete();
        };

        ////////SETUP OK
        ///
        Cell okCell = CellManager.GetCellFromGrid(7, 8, 2, 2);

        AddChild(okBox    = new SpriteBox(slot.player, "Icons/Checkmark", okCell.width, okCell.height));
        okBox.y           = okCell.y;
        okBox.x           = Config.WIDTH / 2 + okCell.width + 30.0f; //put if offscreen to the right
        okBox.isTouchable = false;                                   //don't allow it to be touched until it builds in
        okBox.anchorCell  = okCell;

        okBox.isEnabled = (slot.player.name.Length > 0);

        Go.to(okBox, 0.4f, new TweenConfig()
              .floatProp("x", okCell.x)
              .setEaseType(EaseType.ExpoOut)
              .setDelay(0.3f)
              .onComplete(() => { okBox.isTouchable = true; })
              );

        okBox.SignalPress += box =>
        {
            FSoundManager.PlaySound("UI/Button1");
            slot.player.color.PlayNormalSound();
            okBox.DoTapEffect();
            Close();
        };

        nameBox.isEditMode = true;

        CreateKeyboard(0.0f);
        CreateSwatches(0.3f);
    }
Example #2
0
    public void Update()
    {
        hudStuff.text  = "Energy: " + jugador.getEnergy() + "\n Score: " + jugador.getScore();
        hudShadow.text = hudStuff.text;
        if (jugador.getEnergy() <= 0)
        {
            hudStuff.text  = "Game Over, \n press return to continue...";
            hudShadow.text = hudStuff.text;
            gameArea.alpha--;
            projectileContainer.alpha--;
            entityContainer.alpha--;
            particleContainer.alpha--;

            if (Input.GetKeyDown(KeyCode.Return))
            {
                Game.instance.GoToPage(PageType.MainMenuPage);
            }

            return;
        }

        for (int x = enemies.Count - 1; x >= 0; x--)
        {
            enemies[x].Update();
            if (enemies[x].getEnergy() < 0)
            {
                entityContainer.RemoveChild(enemies[x]);
                enemies.RemoveAt(x);
            }
        }

        for (int x = projectiles.Count - 1; x >= 0; x--)
        {
            projectiles[x].Update();
            for (int w = enemies.Count - 1; w >= 0; w--)
            {
                if (projectiles[x].sprite.localRect.CloneAndOffset(projectiles[x].x, projectiles[x].y).CheckIntersect(enemies[w].sprite.localRect.CloneAndOffset(enemies[w].x, enemies[w].y)))
                {
                    enemies[w].setEnergy(enemies[w].getEnergy() - projectiles[x].getEnergy());
                    jugador.AddScore(enemies[w].scoreValue);
                    projectiles[x].ttl = -2f;
                    ScreenShake(2, 3);
                    FSoundManager.PlaySound("explosion");
                }
            }
            if (projectiles[x].ttl < 0)
            {
                projectiles[x].DestroyEffect();
                projectileContainer.RemoveChild(projectiles[x]);
                projectiles.RemoveAt(x);
            }
        }

        for (int x = Enemyprojectiles.Count - 1; x >= 0; x--)
        {
            Enemyprojectiles[x].Update();
            if (Enemyprojectiles[x].sprite.localRect.CloneAndOffset(Enemyprojectiles[x].x, Enemyprojectiles[x].y).CheckIntersect(jugador.sprite.localRect.CloneAndOffset(jugador.Position.x, jugador.Position.y)))
            {
                jugador.setEnergy(jugador.getEnergy() - Enemyprojectiles[x].getEnergy());
                ScreenShake(3, 10);
                Enemyprojectiles[x].ttl = -1;
                FSoundManager.PlaySound("explosion");
            }
            if (Enemyprojectiles[x].ttl < 0)
            {
                Enemyprojectiles[x].DestroyEffect();
                projectileContainer.RemoveChild(Enemyprojectiles[x]);
                Enemyprojectiles.RemoveAt(x);
            }
        }

        jugador.Update();

        if (enemies.Count < minimalEnemies)
        {
            GenerateFoe();
        }

        if (jugador.getScore() > 0)
        {
            if ((jugador.getScore() % 300) == 0)
            {
                Shielded shiel = new Shielded(new Vector2(jugador.GetPosition().x + UnityEngine.Random.Range(-Futile.screen.width * 2, Futile.screen.width * 2), Futile.screen.halfHeight - 20));
                enemies.Add(shiel);
                jugador.AddScore(jugador.getScore() + 10);
            }

            if ((jugador.getScore() % 500) == 0)
            {
                minimalEnemies++;
            }
        }
    }
Example #3
0
 public static void PlaySound(string resourceName)
 {
     FSoundManager.PlaySound(resourceName, 1f);
 }
Example #4
0
    void CreateKeyboard(float delay)
    {
        bool isNameAtMaxLength = (slot.player.name.Length >= Config.MAX_CHARS_PER_NAME);
        bool isNameEmpty       = (slot.player.name.Length == 0);

        FSoundManager.PlaySound("UI/LetterIn", 0.25f);

        for (int k = 0; k < 28; k++)
        {
            KeyBox keyBox = new KeyBox(slot.player, k);
            keyBox.soundVolume = 0.5f;

            if (k == SPACE_KEY)
            {
                keyBox.shouldRepeat = false;
            }

            keyBoxes.Add(keyBox);
            keyboardAndSwatchContainer.AddChild(keyBox);

            if (k == SPACE_KEY)
            {
                keyBox.normalSoundName = "UI/ButtonTick";
            }
            else if (k == BACKSPACE_KEY)
            {
                keyBox.normalSoundName = "UI/Backspace";

                FSprite backspaceSprite = new FSprite("Icons/Backspace");
                keyBox.contentContainer.AddChild(backspaceSprite);
                backspaceSprite.color = Color.black;
            }
            else             //the normal letters
            {
                FLabel keyLabel = new FLabel("Raleway", THE_KEYBOARD[k].ToString());
                keyLabel.color = Color.black;
                keyLabel.scale = 0.75f;
                keyBox.contentContainer.AddChild(keyLabel);
                keyBox.normalSoundName = "UI/ButtonTick";
            }

            //disable backspace if it's empty, disable everything BUT backspace if it's full
            if ((k == BACKSPACE_KEY && !isNameEmpty) || (k != BACKSPACE_KEY && !isNameAtMaxLength))
            {
                keyBox.isEnabled = true;
            }
            else
            {
                keyBox.isEnabled = false;
            }

            keyBox.SignalTick += HandleKeyTick;

            keyBox.scale = 0.0f;

            keyBox.colorTweenDelay = 0.019f * k;

            Go.to(keyBox, 0.25f, new TweenConfig()
                  .floatProp("scale", 1.0f)
                  .setDelay(delay + 0.025f * (28f - (float)k))
                  .setEaseType(EaseType.ExpoOut));
        }

        RepositionKeyboard();
    }
Example #5
0
    public void Update()
    {
        if (beginCount < beginTime)
        {
            beginCount      += UnityEngine.Time.deltaTime;
            clock.percentage = 1.0f;
        }
        else if (beginningLabel.alpha > 0)
        {
            beginningLabel.alpha      -= .3f * UnityEngine.Time.deltaTime;
            beginningLabelShadow.alpha = beginningLabel.alpha;
        }
        enemyClock.percentage = (playerList.Count - 1) / startNumPlayers;
        if (playerList.Count == 1)
        {
            clock.disableClock();
            if (endScreen == null)
            {
                FSoundManager.PlaySound("win");
                endScreen = new LevelOverScreen(true, currentLevelNum + 1 >= enemiesOnLevel.Length);
                gui.AddChild(endScreen);
            }
            else
            {
                if (endScreen.readyToStart)
                {
                    Futile.instance.SignalUpdate -= Update;
                    Futile.stage.RemoveAllChildren();
                    if (this.currentLevelNum + 1 < enemiesOnLevel.Length)
                    {
                        World newWorld = new World(++this.currentLevelNum);
                        Futile.instance.SignalUpdate += newWorld.Update;
                    }
                    else
                    {
                        TitleScreen titleScreen = new TitleScreen();
                        Futile.stage.AddChild(titleScreen);
                    }
                }
            }
        }
        else if (clock.percentage <= 0)
        {
            if (endScreen == null)
            {
                FSoundManager.PlaySound("lose");
                endScreen = new LevelOverScreen(false);
                gui.AddChild(endScreen);
            }
            else
            {
                endScreen.MoveToFront();
                if (endScreen.readyToStart)
                {
                    Futile.instance.SignalUpdate -= Update;
                    Futile.stage.RemoveAllChildren();

                    World newWorld = new World(this.currentLevelNum);
                    Futile.instance.SignalUpdate += newWorld.Update;
                }
            }
        }
        for (int ind = 0; ind < powerups.Count; ind++)
        {
            Powerup powerup = powerups[ind];
            foreach (Player p in playerList)
            {
                if (p.isControlled)
                {
                    if (powerup.checkCollision(p))
                    {
                        FSoundManager.PlaySound("powerup");
                        p.collectPowerUp(powerup.PType);
                        powerup.RemoveFromContainer();
                        powerups.Remove(powerup);
                        ind--;
                    }
                }
            }
        }
        for (int ind = 0; ind < bulletList.Count; ind++)
        {
            Bullet b = bulletList[ind];
            b.Update();
            for (int playerInd = 0; playerInd < playerList.Count; playerInd++)
            {
                Player p = playerList[playerInd];
                if (clock.percentage > 0 && b.checkCollision(p))
                {
                    p.setScale(p.scale - 1.0f, false);
                    if (p.scale <= 0)
                    {
                        FSoundManager.PlaySound("dead", .3f);
                        p.RemoveFromContainer();
                        playerList.Remove(p);
                        playerInd--;
                        FloatIndicator floatInd = new FloatIndicator("+00:00:0" + p.secondValue, p.GetPosition());
                        playerLayer.AddChild(floatInd);
                        clock.percentage += p.secondValue / 10.0f;      //Add the seconds to the clock
                        if (p.secondValue == 3)
                        {
                            float   powerupChance = RXRandom.Float();
                            Powerup powerup       = null;
                            if (powerupChance < .4f)
                            {
                                powerup = new Powerup(Powerup.PowerupType.MACHINEGUN);
                            }
                            else if (powerupChance < .8f)
                            {
                                powerup = new Powerup(Powerup.PowerupType.SHOTGUN);
                            }
                            if (powerup != null)
                            {
                                powerups.Add(powerup);
                                powerup.SetPosition(p.GetPosition());
                                playerLayer.AddChild(powerup);
                            }
                        }
                    }
                    else
                    {
                        FSoundManager.PlaySound("hit", .3f);
                    }
                    b.RemoveFromContainer();
                    bulletList.Remove(b);
                    ind--;
                    break;
                }
                else
                if (tilemap.getFrameNum((int)(b.x / tilemap._tileWidth), (int)(-b.y / tilemap._tileHeight)) == 1)
                {
                    b.RemoveFromContainer();
                    bulletList.Remove(b);
                    ind--;
                    break;
                }
            }
        }
    }
Example #6
0
    public ResetGroup(float width)
    {
        this.width = width;

        AddChild(plusBox  = new MathBox(MathType.Plus));
        AddChild(minusBox = new MathBox(MathType.Minus));

        AddChild(zeroBox = new ZeroBox());

        AddChild(cancelBox = new SpriteBox(Player.NullPlayer, "Icons/Cancel", 100, 100));
        AddChild(okBox     = new SpriteBox(Player.NullPlayer, "Icons/Checkmark", 100, 100));

        plusBox.hasFastRepeatZones  = true;
        minusBox.hasFastRepeatZones = true;

        if (PlayerPrefs.HasKey(PREFS_KEY))
        {
            zeroBox.resetAmount = PlayerPrefs.GetInt(PREFS_KEY);
        }

        float boxSize = Config.SLOT_HEIGHT;
        float padding = Config.PADDING_S;

        plusBox.SetSize(boxSize, boxSize);
        minusBox.SetSize(boxSize, boxSize);
        zeroBox.SetSize(width - boxSize * 2 - padding * 2, boxSize);

        plusBox.SetPosition(zeroBox.width / 2 + padding + plusBox.width / 2, padding / 2 + plusBox.height / 2);
        minusBox.SetPosition(-zeroBox.width / 2 - padding - minusBox.width / 2, padding / 2 + minusBox.height / 2);
        zeroBox.SetPosition(0, padding / 2 + zeroBox.height / 2);

        cancelBox.SetSize((width - padding) / 2, boxSize);
        okBox.SetSize((width - padding) / 2, boxSize);

        cancelBox.SetPosition(-padding / 2 - cancelBox.width / 2, -padding / 2 - cancelBox.height / 2);
        okBox.SetPosition(padding / 2 + okBox.width / 2, -padding / 2 - okBox.height / 2);

        minusBox.SignalTick += (b, ticks) =>
        {
            zeroBox.resetAmount -= ticks;
            UpdateResetAmount();
        };

        plusBox.SignalTick += (b, ticks) =>
        {
            zeroBox.resetAmount += ticks;
            UpdateResetAmount();
        };

        zeroBox.SignalRelease += (b) =>
        {
            zeroBox.DoTapEffect();
            FSoundManager.PlaySound("UI/ResetToZero");
            zeroBox.resetAmount = 0;
            UpdateResetAmount();
        };

        cancelBox.SignalRelease += (b) =>
        {
            Keeper.instance.slotList.ApplyResetScores(false);
            cancelBox.isTouchable = false;
            cancelBox.DoTapEffect();
            Keeper.instance.EndResetMode();
            FSoundManager.PlaySound("UI/Cancel");
        };

        okBox.SignalRelease += (b) =>
        {
            Keeper.instance.slotList.ApplyResetScores(true);
            okBox.isTouchable = false;
            okBox.DoTapEffect();
            Keeper.instance.EndResetMode();
            FSoundManager.PlaySound("UI/ResetOk");

            SKDataManager.MarkDirty();
        };

        UpdateResetAmount();

        instance = this;
    }
Example #7
0
 static public void PlayBananaSound()
 {
     FSoundManager.PlaySound("BananaSound", 0.95f);
 }
    public void UpdateGoal()
    {
        if (totalDistance < goalDistance - 1000f || initiatedSceneSwitch)
        {
            return;
        }

        if (goalType == GoalType.GoalOne)
        {
            if (faceCoin == null)
            {
                faceCoin   = new FSprite("danaHappy.png");
                faceCoin.x = Futile.screen.width + 100f;
                faceCoin.y = 250f;
                everythingContainer.AddChild(faceCoin);
                everythingContainer.AddChild(whit);                 // move him to top

                Tween tween1 = new Tween(faceCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", -1.0f)
                                         .setEaseType(EaseType.SineInOut));

                Tween tween2 = new Tween(faceCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", 1.0f)
                                         .setEaseType(EaseType.SineInOut));

                TweenChain chain = new TweenChain();
                chain.setIterations(-1);
                chain.append(tween1);
                chain.append(tween2);
                Go.addTween(chain);
                chain.play();
            }

            faceCoin.x += Time.fixedDeltaTime * universalVelocity;

            if (faceCoin.x < 100f)
            {
                initiatedSceneSwitch = true;
                FSoundManager.PlaySound("success");
                TMain.SwitchToScene(TMain.SceneType.DreamSceneOne);
            }
        }

        else if (goalType == GoalType.GoalTwo)
        {
            if (bigHeartCoin == null)
            {
                bigHeartCoin       = new FSprite("heart.psd");
                bigHeartCoin.scale = 2.0f;
                bigHeartCoin.x     = Futile.screen.width + 100f;
                bigHeartCoin.color = new Color(1.0f, 0.2f, 0.2f, 1.0f);
                bigHeartCoin.y     = 250f;
                everythingContainer.AddChild(bigHeartCoin);
                everythingContainer.AddChild(whit);                 // move to top

                Tween tween1 = new Tween(bigHeartCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", -1.0f)
                                         .setEaseType(EaseType.SineInOut));

                Tween tween2 = new Tween(bigHeartCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", 1.0f)
                                         .setEaseType(EaseType.SineInOut));

                TweenChain chain = new TweenChain();
                chain.setIterations(-1);
                chain.append(tween1);
                chain.append(tween2);
                Go.addTween(chain);
                chain.play();
            }

            bigHeartCoin.x += Time.fixedDeltaTime * universalVelocity;

            if (bigHeartCoin.x < 100f)
            {
                initiatedSceneSwitch = true;
                FSoundManager.StopMusic();
                FSoundManager.PlaySound("success");
                TMain.SwitchToScene(TMain.SceneType.DreamSceneTwo);
            }
        }

        else if (goalType == GoalType.GoalThree)
        {
            if (dana == null)
            {
                dana   = new TWalkingCharacter("danaHead.png");
                dana.x = Futile.screen.width + 100f;
                dana.y = 250f;
                everythingContainer.AddChild(dana);
                dana.StartWalking();
            }

            dana.x += Time.fixedDeltaTime * universalVelocity * 0.25f;

            if (dana.x < 350f)
            {
                start.isVisible = goal.isVisible = false;
                FSoundManager.PlayMusic("yay");
                foundEachother = true;
                dana.TurnAround();
                dana.StopWalking();
                whit.StopWalking();
                parallaxScene.StopUpdating();
                whit.StopCrouching();
                StartHeartShower();
            }
        }
    }
Example #9
0
 public void PlayNormalSound()
 {
     FSoundManager.PlaySound(soundNormalName);
 }
Example #10
0
 public void PlayBassSound()
 {
     FSoundManager.PlaySound(soundBassName);
 }
    public void EndGame()
    {
        FlyOutUIElements();

        scoreLabel.text = string.Format("{0:#,###0}", score);

        for (int i = hearts.Count - 1; i >= 0; i--)
        {
            FSprite heart = hearts[i];
            foreach (AbstractTween tween in Go.tweensWithTarget(heart))
            {
                Go.removeTween(tween);
            }
            heart.RemoveFromContainer();
            hearts.Remove(heart);
        }

        if (score >= 1000000)
        {
            StartHeartShower();
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("happyPiano");
            gameIsOver = true;
            FLabel label = new FLabel("SoftSugar", "I love you times a million!");
            label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            label.x     = Futile.screen.halfWidth;
            label.y     = Futile.screen.halfHeight;
            label.scale = 0;
            AddChild(label);

            TweenConfig config = new TweenConfig()
                                 .floatProp("scale", 1.0f)
                                 .setEaseType(EaseType.SineInOut)
                                 .onComplete(OnWinLabelDoneAppearing);

            Go.to(label, 0.5f, config);
        }

        if (numHeartsMissed >= 5)
        {
            gameIsOver = true;
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("sadPiano");
            FLabel topLabel    = new FLabel("SoftSugar", "Are you kidding me?!");
            FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score));
            topLabel.color    = new Color(0.75f, 0.12f, 0.12f, 1.0f);
            bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            bottomLabel.x     = topLabel.x = Futile.screen.halfWidth;
            float bottomBeginning = 300f;
            float segmentHeight   = (Futile.screen.height - bottomBeginning * 2f) / 3f;
            bottomLabel.y     = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning;
            topLabel.y        = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning;
            bottomLabel.scale = topLabel.scale = 0;
            AddChild(topLabel);
            AddChild(bottomLabel);

            TweenConfig config1 = new TweenConfig()
                                  .floatProp("scale", 1.0f)
                                  .setEaseType(EaseType.SineInOut);
            TweenConfig config2 = new TweenConfig()
                                  .floatProp("scale", 0.75f)
                                  .setEaseType(EaseType.SineInOut);

            float duration = 0.5f;

            TweenChain chain = new TweenChain();
            chain.append(new Tween(topLabel, duration, config1));
            chain.append(new Tween(bottomLabel, duration, config2));
            chain.setOnCompleteHandler(OnGameShouldBeFullyOver);

            Go.addTween(chain);
            chain.play();
        }
    }
Example #12
0
 private void DoTickEffectWithSound(string soundName)
 {
     FSoundManager.PlaySound(soundName, soundVolume);
     DoTapEffect();
 }
 public void OnLetterCompleteAnimatingIn(AbstractTween tween)
 {
     FSoundManager.PlaySound("plip", 0.5f);
 }
    public void HandleTouchOnBlackallAndTesser(FTouch touch)
    {
        FLabel touchedLetter = null;

        for (int i = 0; i < tesserLetters.Count; i++)
        {
            FLabel label = tesserLetters[i];
            if (label == null)
            {
                continue;
            }
            Vector2 touchPos = label.GlobalToLocal(touch.position);
            if (label.textRect.Contains(touchPos))
            {
                touchedLetter = label;
                break;
            }
        }

        for (int i = 0; i < blackallLetters.Count; i++)
        {
            FLabel label = blackallLetters[i];
            if (label == null)
            {
                continue;
            }
            Vector2 touchPos = label.GlobalToLocal(touch.position);
            if (label.textRect.Contains(touchPos))
            {
                touchedLetter = label;
                break;
            }
        }

        if (touchedLetter == null)
        {
            return;
        }

        touchWasUsedCorrectly = true;

        TweenChain chain         = null;
        float      duration      = 0.2f;
        float      extraRotation = 0f;

        // TESSER

        // T
        if (touchedLetter == tesserLetters[0])
        {
            if (unsolidifiedTrebellaLetters.Contains(touchedLetter))
            {
                FSoundManager.PlaySound("error");
                return;
            }

            if (!movedT)
            {
                chain  = TweenChainForLetter(touchedLetter, duration, trebellaFinalPositions[0].x, trebellaFinalPositions[0].y, extraRotation);
                movedT = true;
                unsolidifiedTrebellaLetters.Add(touchedLetter);
            }
        }

        // E
        if (touchedLetter == tesserLetters[1] || touchedLetter == tesserLetters[4])
        {
            if (unsolidifiedTrebellaLetters.Contains(touchedLetter))
            {
                FSoundManager.PlaySound("error");
                return;
            }

            int index;

            if (numTouchedEs == 0)
            {
                index = 2;
            }
            else if (numTouchedEs == 1)
            {
                index = 4;
            }
            else
            {
                index = -1;
            }

            if (index != -1)
            {
                chain = TweenChainForLetter(touchedLetter, duration, trebellaFinalPositions[index].x, trebellaFinalPositions[index].y, extraRotation);
                numTouchedEs++;
                unsolidifiedTrebellaLetters.Add(touchedLetter);
            }
            else
            {
                int tesserIndex = 0;
                if (touchedLetter == tesserLetters[1])
                {
                    tesserIndex = 0;
                }
                else if (touchedLetter == tesserLetters[4])
                {
                    tesserIndex = 4;
                }
                KillLetter(touchedLetter);
                tesserLetters[tesserIndex] = null;
                numNonTrebellaLettersLeft--;
            }
        }

        // S
        if (touchedLetter == tesserLetters[2])
        {
            KillLetter(touchedLetter);
            numNonTrebellaLettersLeft--;
            tesserLetters[2] = null;
        }

        // S
        if (touchedLetter == tesserLetters[3])
        {
            KillLetter(touchedLetter);
            numNonTrebellaLettersLeft--;
            tesserLetters[3] = null;
        }

        // R
        if (touchedLetter == tesserLetters[5])
        {
            if (unsolidifiedTrebellaLetters.Contains(touchedLetter))
            {
                FSoundManager.PlaySound("error");
                return;
            }

            if (!movedR)
            {
                chain  = TweenChainForLetter(touchedLetter, duration, trebellaFinalPositions[1].x, trebellaFinalPositions[1].y, extraRotation);
                movedR = true;
                unsolidifiedTrebellaLetters.Add(touchedLetter);
            }
        }

        // BLACKALL

        // B
        if (touchedLetter == blackallLetters[0])
        {
            if (unsolidifiedTrebellaLetters.Contains(touchedLetter))
            {
                FSoundManager.PlaySound("error");
                return;
            }

            if (!movedB)
            {
                chain  = TweenChainForLetter(touchedLetter, duration, trebellaFinalPositions[3].x, trebellaFinalPositions[3].y, extraRotation);
                movedB = true;
                unsolidifiedTrebellaLetters.Add(touchedLetter);
            }
        }

        // L
        if (touchedLetter == blackallLetters[1] || touchedLetter == blackallLetters[6] || touchedLetter == blackallLetters[7])
        {
            if (unsolidifiedTrebellaLetters.Contains(touchedLetter))
            {
                FSoundManager.PlaySound("error");
                return;
            }

            int index;

            if (numTouchedLs == 0)
            {
                index = 5;
            }
            else if (numTouchedLs == 1)
            {
                index = 6;
            }
            else
            {
                index = -1;
            }

            if (index != -1)
            {
                chain = TweenChainForLetter(touchedLetter, duration, trebellaFinalPositions[index].x, trebellaFinalPositions[index].y, extraRotation);
                numTouchedLs++;
                unsolidifiedTrebellaLetters.Add(touchedLetter);
            }
            else
            {
                int blackallIndex = 0;
                if (touchedLetter == blackallLetters[1])
                {
                    blackallIndex = 1;
                }
                else if (touchedLetter == blackallLetters[6])
                {
                    blackallIndex = 6;
                }
                else if (touchedLetter == blackallLetters[7])
                {
                    blackallIndex = 7;
                }
                KillLetter(touchedLetter);
                blackallLetters[blackallIndex] = null;
                numNonTrebellaLettersLeft--;
            }
        }

        // A
        if (touchedLetter == blackallLetters[2] || touchedLetter == blackallLetters[5])
        {
            if (unsolidifiedTrebellaLetters.Contains(touchedLetter))
            {
                FSoundManager.PlaySound("error");
                return;
            }

            int index;

            if (numTouchedAs == 0)
            {
                index = 7;
            }
            else
            {
                index = -1;
            }

            if (index != -1)
            {
                chain = TweenChainForLetter(touchedLetter, duration, trebellaFinalPositions[index].x, trebellaFinalPositions[index].y, extraRotation);
                numTouchedAs++;
                unsolidifiedTrebellaLetters.Add(touchedLetter);
            }
            else
            {
                int blackallIndex = 0;
                if (touchedLetter == blackallLetters[2])
                {
                    blackallIndex = 2;
                }
                else if (touchedLetter == blackallLetters[5])
                {
                    blackallIndex = 5;
                }
                KillLetter(touchedLetter);
                blackallLetters[blackallIndex] = null;
                numNonTrebellaLettersLeft--;
            }
        }

        // C
        if (touchedLetter == blackallLetters[3])
        {
            KillLetter(touchedLetter);
            blackallLetters[3] = null;
            numNonTrebellaLettersLeft--;
        }

        // K
        if (touchedLetter == blackallLetters[4])
        {
            KillLetter(touchedLetter);
            blackallLetters[4] = null;
            numNonTrebellaLettersLeft--;
        }

        if (chain != null)
        {
            chain.setOnCompleteHandler(OnTrebellaLetterInPlace);
            Go.addTween(chain);
            chain.play();
        }
    }
    public void UpdateSolidifyingTrebellaLetters()
    {
        timeSinceLastSolidifiedLetter += Time.deltaTime;

        if (timeSinceLastSolidifiedLetter > 0.5f)
        {
            timeSinceLastSolidifiedLetter -= 0.5f;

            FLabel nextLetterToChange = null;

            switch (numLettersSolidified)
            {
            case 0:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "T")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 1:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "R")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 2:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "E")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 3:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "B")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 4:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "E")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 5:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "L")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 6:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "L")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;

            case 7:
                foreach (FLabel letter in unsolidifiedTrebellaLetters)
                {
                    if (letter.text == "A")
                    {
                        nextLetterToChange = letter;
                        unsolidifiedTrebellaLetters.Remove(letter);
                        break;
                    }
                }
                break;
            }

            FSoundManager.PlaySound("bomb", 2.0f);
            FLabel solidifiedLetter = trebellaLetters[numLettersSolidified];
            solidifiedLetter.x = nextLetterToChange.x;
            solidifiedLetter.y = nextLetterToChange.y;
            nextLetterToChange.RemoveFromContainer();

            float duration = 0.2f;
            float distance = 5f;

            Tween bounce = new Tween(solidifiedLetter, duration, new TweenConfig()
                                     .setEaseType(EaseType.SineInOut)
                                     .floatProp("y", distance, true));

            Tween bounceBack = new Tween(solidifiedLetter, duration, new TweenConfig()
                                         .setEaseType(EaseType.SineInOut)
                                         .floatProp("y", -distance, true));

            TweenChain chain = new TweenChain();
            chain.setIterations(-1, LoopType.RestartFromBeginning);
            chain.append(bounce);
            chain.append(bounceBack);

            Go.addTween(chain);

            chain.play();

            numLettersSolidified++;

            if (numLettersSolidified >= 8)
            {
                trebellaLettersDoneSolidifying = true;
            }
        }
    }