private void RevealFromTorch() { for (int i = 0; i < torchesColor.Count; i++) { float torchDistance = Distance(torchesColor[i].transform.position); // if torch within distance to reveal message if (torchDistance <= platformRevealRange) { // if the torch is on if (torchesSwitch[i].GetTorchState()) { //Debug.Log("Torch On!"); // if the torch is the right colour if (torchesColor[i].GetColorState().Equals(revealWhen.ToString()) || revealWhen == ColorState.Any) { //Debug.Log("Correct Colour!"); float distanceRatio = (platformRevealRange - torchDistance) / platformRevealRange; if (alpha <= distanceRatio) { alpha += distanceRatio * platformRevealRate * 5f * Time.deltaTime; } } } } } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == state.ToString()) { audio.Play(); StartCoroutine(VibeTriangle()); GameController.Instance.ScorePlus(); if (other.gameObject.GetComponent <Bar>().IsLastBar()) { GameController.Instance.Nice(); } other.gameObject.SetActive(false); } else { GameController.Instance.GameOver(); } }
public string GetColorState() { return(currentColorState.ToString()); }