public void HandleWithHole(HoleBlock click) { if (click.IsSelected) { AudioManager.Instance.PlaySFXSound(SFXSoundType.ClickNegative); // 기존 holeBlock 재선택 click.IsSelected = false; this.groupIndicator = -1; HoleSupervisor.Instance.DequeueActiveID(ControllerID); } else { AudioManager.Instance.PlaySFXSound(SFXSoundType.ClickPositive); // 새로 선택 switch (groupIndicator) { case -1: // 활성화가 안된 다른 그룹에서 holeBlock 선택 click.IsSelected = true; this.groupIndicator = click.groupIndex; HoleSupervisor.Instance.EnqueueActiveID(ControllerID); break; default: // 활성화가 된 곳의 그룹 내의 다른 holeBlock 선택 // 마지막으로 조작한 곳을 end로 holeGroup[groupIndicator].IsSelected = false; click.IsSelected = true; this.groupIndicator = click.groupIndex; HoleSupervisor.Instance.SelectIDToEndQueue(ControllerID); break; } } }
private void ActionByLinkedHole(HoleBlock block) { AudioManager.Instance.PlaySFXSound(SFXSoundType.MoverEnter); bodyTransform.rotation = HoleSupervisor.Instance.FindOutletBlock(block.controllerID).transform.rotation; bodyTransform.position = HoleSupervisor.Instance.FindOutletBlock(block.controllerID).transform.position; if (HoleSupervisor.Instance.FindOutletBlock(block.controllerID).identifier == Identifier.Positive) { bodyMover.movingClockWise = true; bodyMover.switchingIdentifier = true; } else { bodyMover.movingClockWise = false; bodyMover.switchingIdentifier = false; } }
private void OnTriggerExit(Collider other) { if (!IsOntrigger) { if (other.gameObject.layer.Equals(9)) //holeBlock Layer { IsOntrigger = true; HoleBlock holeblock = other.GetComponent <HoleBlock>(); bool isSelected = holeblock.IsSelected; bool isHoleLinked = HoleSupervisor.Instance.activeControllerID.Count == 2; bool isActivated = HoleSupervisor.Instance.controllerGroup[holeblock.controllerID].IsActivated; switch (isActivated) { case true: switch (isSelected) // 충돌 블락 선택됨 { case true: switch (isHoleLinked) // 스택 카운트 2개 --> 텔레포트 할 곳 존재 { case true: ActionByLinkedHole(holeblock); break; case false: ActionByInverse(); break; } break; case false: // isSelected가 아니지만 activated된 상태의 컨트롤러의 어느 holeblock 충돌 ActionByInverse(); break; } break; case false: //activated 상태가 아닌 컨트롤러의 어느 holeblock 충돌 ActionByInverse(); break; } } } }
private void SetHoleBlock() { for (int i = 0; i < axisIndex; i++) { int j = 0; int k = 0; while (j < blockSize) // negative { GameObject block = Instantiate(holeBlockPrefab) as GameObject; HoleBlock holeBlock = block.GetComponent <HoleBlock>(); holeBlock.Initialize(i, j, blockSize); switchController[i, 0].holeGroup[j] = holeBlock; j++; } while (k < blockSize) // positive { GameObject block = Instantiate(holeBlockPrefab) as GameObject; HoleBlock holeBlock = block.GetComponent <HoleBlock>(); holeBlock.Initialize(i, blockSize, k); switchController[i, 1].holeGroup[k] = holeBlock; k++; } } }
private void SetHoleBlock(int blockSize) //axisIndex: 0 == x, 1 == y, 2 == z { for (int i = 0; i < _axisIndex; i++) { int j = 0; int k = 0; while (j < blockSize) // negative { GameObject block = Instantiate(holeBlockPrefab) as GameObject; HoleBlock holeBlock = block.GetComponent <HoleBlock>(); holeBlock.Initialize(i, j, blockSize); holeArray[i, 0, j] = holeBlock; j++; } while (k < blockSize) // positive { GameObject block = Instantiate(holeBlockPrefab) as GameObject; HoleBlock holeBlock = block.GetComponent <HoleBlock>(); holeBlock.Initialize(i, blockSize, k); holeArray[i, 1, k] = holeBlock; k++; } } }
public void DetectHoleClick(HoleBlock click, int index) { HandleWithHole(click); }