Example #1
0
    /// <summary>扣血</summary>
    public void OnEvent_ShowHP(E_HPType flag = 0)
    {
        AnimationPrefabEventData vo = new AnimationPrefabEventData();

        vo.HPPosition = TransHP.transform.position;

        Facade.Instance.SendNotification(NotificationID.Fight_AddHp, vo);
    }
    private void OnRec_AddHpEffect(INotification noti)
    {
        AnimationPrefabEventData vo = noti.Body as  AnimationPrefabEventData;

        UILabel lab = GameObject.Instantiate(m_Panel.addHPLabel);

        lab.transform.SetParent(m_Panel.transform);
        lab.transform.localScale = Vector3.one;
        lab.gameObject.SetActive(true);
        Vector3 screenPos = PVPManager.Instance.FightCamera.WorldToScreenPoint(vo.HPPosition);

        screenPos.z = 0;

        lab.transform.position = Main.CameraUI.ScreenToWorldPoint(screenPos);

        Vector3 endPos = lab.transform.position;

        endPos.y += 0.5f;
        lab.transform.DOMove(endPos, 1f).OnComplete(delegate() {
            GameObject.DestroyObject(lab.gameObject);
        });
    }