Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     if (randomChimney)
     {
         randomTypeNo       = Random.Range(0, (int)ChimneyType.NUM_OF_TYPES);
         currentChimneyType = (ChimneyType)randomTypeNo;
     }
     SetChimneyType(currentChimneyType);
 }
Beispiel #2
0
    public void SetChimneyType(ChimneyType ct)
    {
        switch (ct)
        {
        case ChimneyType.ORANGE:
            selectedChimney = orangeChimney;
            break;

        case ChimneyType.WHITE:
            selectedChimney = whiteChimney;
            break;

        case ChimneyType.BLUE:
            selectedChimney = blueChimney;
            break;

        case ChimneyType.PINK:
            selectedChimney = pinkChimney;
            break;

        case ChimneyType.RED:
            selectedChimney = redChimney;
            break;

        case ChimneyType.PURPLE:
            selectedChimney = purpleChimney;
            break;

        case ChimneyType.GREEN:
            selectedChimney = greenChimney;
            break;

        default:
            break;
        }

        chimneyTop.GetComponent <SpriteRenderer>().sprite           = selectedChimney[(sbyte)ChimneyPart.TOP];
        chimneyTopBackground.GetComponent <SpriteRenderer>().sprite = selectedChimney[(sbyte)ChimneyPart.TOP_BACKGROUND];
        chimneySides      = chimneySidesGenerator.sides;
        chimneyBackground = chimneySidesGenerator.chimneyBackgroundTiles;
        for (int i = 0; i < chimneySidesGenerator.sides.Length; i++)
        {
            chimneySides[i].GetComponent <SpriteRenderer>().sprite      = selectedChimney[(sbyte)ChimneyPart.SIDES];
            chimneyBackground[i].GetComponent <SpriteRenderer>().sprite = selectedChimney[(sbyte)ChimneyPart.MAIN_BACKGROUND];
        }
        chimneyHearth.GetComponent <SpriteRenderer>().sprite            = selectedChimney[(sbyte)ChimneyPart.HEARTH];
        chimneyHearthBackground.GetComponent <SpriteRenderer>().sprite  = selectedChimney[(sbyte)ChimneyPart.HEARTH_BACKGROUND];
        chimneyBackgroundDetails.GetComponent <SpriteRenderer>().sprite = selectedChimney[(sbyte)ChimneyPart.BACKGROUND_DETAILS];
    }