Example #1
0
    /// <summary>
    /// 적의 최대 이동 범위를, 적이 처음 도발당한 위치를 기준으로 표시합니다.
    /// 이 표시는 점점 선명해지고 자동으로 사라지지 않습니다.
    /// </summary>
    /// <returns></returns>
    IEnumerator LeaveDistanceAnimation()
    {
        if (myDistanceSprite != null)
        {
            myDistanceSprite.GetComponent <DistanceSprite>().Disappear();
            myDistanceSprite = null;
        }
        Vector3 v = new Vector3(tauntedPosition.x, tauntedPosition.y, -0.25f);

        myDistanceSprite = Instantiate(distanceSprite, v, Quaternion.identity);
        if (distanceType != DistanceType.None)
        {
            myDistanceSprite.GetComponent <SpriteRenderer>().sprite =
                Resources.Load(distanceType.ToString() + leaveDistance, typeof(Sprite)) as Sprite;
        }
        float frame = 20f;

        for (int i = 0; i < frame; i++)
        {
            if (myDistanceSprite == null)
            {
                break;
            }
            myDistanceSprite.GetComponent <SpriteRenderer>().color =
                Color.Lerp(new Color(0.6f, 0f, 0f, 0f), ColorManager.ChangeAlpha(new Color(0.6f, 0f, 0f, 0f), 1f), i / frame);
            yield return(null);
        }
    }
    IEnumerator DisappearAnimation(int frame)
    {
        isDisappearing = true;
        Color c = GetComponent <SpriteRenderer>().color;

        for (int i = 0; i < frame; i++)
        {
            GetComponent <SpriteRenderer>().color = Color.Lerp(c, ColorManager.ChangeAlpha(c, 0f), i / (float)frame);
            yield return(null);
        }
        GetComponent <SpriteRenderer>().color = ColorManager.ChangeAlpha(c, 0f);
        Destroy(gameObject);
    }
Example #3
0
 public void EscapeAltar()
 {
     if (whitePanel.activeInHierarchy)
     {
         return;
     }
     GameManager.gm.NextTurnFromAltar();
     orbs = new List <KeyValuePair <int, string> >();
     UpdateUI();
     for (int i = 0; i < 3; i++)
     {
         circlePartImages[i].GetComponent <Image>().color = ColorManager.ChangeAlpha(Color.black, 0f);
     }
     combineButton.interactable = false;
     gameObject.SetActive(false);
 }
    IEnumerator Disappear()
    {
        Vector3 originalPosition = GetComponent <RectTransform>().localPosition;
        Color   originalColor    = new Color(1f, 1f, 1f, 1f);
        float   frame            = 32f;

        for (int i = 0; i < frame; i++)
        {
            GetComponent <RectTransform>().localPosition = Vector3.Lerp(originalPosition, originalPosition + new Vector3(0f, 15f, 0f), i / frame);
            foreach (GameObject g in numbers[exp])
            {
                g.GetComponent <Image>().color = Color.Lerp(originalColor, ColorManager.ChangeAlpha(originalColor, 0f), i / frame);
            }
            criticalMarks[exp].GetComponent <Image>().color = Color.Lerp(originalColor, ColorManager.ChangeAlpha(originalColor, 0f), i / frame);
            yield return(null);
        }
        Destroy(gameObject);
    }
Example #5
0
    IEnumerator FadeOut()
    {
        time = -1f;
        int frame = 16;

        for (int i = 0; i < frame; i++)
        {
            foreach (Image im in GetComponentsInChildren <Image>())
            {
                im.color = Color.Lerp(ColorManager.ChangeAlpha(im.color, 1f), ColorManager.ChangeAlpha(im.color, 0f), i / (float)frame);
            }
            foreach (Text t in GetComponentsInChildren <Text>())
            {
                t.color = Color.Lerp(ColorManager.ChangeAlpha(t.color, 1f), ColorManager.ChangeAlpha(t.color, 0f), i / (float)frame);
            }
            yield return(null);
        }
        Destroy(gameObject);
    }
Example #6
0
    IEnumerator CircleOffAnimation(int index)
    {
        Color end   = ColorManager.ChangeAlpha(Color.black, 0f);
        Color start = circlePartImages[index].GetComponent <Image>().color;
        float frame = 10f;

        for (int i = (int)(circlePartImages[index].GetComponent <Image>().color.a *frame); i >= 0; i--)
        {
            circlePartImages[index].GetComponent <Image>().color = Color.Lerp(end, start, i / frame);
            yield return(null);

            if (index < orbs.Count)
            {
                yield break;
            }
        }
        circlePartImages[index].GetComponent <Image>().color = end;
        circlePartImages[index].SetActive(false);
    }
Example #7
0
    IEnumerator WhiteAnimation()
    {
        whitePanel.SetActive(true);
        whitePanel.GetComponent <Image>().color = ColorManager.ChangeAlpha(whitePanel.GetComponent <Image>().color, 0f);
        float frame = 12f;

        for (int i = 0; i < frame; i++)
        {
            whitePanel.GetComponent <Image>().color = Color.Lerp(ColorManager.ChangeAlpha(whitePanel.GetComponent <Image>().color, 0f),
                                                                 ColorManager.ChangeAlpha(whitePanel.GetComponent <Image>().color, 0.5f), i / frame);
            yield return(null);
        }
        for (int i = 0; i < frame / 4f; i++)
        {
            whitePanel.GetComponent <Image>().color = Color.Lerp(ColorManager.ChangeAlpha(whitePanel.GetComponent <Image>().color, 0.5f),
                                                                 ColorManager.ChangeAlpha(whitePanel.GetComponent <Image>().color, 0f), i * 4 / frame);
            yield return(null);
        }

        whitePanel.GetComponent <Image>().color = ColorManager.ChangeAlpha(whitePanel.GetComponent <Image>().color, 0f);
        whitePanel.SetActive(false);

        combineButton.interactable = false;
    }
Example #8
0
    /// <summary>
    /// 적의 시야 범위를 바닥에 표시합니다.
    /// 이 표시는 점점 투명해지다가 사라집니다.
    /// </summary>
    /// <param name="enemyPos"></param>
    /// <returns></returns>
    IEnumerator SightDistanceAnimation(Vector3 enemyPos)
    {
        if (myDistanceSprite != null)
        {
            myDistanceSprite.GetComponent <DistanceSprite>().Disappear();
            myDistanceSprite = null;
        }
        Vector3 v = new Vector3(enemyPos.x, enemyPos.y, -0.25f);

        myDistanceSprite = Instantiate(distanceSprite, v, Quaternion.identity);
        if (distanceType != DistanceType.None)
        {
            myDistanceSprite.GetComponent <SpriteRenderer>().sprite =
                Resources.Load(distanceType.ToString() + sightDistance, typeof(Sprite)) as Sprite;
        }
        float frame = 40f;

        for (int i = 0; i < frame; i++)
        {
            if (myDistanceSprite == null)
            {
                break;
            }
            myDistanceSprite.GetComponent <SpriteRenderer>().color = Color.Lerp(Color.yellow, ColorManager.ChangeAlpha(Color.yellow, 0f), i / frame);
            yield return(null);
        }
        myDistanceSprite.GetComponent <DistanceSprite>().Disappear(0);
        myDistanceSprite = null;
        StartCoroutine(LeaveDistanceAnimation());
    }