private void Awake() { MapInit(); AddToMap(this); _pang = null; state = State.Empty; tryPangList = new Queue <Tile>(); }
public PangClass(GameObject obj, Transform parent) { this.obj = obj; mainScript = obj.GetComponent <Pang>(); obj.transform.SetParent(parent); isActive = false; type = -1; id = -1; }
void movePos(Pang pang) { dragEvent = false; if (!tile || !pang.tile) { return; } if (pang.tile.state != Tile.State.Filled || tile.state != Tile.State.Filled) { return; } if (!tile.isNear(pang.tile)) { return; } pang.StartCoroutine("TrySwap", tile); //pang.StartCoroutine("TryFalling",tile); //StartCoroutine("TryFalling", pang.tile); }
//check pang recursively //_col, _row is 'Absolute' Coordinate private int CheckPangRcsv(Pang p, int _col, int _row) { if (IsOutOfBound(_col, _row)) { return(0); } var t = map[_col][_row]; if (_col > col) { _col++; } else if (_col < col) { _col--; } if (_row > row) { _row++; } else if (_row < row) { _row--; } if (t.state == State.Filled && p.ColorCmp(t.pang)) { return(1 + CheckPangRcsv(p, _col, _row)); } else { return(0); } }
public void Push(Pang pang) { pang.transform.position = new Vector2(4000, 4000); pool.Enqueue(pang); }
public bool ColorCmp(Pang other) { return(colorType == other.colorType); }
private bool CheckPang(Pang p, int _col, int _row) { return(CheckPangRcsv(p, _col + 1, _row) + CheckPangRcsv(p, _col - 1, _row) >= 2 || //Check Col 3 CheckPangRcsv(p, _col, _row + 1) + CheckPangRcsv(p, _col, _row - 1) >= 2); //Check Row 3 }