#https hatebin com sgyawgbsad

1 messages · Page 1 of 1 (latest)

blazing gazelle
#

here

amber ibex
#

That code is super convoluted and unreadable.
Describe in short what it is supposed to achieve

orchid oasis
#

basically If you place a dice with the same number as the opposite side it gets rid of all the opposite sides dice that have the same value and sets the isOccupied bool back to false so you can put dice back in that slot

#

in the video it works perfect on the left side top row but no where else

#

in other areas its funky

amber ibex
#

is Tile a script that represent your slots for dices?

orchid oasis
#

yes

#

i can send the tile script if you want

amber ibex
#

What does Dice1 represent then? Why is the code in Start?

orchid oasis
#

Dice1 is the script i put on the dice that is a one Dice6 goes on 6

#

its in start so that when a clone gets made it checks the other side once

#

should i send the vid in here?

amber ibex
#

yes

hallow depot
#

hello i didnt understand your question but i think using switch statement in your code will make your life much better

switch(GameObject.Find("p1r2c1").transform.childCount)
{
case 0:
GameObject.Find("p1r2c1").GetComponent<Tile>().isOccupied = false;
break;
case 1:
GameObject.Find("p1r2c1").GetComponent<Tile>().isOccupied = false;
break;
orchid oasis
#

what does that do

hallow depot
# orchid oasis what does that do

its like if but for that one condition with multiple values like the
GameObject.Find("p1r2c1").transform.childCount
in your code

syntax :

switch(condition)
{
case 1:
do something
break;
case 2:
do something2
break;}
orchid oasis
#

i see

#

ill try that

amber ibex
#

Here's how I'd do it:

  1. Have a game logic manager above at the root of the hierarchy.
  2. Have both grids parented to it and add a Grid script that manages each grid.
  3. Grid would hold an array of Tiles referencing the tiles underneath it.
  4. Have your die rolling logic in the game logic manager.
  5. When you place a die on one of the Grids, ask the other Grid to clear any Tiles that may contain a die of the same number that was rolled.
  6. Finally place a die on the Grid.
#

You don't need to find anything, nor compare tags or parents.

orchid oasis
#

i can attempt that too