private void updateCellColor(Vector2Int position, int Delta) { var newAvailabePositions = map.PositionsOf(map.pattern [patternIndex]); foreach (var go in MapGameObjectUtil.GetAllCells(gameObject)) { go.GetComponent <Animator>().SetBool("Glass", false); go.GetComponent <Animator> ().SetBool("Onoff", false); } foreach (var pos in newAvailabePositions) { //이 셀의 상하좌우 중 한칸에 플레이어가 있을 때만 if (((pos.x - position.x) * (pos.x - position.x) == Delta * Delta || (pos.y - position.y) * (pos.y - position.y) == Delta * Delta) && (pos.x - position.x) * (pos.y - position.y) == 0) { GameObject go; go = MapGameObjectUtil.GetCellGameObject(gameObject, pos); if (map.GlassLabelOf(pos).Value == Label.ANY.Value) { go.GetComponent <Animator> ().SetBool("Onoff", true); } else if (map.GlassLabelOf(pos).Value == map.pattern[patternIndex].Value) { go.GetComponent <Animator>().SetBool("Onoff", true); } } } }
/** * 그래픽 상으로 나타나는 Cell의 Transform Position을 불러온다. * TODO : 추후에 Logic과 분리 필요 */ public Vector2 ScenePosOf(Vector2Int pos) { var targetCell = MapGameObjectUtil.GetCellGameObject(gameObject, pos); Vector2 scenePos = targetCell.transform.position; return(scenePos); }
public void SetTrigger(Vector2Int pos, string name) { var cell = MapGameObjectUtil.GetCellGameObject(mapGameObject, pos); cell.GetComponent <Animator> ().SetTrigger(name); }