bool LoadBlock()
 {
     startingBlock = GameObject.Find("StartingBlock");
     if (startingBlock == null)
     {
         startingBlock = GameObject.Find("bgeL0");
         if (startingBlock == null)
         {
             MyBlockInfo info = UnityEngine.Object.FindObjectOfType <MyBlockInfo>();
             if (info != null)
             {
                 startingBlock = info.gameObject;
             }
             if (startingBlock == null)
             {
                 validBlock = false; return(validBlock);
             }
             else
             {
                 validBlock = true; return(validBlock);
             }
         }
         else
         {
             validBlock = true; return(validBlock);
         }
     }
     else
     {
         validBlock = true; return(validBlock);
     }
 }
    public override void Initialize()
    {
        if (initialized)
        {
            return;
        }

        BlockBehaviour block = PrefabMaster.GetBlock(myIndex);

        if (block != null)
        {
            blockInfo = block.GetComponent <MyBlockInfo>();
        }

        initialized = true;
    }
示例#3
0
        //载入模块
        void LoadBlock()
        {
            try
            {
                targetBlock = GameObject.Find("StartingBlock");
                // Dlight = GameObject.Find("Directional light");
            }
            catch { }

            if (targetBlock == null)
            {
                targetBlock = GameObject.Find("bgeL0");
                if (targetBlock == null)
                {
                    MyBlockInfo info = UnityEngine.Object.FindObjectOfType <MyBlockInfo>();
                    if (info != null)
                    {
                        targetBlock = info.gameObject;
                    }
                    //if (targetBlock == null)
                    //{
                    //    validBlock = false;
                    //}
                    //else
                    //{
                    //    validBlock = true;
                    //}

                    validBlock = (targetBlock == null ? false : true);
                }
                else
                {
                    validBlock = true;
                }
            }
            else
            {
                validBlock = true;
            }

#if DEBUG
            ConsoleController.ShowMessage(targetBlock.name);
#endif
        }