void OnFlyDestroy(EntityBase entity) { FlyObjectComponent fc = entity.GetComp <FlyObjectComponent>(); PerfabComponent pc = entity.GetComp <PerfabComponent>(); EffectManager.ShowEffect(fc.FlyData.m_HitEffect, pc.perfab.transform.position + pc.perfab.transform.forward * 0.3f, 1); }
void ReceviceRemoveBuff(EntityBase entity, params object[] objs) { //Debug.Log("ReceviceRemoveBuff"); AddComp(entity); BuffEffectComponent bec = entity.GetComp <BuffEffectComponent>(); PlayerComponent pc = entity.GetComp <PlayerComponent>(); PerfabComponent pec = entity.GetComp <PerfabComponent>(); BuffInfo bi = (BuffInfo)objs[0]; if (bi.BuffData.m_BuffExitFX != "null") { EffectManager.ShowEffect(bi.BuffData.m_BuffExitFX, pec.perfab.transform.position, 0.5f); } BuffEffectPackage bep = bec.GetBuffEffectPackage(bi.buffID); //Debug.Log("bep >" + bep + "<"); if (bep != null && bep.buffEffectID != 0) { m_world.DestroyEntity(bep.buffEffectID); bep.buffEffectID = 0; } }
public override void OnEntityDestroy(EntityBase entity) { if (entity.GetExistComp <PerfabComponent>()) { PerfabComponent pc = entity.GetComp <PerfabComponent>(); GameObjectManager.DestroyGameObjectByPool(pc.perfab); } }
public override void FixedUpdate(int deltaTime) { List <EntityBase> list = GetEntityList(); for (int i = 0; i < list.Count; i++) { PerfabComponent pc = list[i].GetComp <PerfabComponent>(); m_world.GetSingletonComp <PlayerCameraComponent>().cam.m_target = pc.perfab; } }
void BuffEffectLogic(EntityBase entity) { BuffEffectComponent bec = entity.GetComp <BuffEffectComponent>(); PlayerComponent pc = entity.GetComp <PlayerComponent>(); PerfabComponent pec = entity.GetComp <PerfabComponent>(); for (int i = 0; i < pc.buffList.Count; i++) { BuffEffect(entity, pc.buffList[i], bec); } }
public override void Update(int deltaTime) { List <EntityBase> list = GetEntityList(); for (int i = 0; i < list.Count; i++) { if (!list[i].GetExistComp <PerfabComponent>()) { PerfabComponent comp = list[i].AddComp <PerfabComponent>(); comp.perfab = GameObjectManager.CreateGameObject(list[i].GetComp <AssetComponent>().m_assetName); } } }
public void AnimLogic(EntityBase entity) { LifeComponent lc = entity.GetComp <LifeComponent>(); AnimComponent ac = entity.GetComp <AnimComponent>(); MoveComponent mc = entity.GetComp <MoveComponent>(); PlayerComponent pc = entity.GetComp <PlayerComponent>(); PerfabComponent pbc = entity.GetComp <PerfabComponent>(); if (lc.Life <= 0) { ac.anim.Play("empty", 1); ac.anim.Play("die"); return; } //移动逻辑 if (Vector3.Distance(mc.pos.ToVector(), pbc.perfab.transform.position) > .05f) { Vector3 Dir = mc.dir.ToVector(); if (Dir == Vector3.zero) { Dir = mc.pos.ToVector() - pbc.perfab.transform.position; } TurnStatus status = GetTurnStatus(Dir, pc.faceDir.ToVector()); //身体移动方向 SetBodyDir(status, Dir, ac.perfab); //播放不同动画 SetMoveAnim(status, ac.anim); } else { Vector3 Dir = pc.faceDir.ToVector(); if (entity.GetExistComp <SelfComponent>()) { Dir = InputSystem.skillDirCache; } ac.anim.Play("wait"); if (pc.faceDir.ToVector() != Vector3.zero) { ac.perfab.transform.forward = Dir; } } //上层动画 UpperAnim(entity, ac); }
void ReceviceBuffHit(EntityBase entity, params object[] objs) { AddComp(entity); BuffEffectComponent bec = entity.GetComp <BuffEffectComponent>(); PlayerComponent pc = entity.GetComp <PlayerComponent>(); PerfabComponent pec = entity.GetComp <PerfabComponent>(); BuffInfo bi = (BuffInfo)objs[0]; if (bi.BuffData.m_BuffCreateFX != "null") { EffectManager.ShowEffect(bi.BuffData.m_BuffCreateFX, pec.perfab.transform.position, 0.5f); } }
//public override Type[] GetFilter() //{ // return new Type[] { // typeof(AssetComponent), // typeof(TransfromComponent), // }; //} public override void OnEntityOptimizeDestroy(EntityBase entity) { if (entity.GetExistComp <PerfabComponent>()) { Debug.Log("接收到销毁 "); PerfabComponent pc = entity.GetComp <PerfabComponent>(); if (pc.perfab != null) { GameObjectManager.DestroyGameObjectByPool(pc.perfab); pc.perfab = null; } } }
public void CreateFollowSkillEffect(EntityBase entity, string effectName, HardPointEnum hardPoint, float time) { PerfabComponent pc = entity.GetComp <PerfabComponent>(); EffectData data = new EffectData(); PoolObject effectP = GameObjectManager.GetPoolObject(effectName, pc.hardPoint.hardPoint.GetHardPoint(hardPoint).gameObject); effectP.transform.localPosition = Vector3.zero; effectP.transform.localEulerAngles = Vector3.zero; data.m_effect = effectP; data.m_timer = time; //m_SkillEffectList.Add(data); //Debug.Log("CreateSkillEffect " + effectName + " time " + time + " " + " hard " + m_character.m_hardPoint.GetHardPoint(hardPoint).gameObject, effectP ); }
public void ECSBeRecover(EntityBase entity, params object[] pbjs) { PerfabComponent pc = entity.GetComp <PerfabComponent>(); LifeComponent lc = entity.GetComp <LifeComponent>(); PlayerComponent plc = entity.GetComp <PlayerComponent>(); CampComponent cc = entity.GetComp <CampComponent>(); UpdateLifeSliderRecover((float)lc.Life / (float)lc.maxLife); float recoverNum = lc.Life - n_oldHp; if (recoverNum > 0) { //if ((bool)(args[1]) == false || character.m_camp == Camp.Brave)//怪物的自动回血,不显示 { DisplayNum(lc.Life - n_oldHp, Camp.Brave, TextDisplaySizeType.Middle, TextDisplayStyleType.Recover); } } n_oldHp = lc.Life; }
public override void OnEntityOptimizeCreate(EntityBase entity) { if (GetAllExistComp(new string[] { "AssetComponent", "TransfromComponent" }, entity)) { Debug.Log("接收到创建 "); AddComp(entity); AssetComponent ac = entity.GetComp <AssetComponent>(); TransfromComponent tc = entity.GetComp <TransfromComponent>(); PerfabComponent comp = entity.GetComp <PerfabComponent>(); comp.perfab = GameObjectManager.CreateGameObject(ac.m_assetName); comp.hardPoint = comp.perfab.GetComponent <HardPointComponent>(); if (tc.parentID == 0) { comp.perfab.transform.position = tc.pos.ToVector(); } else { EntityBase parent = m_world.GetEntity(tc.parentID); //if (parent.GetExistComp<PerfabComponent>()) //{ // PerfabComponent pc = parent.GetComp<PerfabComponent>(); // comp.perfab.transform.SetParent(pc.perfab.transform); //} comp.perfab.transform.localPosition = tc.pos.ToVector(); } //创建动画组件 if (comp.perfab.GetComponent <Animator>() != null) { AnimComponent anc = entity.AddComp <AnimComponent>(); anc.anim = comp.perfab.GetComponent <Animator>(); anc.perfab = comp.perfab; anc.waistNode = comp.hardPoint.waistNode; } } }
public void SetEntity(EntityBase entity) { if (CameraService.Instance.m_mainCameraGo == null) { return; } PerfabComponent pc = entity.GetComp <PerfabComponent>(); LifeComponent lc = entity.GetComp <LifeComponent>(); PlayerComponent plc = entity.GetComp <PlayerComponent>(); CampComponent cc = entity.GetComp <CampComponent>(); mainCamera = CameraService.Instance.m_mainCamera; m_entityID = entity.ID; GetEventKey(m_entityID); //ECSEvent.AddListener(m_InitKey, InitCharacter); //ECSEvent.AddListener(m_MoveKey, RefreshPoition); entity.World.eventSystem.AddListener(m_DamageKey, ECSBeAttack, true); entity.World.eventSystem.AddListener(m_RecoverKey, ECSBeRecover, true); //ECSEvent.AddListener(m_SKillKey, UseSkill); //ECSEvent.AddListener(m_AttackKey, UseSkill); //ECSEvent.AddListener(m_BeBreakKey, BeBreak); go_character = pc.perfab.gameObject; n_oldHp = lc.maxLife; //TODO 血条高度读取配置 v3_FollowOffset.y = -0.15f * Screen.height; bloodIsFull = true; UpdateSliderLength(0, lc.maxLife); InitLifeSlider(cc.camp); }
public void CreateEffect(EntityBase entity, string effectName, HardPointEnum hardPoint, float time, float offset) { PerfabComponent pc = entity.GetComp <PerfabComponent>(); SkillStatusComponent ssc = entity.GetComp <SkillStatusComponent>(); MoveComponent mc = entity.GetComp <MoveComponent>(); //挂载点完全放弃了 Transform creatPoint = pc.hardPoint.hardPoint.GetHardPoint(hardPoint); Vector3 createPos = mc.pos.ToVector() + ssc.skillDir.ToVector() * offset; Vector3 charactorEugle = Vector3.zero; Vector3 m_aimWaistDir = ssc.skillDir.ToVector(); float euler = Mathf.Atan2(m_aimWaistDir.x, m_aimWaistDir.z) * Mathf.Rad2Deg; if (m_aimWaistDir.z == 0) { euler = 0; } charactorEugle.y = euler; TransfromComponent etc = new TransfromComponent(); etc.pos.FromVector(createPos); etc.dir.FromVector(m_aimWaistDir); AssetComponent eac = new AssetComponent(); eac.m_assetName = effectName; LifeSpanComponent elc = new LifeSpanComponent(); elc.lifeTime = (int)(time * 1000); m_world.CreateEntity("Effect" + effectName + entity.ID + createPos, etc, eac, elc); }
public void ECSBeAttack(EntityBase entity, params object[] pbjs) { Debug.Log("ECSBeAttack " + entity.World.FrameCount); PerfabComponent pc = entity.GetComp <PerfabComponent>(); LifeComponent lc = entity.GetComp <LifeComponent>(); PlayerComponent plc = entity.GetComp <PlayerComponent>(); CampComponent cc = entity.GetComp <CampComponent>(); //Debug.Log("BeAttack -->"); UpdateLifeSlider((float)lc.Life / (float)lc.maxLife); UpdateSliderLength(0, lc.maxLife); TextDisplaySizeType textSizeType = TextDisplaySizeType.Small; //if ((bool)args[1] == true) //{ // textSizeType = TextDisplaySizeType.Large; //} DisplayNum(n_oldHp - lc.Life, cc.camp, textSizeType, TextDisplayStyleType.Hurt); n_oldHp = lc.Life; }