Example #1
0
    public void ShowHurtUiEffect(EntityModel entityModel, uint bulletId)
    {
        if (entityModel == null)
        {
            return;
        }

        BulletData    bulletData   = SkillDataManager.Instance.GetBulletData((int)bulletId);
        RoleBehaviour roleBehavior = entityModel.GO.GetComponent <RoleBehaviour>();


        if (null != roleBehavior && null != roleBehavior.HurtPoint)
        {
            if (bulletData != null)
            {
                if (null != bulletData.m_hurt_Ui_Effect)
                {
                    GameObject uiEffectObj = GameObjectPool.Instance.AcquireLocal(bulletData.m_hurt_Ui_Effect, Vector3.zero, Quaternion.identity);
                    uiEffectObj.transform.parent = PopupObjManager.Instance.UICamera.transform;
                    Vector3 uiPosition = PopupTextController.GetPopupPos(roleBehavior.HurtPoint.position, PopupObjManager.Instance.UICamera);
                    uiEffectObj.transform.position = uiPosition;
                }
            }
            else
            {
                TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "没子弹数据");
            }
        }
        else
        {
            TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "没受击点");
        }
    }
Example #2
0
    IEnumerator Rise(Vector3 startPos, Vector3 endPos)
    {
        float i    = 0;
        float rate = 1f / m_riseTime;

        GameObject movePoint = new GameObject();

        movePoint.transform.parent        = m_heroGO.transform;
        movePoint.transform.localPosition = Vector3.zero;
        movePoint.transform.localScale    = Vector3.one;

        while (i < 1f)
        {
            i += Time.deltaTime * rate;

            movePoint.transform.localPosition = Vector3.Lerp(startPos, endPos, i);
            Vector3 uiPos = PopupTextController.GetPopupPos(movePoint.transform.position, m_uiCamera);

            transform.position = uiPos;

            yield return(null);
        }

        Destroy(movePoint);
        yield return(new WaitForSeconds(m_stayTime));

        Destroy(gameObject);
    }
Example #3
0
    private void ShowPopUp()
    {
        if (HostPosition != null)
        {
            Vector3 uiPos = PopupTextController.GetPopupPos(HostPosition.Value, PopupObjManager.Instance.UICamera);
            transform.position = uiPos;
            switch (this.FightEffectType)
            {
            case global::FightEffectType.BATTLE_EFFECT_CRIT:
                m_tweenScale.from       = transform.localScale;
                m_tweenScale.to         = transform.localScale * CritScale;
                m_tweenPosition.enabled = false;
                m_tweenScale.enabled    = true;
                break;

            case FightEffectType.BATTLE_ADDHP:
            case FightEffectType.BATTLE_ADDMONEY:
            case FightEffectType.BATTLE_ADDMP:
            case FightEffectType.BATTLE_EFFECT_DODGE:
            case FightEffectType.BATTLE_EFFECT_HIT:
            case FightEffectType.BATTLE_EFFECT_HP:
            case FightEffectType.BATTLE_EFFECT_EXPSHOW:
                AnimShow();
                break;

            case FightEffectType.TOWN_EFFECT_ZHANLI:
                AnimShow();
                break;
            }
            m_tweenAlpha.enabled = true;
        }
    }
Example #4
0
        void Update()
        {
            //if (Input.GetKeyDown(KeyCode.C))
            //{
            //    StartCoroutine(Start());
            //}
            //if (Input.GetKeyDown(KeyCode.S))
            //{
            //    SaveLevel();
            //}
            if (null == HeroTransform)
            {
                TypeID      entityType      = TypeID.TYPEID_BOX;
                Int64       uid             = PlayerManager.Instance.FindHeroDataModel().UID;
                EntityModel HeroEntityModel = EntityController.Instance.GetEntityModel(uid, out entityType);
                if (HeroEntityModel != null && HeroEntityModel.GO != null)
                {
                    HeroTransform = HeroEntityModel.GO.transform;
                }
            }

            if (IsShow && null != HeroTransform)
            {
                Vector3 ShowPosition = PopupTextController.GetPopupPos(HeroTransform.position + Vector3.up * 18, UICamera.mainCamera);
                CreatTipsPoint.position = ShowPosition;
            }
        }
Example #5
0
    void Update()
    {
        if (this.m_isReady)
        {
            if (m_EntityModel != null)
            {
                var monsterData = ((SMsgPropCreateEntity_SC_Monster)m_EntityModel.EntityDataStruct).MonsterUnitValues;
                if (monsterData.UNIT_FIELD_CURHP <= 0)
                {
                    Destroy(gameObject);
                }
                else
                {
                    HPSlider.sliderValue     = (float)monsterData.UNIT_FIELD_CURHP / m_MaxValue;
                    HPBackSlider.sliderValue = HPBackSlider.sliderValue - (HPBackSlider.sliderValue - HPSlider.sliderValue) * Time.deltaTime;
                    if (m_hasShield)
                    {
                        EnemyShieldSlider(monsterData.UNIT_FIELD_SHARD);
                    }
                    string label = string.Empty;
                    if (ShowHealthLabel)
                    {
                        label += monsterData.UNIT_FIELD_CURHP + "/" + m_MaxValue;
                    }
                    if (ShowShieldLabel)
                    {
                        if (ShowHealthLabel)
                        {
                            label += "-";
                        }
                        label += monsterData.UNIT_FIELD_SHARD + "/" + m_enemyBehaviour.MonsterShieldValue;
                    }

                    if (m_isBossHealth)
                    {
                        SetGameObjectActive(Eff_BossHaveDefense, monsterData.UNIT_FIELD_SHARD > 0);
                    }


                    this.HealthLabel.SetText(label);
                }
            }

            transform.position = PopupTextController.GetPopupPos(this.m_TargetMP.position, PopupObjManager.Instance.UICamera) + Vector3.forward * 0.5f;
        }
    }
Example #6
0
 void Update()
 {
     if (m_IsEnable)
     {
         if (m_thisEquipTrans != null)
         {
             Vector3 uiPos = PopupTextController.GetPopupPos(m_thisEquipTrans.position, m_UICamera);
             m_thisTransform.position      = new Vector3(uiPos.x, uiPos.y, m_posZ);
             m_thisTransform.localPosition = m_thisTransform.localPosition + adjustVect;
         }
         else
         {
             m_IsEnable = false;
             Destroy(gameObject);
         }
     }
 }
Example #7
0
    private void CreateDamage(IEntityDataStruct entityDataStruct)
    {
        var sMsgPropCreateEntity_SC_Damage = (BoxSubMsgEntity)entityDataStruct;
        //string damageName = "xiangzi";
        //var damagePrefab = this.FindByName(damageName);

        //\Edit by lee
        var damageList = EctypeConfigManager.Instance.DamageConfigList;

        if (!damageList.ContainsKey(sMsgPropCreateEntity_SC_Damage.BaseValues.OBJECT_FIELD_ENTRY_ID))
        {
            return;
        }
        var damageData   = damageList[sMsgPropCreateEntity_SC_Damage.BaseValues.OBJECT_FIELD_ENTRY_ID];
        var damagePrefab = damageData.DamagePrefab;


        var pos       = Vector3.zero;
        var serverPos = pos.GetFromServer(sMsgPropCreateEntity_SC_Damage.BoxX, sMsgPropCreateEntity_SC_Damage.BoxY);

        pos = CountDropPos(serverPos);

        var damage          = (GameObject)GameObject.Instantiate(damagePrefab, pos, damagePrefab.transform.rotation);
        var damageBehaviour = damage.GetComponent <DamageBehaviour>();

        GameObject m_popupWidget = null;//字体

        var itemData = ItemDataManager.Instance.GetItemData(damageData._correspondingItemID);

        if (itemData != null)
        {
            //武器特效
            var effDrops = GameManager.Instance.DamageFactory.EffDrops;
            if (itemData._ColorLevel < effDrops.Length)
            {
                GameObject effect = (GameObject)Instantiate(effDrops[itemData._ColorLevel]);
                effect.transform.parent        = damage.transform;
                effect.transform.localPosition = new Vector3(0, 1f, 0);
            }

            //字体
            Vector3 uiPos = PopupTextController.GetPopupPos(damage.transform.position, PopupObjManager.Instance.UICamera);
            m_popupWidget = GameObjectPool.Instance.AcquireLocal(EquipNamePrefab, uiPos, Quaternion.identity);
            GameObject         textShadow  = GameObjectPool.Instance.AcquireLocal(EquipNameShadowPrefab, uiPos, Quaternion.identity);
            EquipTextBehaviour etBehaviour = m_popupWidget.GetComponent <EquipTextBehaviour>();
            etBehaviour.Init(damage.transform);
            var scale       = m_popupWidget.transform.localScale;
            var shadowScale = textShadow.transform.localScale;
            m_popupWidget.transform.parent = PopupObjManager.Instance.UICamera.transform;
            textShadow.transform.parent    = m_popupWidget.transform;
            var uilabel = m_popupWidget.GetComponentInChildren <UILabel>();
            uilabel.text = NGUIColor.SetTxtColor(LanguageTextManager.GetString(itemData._szGoodsName), m_TextColors[itemData._ColorLevel]);
            //uilabel.color = NameFontColors[itemData._ColorLevel];
            m_popupWidget.transform.localScale = scale;
            textShadow.transform.localScale    = shadowScale;

            damageBehaviour.TitleRef = m_popupWidget;
        }

        //掉落音效
        switch (damageData._boxType)
        {
        case 2:
            if (itemData._GoodsClass == 1)
            {
                if (itemData._ColorLevel >= 3)
                {
                    SoundManager.Instance.PlaySoundEffect("Sound_UIEff_Drop_Equipment2");
                }
                else
                {
                    SoundManager.Instance.PlaySoundEffect("Sound_UIEff_Drop_Equipment1");
                }
            }
            else
            {
                SoundManager.Instance.PlaySoundEffect("Sound_UIEff_Drop_Item1");
            }
            break;

        case 4:
            SoundManager.Instance.PlaySoundEffect("Sound_UIEff_Drop_Gold");
            break;
        }

        //掉落动画
        var dropBehaviour = damage.GetComponent <GoldBehaviour>();

        if (dropBehaviour != null)
        {
            Vector3 dropPos = serverPos + (pos - serverPos) * CommonDefineManager.Instance.CommonDefine.DropItem_Dis;
            dropBehaviour.Play(m_popupWidget, serverPos, dropPos);
        }

        if (damageBehaviour == null)
        {
            TraceUtil.Log(damageBehaviour.name);
        }
        damageBehaviour.DamageDataModel = sMsgPropCreateEntity_SC_Damage;

        EntityModel damageDataModel = new EntityModel();

        damageDataModel.GO               = damage;
        damageDataModel.Behaviour        = damageBehaviour;
        damageDataModel.EntityDataStruct = sMsgPropCreateEntity_SC_Damage;

        DamageManager.GetInstance();
        EntityController.Instance.RegisteEntity(sMsgPropCreateEntity_SC_Damage.SMsg_Header.uidEntity, damageDataModel);
    }