Example #1
0
    private void OnEnable()
    {
      HSBColor hsbColor = new HSBColor();
      hsbColor.h = UnityEngine.Random.value;
      hsbColor.s = 1.0f;
      hsbColor.b = 1.0f;

      Color color = hsbColor.ToColor();
      color.a = 1.0f;

      Light light = gameObject.GetComponent<Light>();
      light.color = color;

      SpriteRenderer spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
      spriteRenderer.color = color;

      sun = GameObject.FindObjectOfType<Sun>();
    }
Example #2
0
    private void OnEnable()
    {
      HSBColor hsbColor = new HSBColor();
      hsbColor.h = UnityEngine.Random.value;
      hsbColor.s = 1.0f;
      hsbColor.b = 1.0f;

      Color color = hsbColor.ToColor();
      color.a = 1.0f;

      Light light = gameObject.GetComponent<Light>();
      light.color = color;

      SpriteRenderer spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
      spriteRenderer.color = color;

      sun = GameObject.FindObjectOfType<Sun>();
    }
Example #3
0
        private void InstantiateFigure(int index)
        {
            if (index < figures.Count)
            {
                DestroyCurrentFigure();

                currentFigureIdx = index;

                currentFigure                         = Instantiate(figures[currentFigureIdx], Vector3.zero, Quaternion.identity) as GameObject;
                currentFigure.name                    = currentFigure.name.Replace("(Clone)", string.Empty);
                currentFigure.transform.parent        = this.gameObject.transform;
                currentFigure.transform.localPosition = Vector3.zero;

                currentFigure.GetComponent <SpriteColorRamp>().enabled  = currentFigureEnable;
                currentFigure.GetComponent <SpriteColorRamp>().palette  = currentPallete;
                currentFigure.GetComponent <SpriteColorRamp>().strength = currentStrenth;

                Sun sun = GameObject.FindObjectOfType <Sun>();
                if (sun != null)
                {
                    currentFigure.GetComponent <SpriteColorRamp>().LightMode = sun.LightMode;
                }
            }
        }