public void CreateDiceStructure(DiceType diceType) { currentDiceStructureType = diceType; GameObject structure; if (diceType.Equals(DiceType.Dice16)) { structure = diceStructure; } else if (diceType.Equals(DiceType.Dice13)) { structure = diceStructure13; } else { structure = diceStructure46; } currentDiceStructure = Instantiate(structure, GetCurrentPlayer().transform.position + (Vector3.up * 15), GetCurrentPlayer().transform.rotation); if (diceType.Equals(DiceType.Dice16)) { currentDice = currentDiceStructure.transform.Find("Dice").gameObject; } else if (diceType.Equals(DiceType.Dice13)) { currentDice = currentDiceStructure.transform.Find("Dice13").gameObject; } else { currentDice = currentDiceStructure.transform.Find("Dice46").gameObject; } }
public void ButtonItem(int numItem) { if (Players.GetItem(playerTurn, numItem).Equals(Item.Dice13)) { DestroyDiceStructure(); if (currentDiceStructureType.Equals(DiceType.Dice13)) { CreateDiceStructure(DiceType.Dice16); currentItemSelected = -1; } else { CreateDiceStructure(DiceType.Dice13); currentItemSelected = numItem; } } else if (Players.GetItem(playerTurn, numItem).Equals(Item.Dice46)) { DestroyDiceStructure(); if (currentDiceStructureType.Equals(DiceType.Dice46)) { CreateDiceStructure(DiceType.Dice16); currentItemSelected = -1; } else { CreateDiceStructure(DiceType.Dice46); currentItemSelected = numItem; } } else if (Players.GetItem(playerTurn, numItem).Equals(Item.Trap)) { int currentSquareNum = Players.GetCurrentSquare(playerTurn); if (Map.GetSquareType(currentSquareNum).Equals(SquareType.Empty)) { Instantiate(hammerSprite, Map.GetSquarePosition(currentSquareNum), Map.GetSquare(currentSquareNum).transform.rotation).transform.SetParent(Map.GetSquare(currentSquareNum).transform); Instantiate(hammer, GetCurrentPlayer().transform.position + new Vector3(0, -2, 0), GetCurrentPlayer().transform.rotation).transform.SetParent(Map.GetSquare(currentSquareNum).transform); Map.AddItemToSquare(currentSquareNum, Item.Trap); Map.GetSquare(currentSquareNum).GetComponent <MeshRenderer>().material.color = materialSoftGrey.color; Players.EliminateItem(playerTurn, numItem); } } else if (Players.GetItem(playerTurn, numItem).Equals(Item.BigTrap)) { int currentSquareNum = Players.GetCurrentSquare(playerTurn); if (Map.GetSquareType(currentSquareNum).Equals(SquareType.Empty)) { Instantiate(bigTrapSprite, Map.GetSquarePosition(currentSquareNum), Map.GetSquare(currentSquareNum).transform.rotation).transform.SetParent(Map.GetSquare(currentSquareNum).transform); Instantiate(bigTrap, Map.GetSquarePosition(currentSquareNum), GetCurrentPlayer().transform.rotation).transform.SetParent(Map.GetSquare(currentSquareNum).transform); Map.AddItemToSquare(currentSquareNum, Item.BigTrap); Map.GetSquare(currentSquareNum).GetComponent <MeshRenderer>().material.color = materialSoftGrey.color; Players.EliminateItem(playerTurn, numItem); } } else if (Players.GetItem(playerTurn, numItem).Equals(Item.ChangeDirection)) { //StartCoroutine(); } }