public void Init() { // System.Array facadeValues = System.Enum.GetValues (typeof(EFacadeType)); // FacadeType = (EFacadeType)facadeValues.GetValue (UnityEngine.Random.Range (0, facadeValues.Length)); // System.Array frameValues = System.Enum.GetValues (typeof(EFrameType)); // FrameType = (EFrameType)facadeValues.GetValue (UnityEngine.Random.Range (0, frameValues.Length)); System.Array patternColorValues = System.Enum.GetValues(typeof(EPatternColor)); PatternColor = (EPatternColor)patternColorValues.GetValue(UnityEngine.Random.Range(0, patternColorValues.Length)); }
public void Init() { // System.Array facadeValues = System.Enum.GetValues (typeof(EFacadeType)); // FacadeType = (EFacadeType)facadeValues.GetValue (UnityEngine.Random.Range (0, facadeValues.Length)); // System.Array frameValues = System.Enum.GetValues (typeof(EFrameType)); // FrameType = (EFrameType)facadeValues.GetValue (UnityEngine.Random.Range (0, frameValues.Length)); System.Array patternColorValues = System.Enum.GetValues (typeof(EPatternColor)); PatternColor = (EPatternColor)patternColorValues.GetValue (UnityEngine.Random.Range (0, patternColorValues.Length)); }
// Use this for initialization // void Start () { // // } // Update is called once per frame // void Update () { // // } public void Init(EPatternColor patternColor, bool _isTopFloor, bool _isBottomFloor, bool _isBasement) { isTopFloor = _isTopFloor; isBottomFloor = _isBottomFloor; isBasement = _isBasement; System.Array backgroundValues = System.Enum.GetValues(typeof(EBackgroundType)); BackgroundType = (EBackgroundType)backgroundValues.GetValue(UnityEngine.Random.Range(0, backgroundValues.Length)); if ((int)BackgroundType < BackgroundSprites.Count) { BackgroundSpriteRenderer.sprite = BackgroundSprites[(int)BackgroundType]; } if (isTopFloor) { ForegroundSpriteRenderer.sprite = ForegroundTopSprites[0]; } else if (isBottomFloor) { ForegroundSpriteRenderer.sprite = ForegroundBottomSprites[0]; } else if (isBasement) { ForegroundSpriteRenderer.sprite = ForegroundBasementSprites[0]; } else { ForegroundSpriteRenderer.sprite = ForegroundSprites[0]; } BackgroundFrameSpriteRenderer.sprite = BackgroundFrameSprites [0]; if (isBasement) { ForegroundPatternSpriteRenderer.sprite = null; } else { int variant = UnityEngine.Random.Range(0, 2); ForegroundPatternSpriteRenderer.sprite = ForegroundPatternSprites[((int)patternColor * 3) + variant]; } }
// Use this for initialization // void Start () { // // } // Update is called once per frame // void Update () { // // } public void Init(EPatternColor patternColor, bool _isTopFloor, bool _isBottomFloor, bool _isBasement) { isTopFloor = _isTopFloor; isBottomFloor = _isBottomFloor; isBasement = _isBasement; System.Array backgroundValues = System.Enum.GetValues(typeof(EBackgroundType)); BackgroundType = (EBackgroundType)backgroundValues.GetValue(UnityEngine.Random.Range(0, backgroundValues.Length)); if((int)BackgroundType < BackgroundSprites.Count) BackgroundSpriteRenderer.sprite = BackgroundSprites[(int)BackgroundType]; if(isTopFloor) { ForegroundSpriteRenderer.sprite = ForegroundTopSprites[0]; } else if(isBottomFloor) { ForegroundSpriteRenderer.sprite = ForegroundBottomSprites[0]; } else if(isBasement) { ForegroundSpriteRenderer.sprite = ForegroundBasementSprites[0]; } else { ForegroundSpriteRenderer.sprite = ForegroundSprites[0]; } BackgroundFrameSpriteRenderer.sprite = BackgroundFrameSprites [0]; if (isBasement) { ForegroundPatternSpriteRenderer.sprite = null; } else { int variant = UnityEngine.Random.Range(0, 2); ForegroundPatternSpriteRenderer.sprite = ForegroundPatternSprites[((int)patternColor * 3) + variant]; } }