예제 #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("Bubble"))
     {
         BubbleConnector otherBubble = other.GetComponent <BubbleConnector> ();
         if (otherBubble.color == colors[color] || !started)
         {
             Destroy(other.gameObject);
             hit();
         }
     }
 }
예제 #2
0
    /*void Update(){
     *      if( amBoss == false){
     *              if( isFree == true ){
     *                      transform.Rotate(randomRotate, randomSpeed * Time.deltaTime * 5);
     *              }else{
     *                      transform.Rotate (
     *                              Movement.instance.lever.position - Movement.instance.leverBase.position,
     *                              50 * Time.deltaTime
     *                      );
     *              }
     *      }
     * }*/

    void OnTriggerEnter(Collider other)
    {
        if (gameObject.layer == LayerMask.NameToLayer("Bubble") && other.gameObject.layer == LayerMask.NameToLayer("Boss"))
        {
            BubbleConnector otherBubble = other.GetComponent <BubbleConnector>();

            if (otherBubble != null && otherBubble.color == color)
            {
                bool isThirdInChain = false;
                foreach (BubbleConnector bubble in otherBubble.connections)
                {
                    if (bubble.color == color)
                    {
                        isThirdInChain = true;
                    }
                }

                if (isThirdInChain == true)
                {
                    otherBubble.DestroyMeAndMyChain();
                    Destroy(gameObject);

                    checkAndDestroyLeftovers();
                }
                else
                {
                    connectNewBubble(other);
                }
            }
            else
            {
                if (otherBubble == null)
                {
                    this.isRoot = true;
                }
                connectNewBubble(other);
            }
        }
    }
예제 #3
0
 static void Register(BubbleConnector myself)
 {
     registeredBubbles.Add(myself);
 }