Пример #1
0
    public GameObject GetBrickBasedOnType(BrickType type)
    {
        switch (type)
        {
        case BrickType.NORMAL:
            return(GenerateNormalBrick());

        case BrickType.BOMB:
            return(GenerateBombBrick());

        case BrickType.END:
            return(GeneratePortalBrick());

        case BrickType.UNBREAKABLE:
            return(GenerateUnbreakableBrick());

        case BrickType.BOOM_BOT:
            return(GenerateBoomBot());

        case BrickType.RANDOM_BLOW:
            return(GenerateRadomBlowBrick());

        default:
            Debug.LogWarning("Could not find brick gameobject for type : " + type.ToString() + "\n Returning normal type");
            return(GenerateNormalBrick());
        }
    }
Пример #2
0
    //private void Awake()
    //{
    //    InitBrick();
    //}

    public void InitBrick()
    {
        GetComponent <Collider>().isTrigger = true;
        SetBrickWidth();
        transform.tag = brickType.ToString();
        switch (brickType)
        {
        case BrickType.Entiy:
            GetComponent <Renderer>().material.color = Color.black;
            break;

        case BrickType.Hollow:
            GetComponent <Renderer>().enabled = false;
            //GetComponent<Renderer>().material.color = Color.white;
            break;

        case BrickType.Bad:
            GetComponent <Renderer>().material.color = Color.red;
            break;

        case BrickType.Undefined:
            GetComponent <Renderer>().material.color = Color.yellow;
            break;

        default:
            break;
        }
    }
Пример #3
0
 public override string ToString()
 {
     return(position + ", " + brickType.ToString());
 }