Exemplo n.º 1
0
    public void PlayValueNotice(int value, ValueNoticeType noticeType)
    {
        var worldPos  = transform.position + new Vector3(0, 0.5f, 0);
        var screenPos = Camera.main.WorldToScreenPoint(worldPos);
        var noticeObj = ResourceManager.Instance.LoadUIPrefab(UIConst.VALUE_NOTICE, UILayer.Notice);

        noticeObj.transform.position = screenPos;
        noticeObj.GetComponent <ValueNotice>().SetValue(value, noticeType);
    }
Exemplo n.º 2
0
    public void SetValue(int value, ValueNoticeType noticeType)
    {
        switch (noticeType)
        {
        case ValueNoticeType.Damage:
            _value.text  = "-" + value.ToString();
            _value.color = Color.red;
            break;

        case ValueNoticeType.Heal:
            _value.text  = "+" + value.ToString();
            _value.color = Color.green;
            break;
        }

        gameObject.transform.DOMoveY(gameObject.transform.position.y + 50, 0.3f).OnComplete(() =>
        {
            Destroy(gameObject);
        });
    }