示例#1
0
 void Awake()
 {
     moduleId = moduleIdCounter++;
     foreach (hexTile tile in tiles)
     {
         hexTile pressedTile = tile;
         tile.selectable.OnInteract += delegate() { TilePress(pressedTile); return(false); };
     }
 }
示例#2
0
 void TilePress(hexTile tile)
 {
     if (moduleSolved || tile.tileTaken)
     {
         return;
     }
     GetComponent <KMSelectable>().AddInteractionPunch();
     if (tile.legalTile && tile.finishingTile)
     {
         Debug.LogFormat("[Blockbusters #{0}] You pressed {1}. That is correct. Module disarmed.", moduleId, tile.containedLetter.text);
         GetComponent <KMBombModule>().HandlePass();
         Audio.PlaySoundAtTransform("theme", transform);
         lastPressedTile           = tile;
         tile.containedLetter.text = "";
         tile.tileTaken            = true;
         foreach (hexTile allTaken in tiles)
         {
             if (allTaken.tileTaken)
             {
                 allTaken.GetComponent <Renderer>().material = tileMats[2];
             }
         }
         foreach (hexTile allTiles in tiles)
         {
             allTiles.legalTile = false;
         }
         moduleSolved = true;
         StartCoroutine(Disco());
     }
     else if (tile.legalTile)
     {
         Audio.PlaySoundAtTransform("buzzer", transform);
         lastPressedTile = tile;
         Debug.LogFormat("[Blockbusters #{0}] You pressed {1}. That is correct.", moduleId, tile.containedLetter.text);
         foreach (hexTile allTaken in tiles)
         {
             if (allTaken.tileTaken)
             {
                 allTaken.GetComponent <Renderer>().material = tileMats[2];
             }
         }
         tile.GetComponent <Renderer>().material = tileMats[1];
         tile.containedLetter.text = "";
         tile.tileTaken            = true;
         foreach (hexTile allTiles in tiles)
         {
             allTiles.legalTile = false;
         }
         SetTileTwo();
     }
     else
     {
         Debug.LogFormat("[Blockbusters #{0}] Strike! You pressed {1}. That is incorrect. Resetting grid.", moduleId, tile.containedLetter.text);
         GetComponent <KMBombModule>().HandleStrike();
         foreach (hexTile allTiles in tiles)
         {
             allTiles.legalTile = false;
             allTiles.tileTaken = false;
         }
         Start();
     }
 }