示例#1
0
 void Start()
 {
     blockClass  = new List <Block>();
     curr        = GetComponent <Ball>();
     paddleClass = Paddle.GetComponent <Paddle>();
     foreach (GameObject blocks in Block)
     {
         Block some = blocks.GetComponent <Block>();
         blockClass.Add(some);
     }
     speed         = DataScript.ball_speed;
     randValue     = Random.Range(0, sign.Length);
     position      = transform.position;
     ball_Collider = GetComponent <Collider2D>();
     if (WallR != null)
     {
         WallR_Collider = WallR.GetComponent <BoxCollider2D>();
     }
     if (WallL != null)
     {
         WallL_Collider = WallL.GetComponent <BoxCollider2D>();
     }
     if (Paddle != null)
     {
         paddle_Collider = Paddle.GetComponent <BoxCollider2D>();
     }
     if (Ceil != null)
     {
         Ceil_Collider = Ceil.GetComponent <BoxCollider2D>();
     }
 }
    // Start is called before the first frame update

    void Awake()
    {
        int pieces = FindObjectOfType <DungeonMaster>().GetProgress();

        Debug.Log("Disabling House Objects");
        FloorL.GetComponent <Renderer>().enabled = false;
        FloorR.GetComponent <Renderer>().enabled = false;
        WallL.GetComponent <Renderer>().enabled  = false;
        WallR.GetComponent <Renderer>().enabled  = false;
        fillerDisable();
        Roof.GetComponent <Renderer>().enabled    = false;
        door.GetComponent <Renderer>().enabled    = false;
        window1.GetComponent <Renderer>().enabled = false;
        Bonfire.GetComponent <Renderer>().enabled = false;
        Debug.Log("Case : " + pieces);
        switch (pieces)
        {
        case 0:

            //Nothing Enabled
            break;

        case 1:
            FloorL.GetComponent <Renderer>().enabled = true;
            FloorR.GetComponent <Renderer>().enabled = true;
            break;

        case 2:
            FloorL.GetComponent <Renderer>().enabled = true;
            FloorR.GetComponent <Renderer>().enabled = true;
            WallL.GetComponent <Renderer>().enabled  = true;
            WallR.GetComponent <Renderer>().enabled  = true;
            break;

        case 3:
            FloorL.GetComponent <Renderer>().enabled = true;
            FloorR.GetComponent <Renderer>().enabled = true;
            WallL.GetComponent <Renderer>().enabled  = true;
            WallR.GetComponent <Renderer>().enabled  = true;
            fillerEnable();
            door.GetComponent <Renderer>().enabled = true;
            break;

        case 4:
            FloorL.GetComponent <Renderer>().enabled = true;
            FloorR.GetComponent <Renderer>().enabled = true;
            WallL.GetComponent <Renderer>().enabled  = true;
            WallR.GetComponent <Renderer>().enabled  = true;
            fillerEnable();
            door.GetComponent <Renderer>().enabled    = true;
            window1.GetComponent <Renderer>().enabled = true;
            break;

        case 5:
            FloorL.GetComponent <Renderer>().enabled = true;
            FloorR.GetComponent <Renderer>().enabled = true;
            WallL.GetComponent <Renderer>().enabled  = true;
            WallR.GetComponent <Renderer>().enabled  = true;
            fillerEnable();
            door.GetComponent <Renderer>().enabled    = true;
            window1.GetComponent <Renderer>().enabled = true;
            Roof.GetComponent <Renderer>().enabled    = true;
            break;

        default:
            FloorL.GetComponent <Renderer>().enabled = true;
            FloorR.GetComponent <Renderer>().enabled = true;
            WallL.GetComponent <Renderer>().enabled  = true;
            WallR.GetComponent <Renderer>().enabled  = true;
            fillerEnable();
            door.GetComponent <Renderer>().enabled    = true;
            window1.GetComponent <Renderer>().enabled = true;
            Bonfire.GetComponent <Renderer>().enabled = true;
            break;
        }
    }