The way is click the empty space in the grid, and it will appear a bubble.
asking help for when i place a bubble, it will check it up. down, left , right to see have same bubble as the placed bubble.
if have more than 3 or more, it will destroy.
now i confuse is how to matching 3 or more bubble like the placed bubble up is same bubble named 1, than 1 also will check up down left right to check got any same bubble.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonsterExplode : MonoBehaviour {
public int minDistance = 1;
public bool canExplode;
MonsterManager monsterManager;
public GameObject boardManager;
public GameObject[] tempArrayR, tempArrayB, tempArrayY;
//----------------------------------------------------------------------------------
void Awake()
{
boardManager = GameObject.Find ("BoardManager");
monsterManager = boardManager.GetComponent<MonsterManager> ();
// tempArrayR = monsterManager.tempArrayR;
// tempArrayB = monsterManager.tempArrayB;
// tempArrayY = monsterManager.tempArrayY;
}
void Update()
{
tempArrayR = GameObject.FindGameObjectsWithTag ("onGridR");
if (canExplode == true)
{
for (int i = 0; i < tempArrayR.Length; i++)
if (tempArrayR *.tag != "onGridR")*
-
{*
_ Destroy (tempArrayR .transform.parent.gameObject);_
* }*
* }*
* }*
}
the code above is checking either the tag is same name, if yes destroy.