Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Traversing a game reel matrix column by column from left to right

I have a 3x5 matrix that acts as a game reel. First, I search through the game symbols that I am interested in (let's call them wild clones) and then I search through their children (to locate the game object that has the animation) and then I activate those animations.

private IEnumerator EnableWilds(float delayBetweenWildsAppear)
{            
    WildSymbol[] wilds = FindObjectsOfType<WildSymbol>();
    GameObject[] symbols = new GameObject[wilds.Length];
    for (int i = 0; i < wilds.Length; i++)
    {
        symbols[i] = wilds[i].gameObject;
    }

    for (int i = 0; i < symbols.Length; i++)
    {
        if ( symbols[i].name.Contains("(Clone)") )
        {
            int reelIndex   = symbols[i].GetComponentInParent<GameReel>().ReelIndex;
            int indexOnReel = symbols[i].GetComponent<WildSymbol>().IndexOnReel;

            // ??

            for (int j = 0; j < symbols[i].transform.childCount; j++)
            {
                if ( symbols[i].transform.GetChild(j).gameObject.name.Contains("MM_wild") )
                {
                    symbols[i].transform.GetChild(j).gameObject.SetActive(true);
                    yield return new WaitForSeconds(delayBetweenWildsAppear);
                }
            }
        }                
    }
}

I started thinking about how I can activate those wilds starting from the top left corner, and coming down the reel and moving on to the next reel and animating the wilds from top to bottom, etc...

So, I realized I need to get each symbol's reel index (i.e. column number) and index on reel (i.e. position on the reel) so I go Reel1 and then wild clone 1 and 2 and 3, and then Reel2 followed by wild clone 1 and 2 and 3, and so on...

I am trying to do this where I have put a // ?? but at this point, I am a bit lost, conceptually. I cannot figure out how to perform tghis traversal.

Could someone please help me with this?

My game reel 1

My game reel 2

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Here is how I solved it myself, and then simplified it:

private IEnumerator DisableWilds(float delayBetweenWildsDisappear)
{            
    WildSymbol[] wilds = FindObjectsOfType<WildSymbol>();

    wilds = wilds.Where( (item, index) => item.name.Contains("(Clone)")      )
                 .OrderBy( x => x.GetComponent<WildSymbol>().IndexOnReel     )
                 .OrderBy( x => x.GetComponentInParent<GameReel>().ReelIndex )
                 .ToArray();

    for (int i = 0; i < wilds.Length; i++)
    {
        for (int j = 0; j < wilds[i].transform.childCount; j++)
        {
            if (wilds[i].transform.GetChild(j).gameObject.name.Contains("MM_wild"))
            {
                wilds[i].transform.GetChild(j).gameObject.SetActive(false);

                yield return new WaitForSeconds(delayBetweenWildsDisappear);
            }
        }
    }
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda