public CDie(CIcon icon, IDieObserver observer) { this.icon = icon; this.observer = observer; CAnimations .Highlight(icon.transform.position) .SetColor(icon.color) .SetListener(this); }
public bool IsNeighbour(CIcon target) { if (this == target) { return(false); } int rowDistance = Mathf.Abs(cell.row - target.cell.row); int colDistance = Mathf.Abs(cell.col - target.cell.col); return((rowDistance == 1 && colDistance == 0) || (rowDistance == 0 && colDistance == 1)); }
public void OnEndMoveComplete(CIcon icon) { if (IsFinished()) { return; } icon.SetState(EState.Idle); moving.Remove(icon); if (IsFinished() && listener != null) { listener.OnMoveEnd(); } }
public bool AddMove(CIcon icon, Vector3 pos) { if (icon.transform.position == pos) { return(false); } else { moving.Add(icon); icon.SetState(EState.Movement); icon.gameObject.transform .DOMove(pos, CGame.Config.match.gems.movingTime) .OnComplete(() => OnEndMoveComplete(icon)); return(true); } }
public bool IsMatchable(CIcon icon) { return(icon.color == this.color); }