public void Broken() { if (State == CupState.Pouring) { State = CupState.Broken; SE.Instance?.Play(brokenClip); CupFactory?.Broken(this); if (limitLine != null) { Destroy(limitLine.gameObject); } } foreach (var edge in CupEdges) { if (edge != null) { edge.Broken(); } } foreach (var chip in Chips) { if (chip != null) { chip.Broken(); } } }
public void AddChip(Chip chip) { if ((State != CupState.Ready && State != CupState.Pouring) || chip == null) { return; } Chips.Add(chip); chip.transform.SetParent(transform); if (State == CupState.Ready) { State = CupState.Pouring; } }
void Complete() { State = CupState.Complete; CupFactory?.Complete(this); if (limitLine != null) { Destroy(limitLine.gameObject); } foreach (var chip in Chips) { if (chip != null) { chip.Fix(); } } }
private void Intermission() // * Intermission: intermission scene or moment of pause where players can choose to continue or not (all press A to continue or something) { //intermissionComplete = false; if (m_passIntermissionAutomatically) { intermissionComplete = true; } if (intermissionComplete) { CupState targetState = IsCupComplete() == true ? CupState.CupEnd : CupState.StartRound; intermissionComplete = false; m_levelSelected = false; ChangeCupState(targetState); if (targetState == CupState.StartRound) { SceneManager.instance.ChangeScene(scn_LevelSelect); } } }
/// <summary> /// Determines whether the cup is upright, tilted, or overturned /// </summary> /// <returns>An enumerator</returns> private IEnumerator CupStateUpdateCoroutine() { while (true) { float zRotation = gameObject.transform.rotation.eulerAngles.z; if (zRotation >= 340 || zRotation <= 20) { cupState = CupState.Upright; } else if (zRotation >= 270 || zRotation <= 90) { cupState = CupState.Tilted; } else { cupState = CupState.Overturned; fill = 0; UpdateColor(); } yield return(wait); } }
private void ChangeCupState(CupState newState) { m_cupState = newState; }
// Use this for initialization void Start() { CupEdges.AddRange(GetComponentsInChildren <CupEdge>()); State = CupState.Ready; }