Exemplo n.º 1
0
    public override void FixedUpdate(int deltaTime)
    {
        List <EntityBase> list = GetEntityList();

        for (int i = 0; i < list.Count; i++)
        {
            CommandComponent     cc  = (CommandComponent)list[i].GetComp("CommandComponent");
            SkillStatusComponent ssc = (SkillStatusComponent)list[i].GetComp("SkillStatusComponent");
            PlayerComponent      pc  = (PlayerComponent)list[i].GetComp("PlayerComponent");
            MoveComponent        mc  = (MoveComponent)list[i].GetComp("MoveComponent");
            LifeComponent        lc  = (LifeComponent)list[i].GetComp("LifeComponent");

            //CD
            for (int j = 0; j < ssc.m_skillList.Count; j++)
            {
                ssc.m_CDList[j] -= deltaTime;
            }

            if (ssc.skillDirCache.ToVector() != Vector3.zero &&
                cc.isFire &&
                !pc.GetIsDizziness() &&
                lc.Life > 0 &&
                cc.skillDir.ToVector() == Vector3.zero
                )
            {
                string    skillID = SkillUtils.GetSkillName(cc);
                SkillData data    = ssc.GetSkillData(skillID);

                if (ssc.GetSkillCDFinsih(skillID))
                {
                    //Debug.Log("FIRE!!! --> " + skillID);
                    ssc.m_skillTime        = 0;
                    ssc.m_skillStstus      = SkillStatusEnum.Before;
                    ssc.m_isTriggerSkill   = false;
                    ssc.m_currentSkillData = data;
                    ssc.m_currentSkillData.UpdateInfo();

                    ssc.SetSkillCD(skillID, data.CDSpace);

                    ssc.skillDir = ssc.skillDirCache.DeepCopy();
                    AreaDataGenerate areaData = DataGenerateManager <AreaDataGenerate> .GetData(ssc.m_currentSkillData.SkillInfo.m_EffectArea);

                    float distance = ssc.skillDir.ToVector().magnitude;
                    distance = areaData.m_SkewDistance + Mathf.Clamp(distance, 0, areaData.m_distance);

                    Vector3 aimPos = mc.pos.ToVector() + ssc.skillDir.ToVector().normalized *distance;
                    if (areaData.m_Shape != AreaType.Rectangle)
                    {
                        ssc.skillPos.FromVector(aimPos);
                    }
                    else
                    {
                        ssc.skillPos.FromVector(mc.pos.ToVector() + ssc.skillDir.ToVector().normalized *(areaData.m_SkewDistance - areaData.m_Length / 2));
                    }
                }
            }

            ssc.skillDirCache = cc.skillDir.DeepCopy();
        }
    }
Exemplo n.º 2
0
    public override void FixedUpdate(int deltaTime)
    {
        List <EntityBase> list = GetEntityList();

        for (int i = 0; i < list.Count; i++)
        {
            CommandComponent     cc  = list[i].GetComp <CommandComponent>();
            CDComponent          cdc = list[i].GetComp <CDComponent>();
            SkillStatusComponent ssc = list[i].GetComp <SkillStatusComponent>();

            cdc.CD -= deltaTime;

            if (cc.skillDir.ToVector() != Vector3.zero &&
                cc.isFire &&
                cdc.CD <= 0)
            {
                cdc.CD = 2 * 1000;

                Debug.Log("FIRE!!!");

                //FIRE!!!
                string skillID = "2000";

                ssc.m_skillTime        = 0;
                ssc.m_isTriggerSkill   = false;
                ssc.m_skillStstus      = SkillStatusEnum.Before;
                ssc.m_currentSkillData = ssc.GetSkillData(skillID);
                ssc.m_currentSkillData.UpdateInfo();
            }
        }
    }
    public static void TokenUseSkill(WorldBase world, int createrID, string skillID, Vector3 pos, Vector3 dir)
    {
        //Debug.Log("TokenUseSkill pos" + pos + " frame " + world.FrameCount + " skillID" + skillID);

        if (skillID != null &&
            skillID != "null" &&
            skillID != "Null")
        {
            SkillStatusComponent ssc = new SkillStatusComponent();
            ssc.m_skillTime      = 0;
            ssc.m_skillStstus    = SkillStatusEnum.Before;
            ssc.m_isTriggerSkill = false;
            ssc.m_isHit          = false;
            ssc.m_skillList.Add(new SkillData(skillID));
            ssc.m_currentSkillData = ssc.GetSkillData(skillID);
            ssc.m_currentSkillData.UpdateInfo();
            ssc.skillDir.FromVector(dir);

            if (ssc.m_currentSkillData.LaterTime == 0)
            {
                Debug.LogError("技能代 " + skillID + "的持续时间不能为 0 !");
                return;
            }

            TransfromComponent tc = new TransfromComponent();
            tc.pos.FromVector(pos);
            tc.dir.FromVector(dir);

            //打印
            Debug.DrawRay(tc.pos.ToVector(), -tc.dir.ToVector(), Color.green, 10);

            CampComponent cc = new CampComponent();
            cc.creater = createrID;

            LifeSpanComponent lsc = new LifeSpanComponent();
            lsc.lifeTime = (int)(ssc.m_currentSkillData.LaterTime * 1000);

            world.CreateEntity(createrID + "SkillToken", tc, ssc, cc, lsc);
        }
    }
Exemplo n.º 4
0
    public override void FixedUpdate(int deltaTime)
    {
        List <EntityBase> list = GetEntityList();

        for (int i = 0; i < list.Count; i++)
        {
            CommandComponent     cc  = list[i].GetComp <CommandComponent>();
            CDComponent          cdc = list[i].GetComp <CDComponent>();
            SkillStatusComponent ssc = list[i].GetComp <SkillStatusComponent>();
            PlayerComponent      pc  = list[i].GetComp <PlayerComponent>();

            cdc.CD -= deltaTime;

            //Debug.Log(cc.element1 + " --> " + cc.element2 + " CanFire " + (cdc.CD <= 0));

            if (cc.skillDir.ToVector() != Vector3.zero &&
                cc.isFire &&
                cdc.CD <= 0)
            {
                cdc.CD = 2 * 1000;

                //FIRE!!! 2000 2002技能可用

                string skillID = GetSkillName(cc);

                //Debug.Log("FIRE!!! --> " + skillID);

                ssc.m_skillTime        = 0;
                ssc.m_skillStstus      = SkillStatusEnum.Before;
                ssc.m_isTriggerSkill   = false;
                ssc.m_currentSkillData = ssc.GetSkillData(skillID);
                ssc.m_currentSkillData.UpdateInfo();
                ssc.skillDir = cc.skillDir.DeepCopy();
            }
        }
    }