Exemplo n.º 1
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.instanceID = 0;
     this.id         = 0;
     this.level      = 0;
     this.targetData = null;
 }
Exemplo n.º 2
0
        protected override void toMakeTargets(SList <Unit> list, Unit from, Unit attacker, Unit mTarget, SkillTargetData tData, AttackConfig config, AttackLevelConfig levelConfig)
        {
            if (!_g13)
            {
                _m13 = instance.Type.GetMethod("toMakeTargets", 7);
                _g13 = true;
            }

            if (_m13 != null && !_b13)
            {
                _b13   = true;
                _p7[0] = list;
                _p7[1] = from;
                _p7[2] = attacker;
                _p7[3] = mTarget;
                _p7[4] = tData;
                _p7[5] = config;
                _p7[6] = levelConfig;
                appdomain.Invoke(_m13, instance, _p7);
                _p7[0] = null;
                _p7[1] = null;
                _p7[2] = null;
                _p7[3] = null;
                _p7[4] = null;
                _p7[5] = null;
                _p7[6] = null;
                _b13   = false;
            }
            else
            {
                base.toMakeTargets(list, from, attacker, mTarget, tData, config, levelConfig);
            }
        }
Exemplo n.º 3
0
 public override void clear()
 {
     this.currentSkillID    = -1;
     this.currentSkillLevel = 0;
     this.currentTarget     = null;
     this.currentSkillStep  = 0;
 }
Exemplo n.º 4
0
    public static SkillTargetData createByNone()
    {
        SkillTargetData re = new SkillTargetData();

        re.type = SkillTargetType.None;
        return(re);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        this.instanceID = stream.readInt();

        this.id = stream.readInt();

        this.level = stream.readInt();

        BaseData targetDataT = stream.readDataFullNotNull();

        if (targetDataT != null)
        {
            if (targetDataT is SkillTargetData)
            {
                this.targetData = (SkillTargetData)targetDataT;
            }
            else
            {
                this.targetData = new SkillTargetData();
                if (!(targetDataT.GetType().IsAssignableFrom(typeof(SkillTargetData))))
                {
                    stream.throwTypeReadError(typeof(SkillTargetData), targetDataT.GetType());
                }
                this.targetData.shadowCopy(targetDataT);
            }
        }
        else
        {
            this.targetData = null;
        }

        stream.endReadObj();
    }
Exemplo n.º 6
0
    /// <summary>
    /// 判断两个目标是否相等
    /// </summary>
    public bool isEquals(SkillTargetData data)
    {
        int t;

        if ((t = type) != data.type)
        {
            return(false);
        }

        switch (t)
        {
        case SkillTargetType.Single:
        {
            return(targetInstanceID == data.targetInstanceID);
        }

        case SkillTargetType.Ground:
        {
            return(pos.isEquals(data.pos));
        }

        case SkillTargetType.Direction:
        {
            return(dir.isEquals(data.dir));
        }
        }

        return(true);
    }
Exemplo n.º 7
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is BulletData))
        {
            return;
        }

        BulletData mData = (BulletData)data;

        this.instanceID = mData.instanceID;

        this.id = mData.id;

        this.level = mData.level;

        if (mData.targetData != null)
        {
            this.targetData = (SkillTargetData)mData.targetData.clone();
        }
        else
        {
            this.targetData = null;
            nullObjError("targetData");
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is SkillTargetData))
        {
            return;
        }

        SkillTargetData mData = (SkillTargetData)data;

        this.type = mData.type;

        this.targetInstanceID = mData.targetInstanceID;

        if (mData.pos != null)
        {
            this.pos = (PosData)BytesControl.createData(PosData.dataID);
            this.pos.copy(mData.pos);
        }
        else
        {
            this.pos = null;
        }

        if (mData.dir != null)
        {
            this.dir = (DirData)BytesControl.createData(DirData.dataID);
            this.dir.copy(mData.dir);
        }
        else
        {
            this.dir = null;
        }

        this.arg = mData.arg;
    }
Exemplo n.º 9
0
        public override void sendCUnitAttack(int id, int level, SkillTargetData tData, SList <Unit> targets, bool isBulletFirstHit)
        {
            if (!_g35)
            {
                _m35 = instance.Type.GetMethod("sendCUnitAttack", 5);
                _g35 = true;
            }

            if (_m35 != null && !_b35)
            {
                _b35   = true;
                _p5[0] = id;
                _p5[1] = level;
                _p5[2] = tData;
                _p5[3] = targets;
                _p5[4] = isBulletFirstHit;
                appdomain.Invoke(_m35, instance, _p5);
                _p5[0] = null;
                _p5[1] = null;
                _p5[2] = null;
                _p5[3] = null;
                _p5[4] = null;
                _b35   = false;
            }
            else
            {
                base.sendCUnitAttack(id, level, tData, targets, isBulletFirstHit);
            }
        }
Exemplo n.º 10
0
    public override void onFrame(int delay)
    {
        base.onFrame(delay);

        if (_scene.method.canOperate())
        {
            if (_isShooting && !_normalSkills.isEmpty())
            {
                SkillData[] values = _normalSkills.getValues();
                SkillData   v;

                for (int i = 0, len = _normalSkills.size(); i < len; ++i)
                {
                    v = values[i];

                    if (checkCanUseSkill(v))
                    {
                        SkillTargetData tData = new SkillTargetData();
                        tData.type = SkillTargetType.Direction;
                        tData.dir  = new DirData();

                        makeShootDir(tData.dir);

                        useSkill(v, tData);
                    }
                }
            }
        }
    }
Exemplo n.º 11
0
    protected override void copyData()
    {
        base.copyData();
        SkillTargetData targetDataTemp = targetData;

        if (targetDataTemp != null)
        {
            this.targetData = (SkillTargetData)targetDataTemp.clone();
        }
        else
        {
            this.targetData = null;
            nullObjError("targetData");
        }

        PosDirData posDirTemp = posDir;

        if (posDirTemp != null)
        {
            this.posDir = (PosDirData)BytesControl.createData(PosDirData.dataID);
            this.posDir.copy(posDirTemp);
        }
        else
        {
            this.posDir = null;
            nullObjError("posDir");
        }
    }
Exemplo n.º 12
0
        public override void onAttackDamage(Unit from, AttackConfig config, SkillTargetData targetData)
        {
            if (!_g12)
            {
                _m12 = instance.Type.GetMethod("onAttackDamage", 3);
                _g12 = true;
            }

            if (_m12 != null && !_b12)
            {
                _b12   = true;
                _p3[0] = from;
                _p3[1] = config;
                _p3[2] = targetData;
                appdomain.Invoke(_m12, instance, _p3);
                _p3[0] = null;
                _p3[1] = null;
                _p3[2] = null;
                _b12   = false;
            }
            else
            {
                base.onAttackDamage(from, config, targetData);
            }
        }
Exemplo n.º 13
0
    /** 根据指令目标,设置追击 */
    public void setPursueCommandTarget(SkillTargetData tData)
    {
        switch (tData.type)
        {
        case SkillTargetType.Single:
        {
            Unit targetUnit = _scene.getFightUnit(tData.targetInstanceID);

            if (targetUnit != null)
            {
                setPursueUnit(targetUnit);
            }
            else
            {
                _commandLogic.commandOver();
            }
        }
        break;

        default:
        {
            _pursueSkillTarget = tData;
        }
        break;
        }
    }
Exemplo n.º 14
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is UnitFightExData))
        {
            return;
        }

        UnitFightExData mData = (UnitFightExData)data;

        this.currentSkillID = mData.currentSkillID;

        this.currentSkillLevel = mData.currentSkillLevel;

        if (mData.currentTarget != null)
        {
            this.currentTarget = (SkillTargetData)mData.currentTarget.clone();
        }
        else
        {
            this.currentTarget = null;
        }

        this.currentSkillStep = mData.currentSkillStep;

        this.currentSkillStepTimePass = mData.currentSkillStepTimePass;

        this.currentSkillBarID = mData.currentSkillBarID;

        this.currentSkillBarTimePass = mData.currentSkillBarTimePass;
    }
Exemplo n.º 15
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        SkillTargetData mData = (SkillTargetData)data;

        if (this.type != mData.type)
        {
            return(false);
        }

        if (this.targetInstanceID != mData.targetInstanceID)
        {
            return(false);
        }

        if (mData.pos != null)
        {
            if (this.pos == null)
            {
                return(false);
            }
            if (!this.pos.dataEquals(mData.pos))
            {
                return(false);
            }
        }
        else
        {
            if (this.pos != null)
            {
                return(false);
            }
        }

        if (mData.dir != null)
        {
            if (this.dir == null)
            {
                return(false);
            }
            if (!this.dir.dataEquals(mData.dir))
            {
                return(false);
            }
        }
        else
        {
            if (this.dir != null)
            {
                return(false);
            }
        }

        if (this.arg != mData.arg)
        {
            return(false);
        }

        return(true);
    }
Exemplo n.º 16
0
 /** 清理战斗AI数据 */
 public void clearFightAI()
 {
     _fightState = UnitAIFightStateType.Idle;
     _pursueUnit.clear();
     _pursueSkill       = null;
     _pursueDistanceSq  = 0f;
     _pursueSkillTarget = null;
 }
Exemplo n.º 17
0
    public static SkillTargetData createByTargetUnit(int instanceID)
    {
        SkillTargetData re = new SkillTargetData();

        re.type             = SkillTargetType.Single;
        re.targetInstanceID = instanceID;
        return(re);
    }
Exemplo n.º 18
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.bulletID    = 0;
        this.bulletLevel = 0;
        this.target.release(pool);
        this.target = null;
    }
Exemplo n.º 19
0
 /** 清空 */
 public override void clear()
 {
     config           = null;
     levelConfig      = null;
     targetData       = null;
     fromInstanceID   = -1;
     isBulletFirstHit = false;
     isRecorded       = false;
 }
Exemplo n.º 20
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.skillID    = 0;
        this.skillLevel = 0;
        this.targetData = null;
        this.posDir     = null;
    }
Exemplo n.º 21
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.fromInstanceID = 0;
        this.target         = null;
        this.id             = 0;
        this.level          = 0;
        this.damageDatas    = null;
    }
Exemplo n.º 22
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.currentSkillID           = 0;
     this.currentSkillLevel        = 0;
     this.currentTarget            = null;
     this.currentSkillStep         = 0;
     this.currentSkillStepTimePass = 0;
     this.currentSkillBarID        = 0;
     this.currentSkillBarTimePass  = 0;
 }
Exemplo n.º 23
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.instanceID = stream.readInt();

        this.id = stream.readInt();

        this.level = stream.readInt();

        this.targetData = (SkillTargetData)stream.readDataSimpleNotNull();
    }
Exemplo n.º 24
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.attackID         = 0;
        this.attackLevel      = 0;
        this.targetData       = null;
        this.targets          = null;
        this.isBulletFirstHit = false;
    }
Exemplo n.º 25
0
    /** 清空当前数据 */
    private void clearCurrentCommand()
    {
        _commandType = UnitAICommandType.None;
        _commandOver = null;

        _commandSkillData       = null;
        _commandSkillTargetData = null;
        _commandMoveType        = UnitMoveType.Run;
        _commandUnit.clear();
    }
Exemplo n.º 26
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.skillID = 0;
        this.targetData.release(pool);
        this.targetData = null;
        this.posDir.release(pool);
        this.posDir    = null;
        this.isSuspend = false;
    }
Exemplo n.º 27
0
    /// <summary>
    /// 创建实例
    /// </summary>
    public static CUnitUseSkillRequest create(int instanceID, int skillID, SkillTargetData targetData, PosDirData posDir, bool isSuspend)
    {
        CUnitUseSkillRequest re = (CUnitUseSkillRequest)BytesControl.createRequest(dataID);

        re.instanceID = instanceID;
        re.skillID    = skillID;
        re.targetData = targetData;
        re.posDir     = posDir;
        re.isSuspend  = isSuspend;
        return(re);
    }
Exemplo n.º 28
0
    /** 获取技能目标数据位置 */
    public void getSkillTargetDirection(DirData re, PosData pos, SkillTargetData tData)
    {
        if (tData.type == SkillTargetType.None || tData.type == SkillTargetType.AttackScope)
        {
            Unit unit = _scene.getFightUnit(tData.targetInstanceID);

            if (unit != null)
            {
                re.copyDir(unit.pos.getDir());
            }
            else
            {
                re.clear();
            }

            return;
        }

        if (tData.targetInstanceID != -1)
        {
            Unit unit = _scene.getFightUnit(tData.targetInstanceID);

            if (unit != null)
            {
                _scene.pos.calculateDirByPos(re, pos, unit.pos.getPos());
            }
            else
            {
                re.clear();
            }
        }
        else
        {
            PosData pp = tData.pos;

            if (pp != null)
            {
                _scene.pos.calculateDirByPos(re, pos, pp);
            }
            else
            {
                if (tData.dir == null)
                {
                    re.clear();
                }
                else
                {
                    re.copyDir(tData.dir);
                }
            }
        }
    }
Exemplo n.º 29
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.skillID = stream.readInt();

        this.skillLevel = stream.readInt();

        this.targetData = (SkillTargetData)stream.readDataSimpleNotNull();

        this.posDir = (PosDirData)stream.createData(PosDirData.dataID);
        this.posDir.readBytesSimple(stream);
    }
Exemplo n.º 30
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is BulletData))
        {
            return;
        }

        BulletData mData = (BulletData)data;

        this.instanceID = mData.instanceID;
        this.id         = mData.id;
        this.level      = mData.level;
        this.targetData = mData.targetData;
    }