public void Back() { int step = 0; StepData stepData = StepSaver.BackStep(ref step); if (stepData != null) { SetCellToStone(stepData.NewCell, stepData.PrevCell, stepData.Stone, true); } if (step == 0) { OnStepMade?.Invoke(0); } //{ // if (b != null) // { // GameObject sender = b as GameObject; // if (sender != null) // { // UIElemSwitchValue uIElemSwitch = sender.GetComponent<UIElemSwitchValue>(); // uIElemSwitch.Switch(false); // } // } //} }
void onCellClick(Cell c) { Debug.Log("OnCellClick"); if (c.GetType() == typeof(CellContainer)) { return; } if (SelectedStone != null) { if (!SelectedStone.Interactable || !interactable) { return; } Cell stoneCell = SelectedStone.CellParent; int side = -1; Vector2Int diff = stoneCell.Position - c.Position; if (Mathf.Abs(diff.x) > Mathf.Abs(diff.y)) { if (diff.x > 0) { side = 0; } else { side = 1; } } else { if (diff.y > 0) { side = 2; } else { side = 3; } } if (stoneCell.GetType() == typeof(CellContainer)) { if (stoneCell.Position.x < 0) { side = 1; } else { side = 2; } } Cell targetCell = GetTargetCell(stoneCell.Position, side); // Debug.Log("GetTargetCell"); SetCellToStone(stoneCell, targetCell, SelectedStone); // Debug.Log("SetCellToStone"); StepSaver.AddStep(new StepData() { PrevCell = stoneCell, Stone = SelectedStone, NewCell = targetCell }); OnStepMade?.Invoke(1); //SelectedStone.Selected(false); //SelectedStone = null; // Debug.Log("cell cick finish"); // "".Replace("", "d"); } }