Exemple #1
0
    public static void PlayEffect(Transform root, Vector3 pos, string name, StarColorEnum color, Vector3 offset = default(Vector3))
    {
        Debug.Log(name);
        GameObject obj    = Resources.Load(ResoucesPathEnum.effectPath + name, typeof(GameObject)) as GameObject;
        GameObject effect = GameObject.Instantiate(obj);

        effect.transform.SetParent(root);
        effect.SetActive(true);
        effect.transform.position      = pos;
        effect.transform.localScale    = Vector3.one;
        effect.transform.localRotation = Quaternion.identity;
        effect.transform.localPosition = effect.transform.localPosition + offset;
        EffectDestroy  destory   = effect.AddComponent <EffectDestroy>();
        ParticleSystem particle  = effect.GetComponent <ParticleSystem>();
        Color          tempColor = new Color();

        switch (color)
        {
        case StarColorEnum.BLUE:
            tempColor = ColorUtils.GetColorByRGBA(68, 190, 255);
            break;

        case StarColorEnum.GREEN:
            tempColor = ColorUtils.GetColorByRGBA(102, 202, 27);
            break;

        case StarColorEnum.PURPLE:
            tempColor = ColorUtils.GetColorByRGBA(192, 60, 255);
            break;

        case StarColorEnum.RED:
            tempColor = ColorUtils.GetColorByRGBA(225, 69, 110);
            break;

        case StarColorEnum.YELLOW:
            tempColor = ColorUtils.GetColorByRGBA(253, 181, 13);
            break;
        }
        float showTime = 0;

        if (particle != null)
        {
            showTime = particle.startLifetime;
            Renderer render = particle.GetComponent <Renderer>();
            // render.material.SetColor("_Color",tempColor);
        }
        destory.SetDelayTime(showTime);
    }
Exemple #2
0
    public void SetColor(StarColorEnum color)
    {
        m_color = color;

        /*  switch (m_color)
         * {
         *    case StarColorEnum.BLUE:
         *        m_image.color = ColorUtils.GetColorByRGBA(68, 190, 255);
         *        break;
         *    case StarColorEnum.GREEN:
         *        m_image.color = ColorUtils.GetColorByRGBA(102, 202, 27);
         *        break;
         *    case StarColorEnum.PURPLE:
         *        m_image.color = ColorUtils.GetColorByRGBA(192, 60, 255);
         *        break;
         *    case StarColorEnum.RED:
         *        m_image.color = ColorUtils.GetColorByRGBA(225, 69, 110);
         *        break;
         *    case StarColorEnum.YELLOW:
         *        m_image.color = ColorUtils.GetColorByRGBA(253, 181, 13);
         *        break;
         * }*/
        switch (m_color)
        {
        case StarColorEnum.GREEN:
            GUIHelper.ChangeUIImage(m_image, ResoucesPathEnum.starImagePath, "kuai_01");
            break;

        case StarColorEnum.YELLOW:
            GUIHelper.ChangeUIImage(m_image, ResoucesPathEnum.starImagePath, "kuai_02");
            break;

        case StarColorEnum.BLUE:
            GUIHelper.ChangeUIImage(m_image, ResoucesPathEnum.starImagePath, "kuai_03");
            break;

        case StarColorEnum.PURPLE:
            GUIHelper.ChangeUIImage(m_image, ResoucesPathEnum.starImagePath, "kuai_04");
            break;

        case StarColorEnum.RED:
            GUIHelper.ChangeUIImage(m_image, ResoucesPathEnum.starImagePath, "kuai_05");
            break;
        }
    }
Exemple #3
0
 private void SeletColor(Star star)
 {
     Debug.Log(star.GetColor().ToString());
     m_changeColor = star.GetColor();
     changeStarRoot.gameObject.SetActive(false);
 }