Esempio n. 1
0
    public void _NotifyFromROck(RockIt i_rock)
    {
        // change all to fail
        foreach (Crystal cry in Crystalls)
        {
            cry.changeToFail();
        }

        // reset active num to zero
        Num_Of_Actives = 0;
    }
Esempio n. 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!(this.gameObject.name == "Rock"))
     {
         Crystal _crystal = this.gameObject.GetComponent <Crystal>();
         if ((_crystal._state == PuzzleManager.State.OFF))
         {
             puzzleManager.Notify(this);
         }
     }
     else // if it is a rock
     {
         RockIt _rock = this.gameObject.GetComponent <RockIt>();
         if (!_rock.ToDeactivate)
         {
             puzzleManager.Notify(this);
         }
     }
 }
Esempio n. 3
0
    public void Notify(NotifierP i_notifier)
    {
        int seq = i_notifier.seqNo;   // check sequencce number // very Importanat

        // if it is rock then disable all
        if (i_notifier.gameObject.name == "Rock")
        {
            //for (int i=1; i<clusterParent[seq].transform.childCount; i++)       // deactivate all crystalls
            //{   //0th is Rock ALWAYS
            //    _colorIt = clusterParent[seq].transform.GetChild(i).GetComponent<Crystal>();
            //    _colorIt.changeToFail();
            //}

            // reset active numbers to zero
            _activeCrystalls[seq] = 0;
        }
        else
        {
            // increment the number of active crystals
            _activeCrystalls[seq]++;

            _colorIt = i_notifier.gameObject.transform.GetComponent <Crystal>();
            _colorIt.changeToActive();

            // if puzzle is complete
            if (_activeCrystalls[seq] == 9)
            {
                // destroy rock
                RockIt _rock = _rocks[seq];
                _rock.DestroyIt();

                // chnage puzzle state
                IsComplete[seq] = true;
            }
        }

        // check if all activated then set puzzle complete = true
    }