/// <summary> /// 受伤处理 /// </summary> /// <param name="e"></param> private void onHeroHurtCall(GameEvent e) { ObjectHero hero = (ObjectHero)e.data; if (hero != null) { UpdateBloodValue(hero.GetGuid(), (float)hero.GetHP() / hero.GetMaxHP()); } }
public void CreateSkillIcon(ObjectHero hero, GameObject icon) { //GameObject icon = Instantiate(iconPre, Vector3.zero, Quaternion.identity) as GameObject; //icon.transform.SetParent(selfTransform,false); //icon.transform.localScale = new Vector3(1, 1, 1); UI_SkillIcon skillIcon = icon.AddComponent <UI_SkillIcon>(); skillIcon.setHero(hero); skillIcon.InitIcon(); mIcons.Add(hero.GetGuid(), skillIcon); }
//创建血条 public void CreateBloodBar(ObjectHero hero) { Transform tans = hero.GetAnimation().EventControl.Pre_Head_T_EffectPoint; GameObject barObj = Instantiate(UI_FightControler.Inst.heroBloodPre, Vector3.zero, Quaternion.identity) as GameObject; barObj.transform.SetParent(transform, false); UI_Blood mBlood = barObj.AddComponent <UI_Blood>(); mBlood.SetPosition(tans.position); barObj.transform.localScale = new Vector3(1, 1, 1); bloodInfo.Add(mBlood); mBlood.isHero = true; mBlood.setHeroLevel(hero.GetHeroData().Level); if (!ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter) { hero.SetHP(hero.GetMaxHP()); } mBlood.SetValue((float)hero.GetHP() / (float)hero.GetMaxHP()); mBlood.setHeadPosition(tans); mBlood.uid.Copy(hero.GetGuid()); }
//点击技能图标 public void OnSkillClick() { Debug.LogError("diuanji"); // 新手引导相关 if (GuideManager.GetInstance().isGuideUser) { FightControler.Inst.OnUpdatePowerValue(EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO, 50); // 点击【第一勇士技能】 100309 //GuideManager.GetInstance().ShowNextGuide(); if (GuideManager.GetInstance().GetBackCount(100309)) { GuideManager.GetInstance().ShowGuideWithIndex(100310); } if (GuideManager.GetInstance().GetBackCount(100311)) { GameTimeControler.Inst.SetState(UI_MenuPanel.Inst.mInitSpeed); GuideManager.GetInstance().StopGuide(); isTrigger = true; } if (UI_MenuPanel.Inst != null) { UI_MenuPanel.Inst.SetStageNameActive(true); } } if (!ObjectSelf.GetInstance().isSkillShow) { //队伍是否在移动中、英雄是否已死亡 if (!OnCheck()) { //不能释放技能 (死亡或者、CD、消耗不足、无释放目标的等) AudioControler.Inst.PlaySound("test_evil_death"); LogManager.Log("is hero cannot sound!!"); return; } } else { if (GetHero().OnUIPre_CheckUseSkillCondtion() == false) { return; } if (!isClick) { return; } isClick = false; } ReleaseSkillEffect(); bool IsShowSelectTarget = SceneObjectManager.GetInstance().GetIsFireSignState();// 非集火状态才显示目标选择 [3/27/2015 Zmy] if (!IsShowSelectTarget && IsNeedSelectTarget(mSkillInfo) == EM_TARGET_TYPE.EM_TARGET_FRIEND) { // 对我方释放 EventRequestSkillPackage package = new EventRequestSkillPackage(mHero.GetGuid(), skillId, true); // 我方单体 GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_ShowSkillTarget, package); GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_MessageAlert, "program_tips9"); return; } else if (!IsShowSelectTarget && IsNeedSelectTarget(mSkillInfo) == EM_TARGET_TYPE.EM_TARGET_FRIEND_NO_SELF) { // 对我方释放 EventRequestSkillPackage package = new EventRequestSkillPackage(mHero.GetGuid(), skillId, true, false); // 我方单体 GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_ShowSkillTarget, package); GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_MessageAlert, "program_tips9"); return; } else if (!IsShowSelectTarget && IsNeedSelectTarget(mSkillInfo) == EM_TARGET_TYPE.EM_TARGET_ENEMY) { // 对敌方释放 ObjectCreature target; if (SceneObjectManager.GetInstance().IsOnlyOneMonsterLeft(out target)) { EventRequestSkillPackage package = new EventRequestSkillPackage(mHero.GetGuid(), skillId, target); GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_RequestReleaseSkill, package); } else { EventRequestSkillPackage package = new EventRequestSkillPackage(mHero.GetGuid(), skillId, false); // 敌方单体 GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_ShowSkillTarget, package); GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_MessageAlert, "program_tips9"); } return; } if (UI_FightControler.Inst != null) { UI_FightControler.Inst.onReleaseTargetLock(); } // 请求释放技能 EventRequestSkillPackage _package = new EventRequestSkillPackage(mHero.GetGuid(), skillId, null); GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_RequestReleaseSkill, _package); //cdIcon.fillAmount = 1; //cdTime = mMaxCoolDownTime; }