Exemple #1
0
 void harmProcess(SkillHarm n)
 {
     if (n.target == SkillTarget.Target.Area)
     {//区域伤害
         Matrix4x4   mt    = Matrix4x4.TRS(mUnit.pos, Quaternion.LookRotation(mUnit.dir), Vector3.one).inverse;
         List <Unit> units = mUnit.mgr.getUnitInArea(UnitType.Monster | UnitType.Player, n.area, mt);
         for (int i = 0; i < units.Count; ++i)
         {
             Unit u = units [i];
             if (!mUnit.isRelation(u, (int)n.relation))
             {
                 continue;
             }
             affectUnit(u, n);
         }
     }
     else
     {//目标伤害
         if ((n.relation & UnitRelation.Self) != 0)
         {
             affectUnit(mUnit, n);
         }
         Unit u = mUnit.skill.targetUnit;
         if (u != null && mUnit.isRelation(u, (int)n.relation))
         {
             affectUnit(u, n);
         }
     }
 }
Exemple #2
0
    void affectUnit(Unit u, SkillHarm n)
    {
        if (u == null)
        {
            return;
        }
        if (n.harm > 0)
        {
            u.anim.sendEvent(AnimPlugin.Hit);
        }
        AttrPlugin ap = u.attr;

        ap.HP -= n.harm;
        ap.sync();
        u.sendUnitEvent((int)UnitEvent.BeHit, mUnit.guid, true);
    }
Exemple #3
0
    public static SkillNode createNode(Type nodeType)
    {
        SkillNode n = null;

        switch (nodeType)
        {
        case SkillNode.Type.Action:
            n = new SkillAction();
            break;

        case SkillNode.Type.Anim:
            n = new SkillAnim();
            break;

        case SkillNode.Type.Harm:
            n = new SkillHarm();
            break;

        case SkillNode.Type.Bullet:
            n = new SkillBullet();
            break;

        case SkillNode.Type.Buff:
            n = new SkillBuff();
            break;

        case SkillNode.Type.Event:
            n = new SkillEvent();
            break;

        case SkillNode.Type.Move:
            n = new SkillMove();
            break;

        case SkillNode.Type.Lua:
            n = new SkillLua();
            break;

        default:
            Debug.LogError("unsurpport skillnode type:" + nodeType);
            return(null);
        }
        return(n);
    }