Exemplo n.º 1
0
        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();
                }
            }
        }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 void Complete()
 {
     State = CupState.Complete;
     CupFactory?.Complete(this);
     if (limitLine != null)
     {
         Destroy(limitLine.gameObject);
     }
     foreach (var chip in Chips)
     {
         if (chip != null)
         {
             chip.Fix();
         }
     }
 }
Exemplo n.º 4
0
        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);
                }
            }
        }
Exemplo n.º 5
0
 /// <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);
     }
 }
Exemplo n.º 6
0
 private void ChangeCupState(CupState newState)
 {
     m_cupState = newState;
 }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     CupEdges.AddRange(GetComponentsInChildren <CupEdge>());
     State = CupState.Ready;
 }