Ejemplo n.º 1
0
    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 FlyDamageLogic(EntityBase fly, EntityBase entity)
    {
        FlyObjectComponent fc = fly.GetComp <FlyObjectComponent>();
        LifeComponent      lc = entity.GetComp <LifeComponent>();

        lc.life -= fc.damage;
        //派发事件
        ECSEvent.DispatchEvent(GameUtils.GetEventKey(entity.ID, CharacterEventType.Damage), entity);
    }
    public override MomentComponentBase DeepCopy()
    {
        FlyObjectComponent flyObjCom = new FlyObjectComponent();

        flyObjCom.createrID   = createrID;
        flyObjCom.damage      = damage;
        flyObjCom.flyObjectID = flyObjectID;

        for (int i = 0; i < damageList.Count; i++)
        {
            flyObjCom.damageList.Add(damageList[i]);
        }

        return(flyObjCom);
    }
Ejemplo n.º 4
0
    void CreateFlyObject(SkillDataGenerate skillData, EntityBase skiller)
    {
        CampComponent campComp = skiller.GetComp <CampComponent>();

        //Debug.Log("CreateFlyObject " + skiller.ID + "  " + campComp.creater);

        if (skillData.m_FlyObjectName.Length != 0)
        {
            List <CreatPostionInfo> poss = GetCreatePostionInfos(skillData, skiller, skillData.m_FlyObjectName.Length);

            for (int i = 0; i < poss.Count; i++)
            {
                FlyDataGenerate flyData = DataGenerateManager <FlyDataGenerate> .GetData(skillData.m_FlyObjectName[i]);

                TransfromComponent tc = new TransfromComponent();
                tc.pos = poss[i].m_pos;
                tc.dir = poss[i].m_dir;

                MoveComponent mc = new MoveComponent();
                mc.pos        = poss[i].m_pos;
                mc.dir        = poss[i].m_dir;
                mc.m_velocity = flyData.m_Speed;

                LifeSpanComponent lsc = new LifeSpanComponent();
                lsc.lifeTime = flyData.m_LiveTime;

                AssetComponent ac = new AssetComponent();
                ac.m_assetName = flyData.m_ModelName;

                CampComponent cp = new CampComponent();
                cp.camp    = campComp.camp;
                cp.creater = campComp.creater;

                CollisionComponent cc = new CollisionComponent();
                cc.area.areaType = AreaType.Circle;
                cc.area.radius   = flyData.m_Radius / 1000;

                FlyObjectComponent fc = new FlyObjectComponent();
                fc.createrID   = skiller.ID;
                fc.damage      = skillData.m_FlyDamageValue;
                fc.flyObjectID = skillData.m_FlyObjectName[i];

                string identify = skiller.ID + "FlyObject" + i + poss[i].m_pos;
                m_world.CreateEntity(identify, tc, mc, ac, cp, lsc, cc, fc);
            }
        }
    }
    public static void FlyDamageLogic(WorldBase world, EntityBase fly, EntityBase entity)
    {
        FlyObjectComponent fc       = fly.GetComp <FlyObjectComponent>();
        LifeComponent      lc       = entity.GetComp <LifeComponent>();
        CampComponent      campComp = fly.GetComp <CampComponent>();
        MoveComponent      mc       = fly.GetComp <MoveComponent>();

        //Debug.Log("FlyDamageLogic " + entity.ID + " ===> campComp.creater " + campComp.creater + " " + world.GetEntity(campComp.creater).ID);
        Damage(world, world.GetEntity(campComp.creater), entity, fc.damage);

        //飞行物击飞
        BlowFly(world, fly, entity, fc.FlyData.m_BlowFlyID);

        //飞行物Buff
        AddBuff(world, world.GetEntity(campComp.creater), entity, fc.FlyData.m_HurtBuff);

        //释放触发技能
        //TokenUseSkill(world,campComp.creater,fc.FlyData.m_TriggerSkill, mc.pos.ToVector(),mc.dir.ToVector());
    }
    void DamageLogic(EntityBase entity)
    {
        CollisionComponent cc = entity.GetComp <CollisionComponent>();
        FlyObjectComponent fc = entity.GetComp <FlyObjectComponent>();

        if (cc.CollisionList.Count > 0)
        {
            Debug.Log("collision " + cc.CollisionList[0].ID);

            for (int i = 0; i < cc.CollisionList.Count; i++)
            {
                if (cc.CollisionList[i].GetExistComp <LifeComponent>() &&
                    fc.createrID != cc.CollisionList[i].ID)
                {
                    FlyDamageLogic(entity, cc.CollisionList[i]);
                }
            }
        }
    }
Ejemplo n.º 7
0
    void DamageLogic(EntityBase entity)
    {
        CollisionComponent cc  = entity.GetComp <CollisionComponent>();
        FlyObjectComponent fc  = entity.GetComp <FlyObjectComponent>();
        CampComponent      acc = entity.GetComp <CampComponent>();

        if (cc.CollisionList.Count > 0)
        {
            for (int i = 0; i < cc.CollisionList.Count; i++)
            {
                if (cc.CollisionList[i].GetExistComp <LifeComponent>() &&
                    cc.CollisionList[i].GetExistComp <CampComponent>() &&
                    acc.creater != cc.CollisionList[i].GetComp <CampComponent>().creater)
                {
                    //Debug.Log("fly DamageLogic frame-> " + m_world.FrameCount + "  id " + cc.CollisionList[i].ID + " Fly ID " + entity.ID);
                    if (!fc.damageList.Contains(cc.CollisionList[i].ID)) //第一次伤害
                    {
                        SkillUtils.FlyDamageLogic(m_world, entity, cc.CollisionList[i]);
                        fc.damageList.Add(cc.CollisionList[i].ID);
                    }


                    //不能穿人销毁飞行物
                    if (!fc.FlyData.m_AcrossEnemy)
                    {
                        m_world.ClientDestroyEntity(entity.ID);
                    }

                    //Debug.Log("fc.FlyData.m_AcrossEnemy " + fc.FlyData.m_AcrossEnemy);
                }

                if (cc.CollisionList[i].GetExistComp <BlockComponent>())
                {
                    //不能穿墙摧毁飞行物
                    if (fc.FlyData.m_CollisionTrigger)
                    {
                        m_world.ClientDestroyEntity(entity.ID);
                    }
                }
            }
        }
    }
Ejemplo n.º 8
0
    void CreateFlyObject(SkillDataGenerate skillData, EntityBase skiller)
    {
        CampComponent campComp = skiller.GetComp <CampComponent>();

        if (skillData.m_FlyObjectName.Length != 0)
        {
            List <CreatPostionInfo> poss = GetCreatePostionInfos(skillData, skiller, skillData.m_FlyObjectName.Length);

            for (int i = 0; i < poss.Count; i++)
            {
                FlyDataGenerate flyData = DataGenerateManager <FlyDataGenerate> .GetData(skillData.m_FlyObjectName[i]);

                MoveComponent mc = new MoveComponent();
                mc.pos.FromVector(poss[i].m_pos);
                mc.dir.FromVector(poss[i].m_dir);
                mc.m_velocity = (int)(flyData.m_Speed * 1000);

                LifeSpanComponent lsc = new LifeSpanComponent();
                lsc.lifeTime = (int)(flyData.m_LiveTime * 1000);

                AssetComponent ac = new AssetComponent();
                ac.m_assetName = flyData.m_ModelName;

                CampComponent cp = new CampComponent();
                cp.camp = campComp.camp;

                CollisionComponent cc = new CollisionComponent();
                cc.area.areaType = AreaType.Circle;
                cc.area.radius   = flyData.m_Radius;

                FlyObjectComponent fc = new FlyObjectComponent();
                fc.createrID = skiller.ID;
                fc.damage    = skillData.m_DamageValue;

                m_world.CreateEntity(mc, ac, cp, lsc, cc, fc);

                Debug.Log(poss[i].m_pos.ToString());
            }
        }
    }