Exemple #1
0
    /** 设置坐标和朝向 */
    public void setByPosDir(PosDirData posDir)
    {
        _pos.copyPos(posDir.pos);
        _dir.copyDir(posDir.dir);

        onSetPos();
        onSetDir();
    }
Exemple #2
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);
                }
            }
        }
    }
Exemple #3
0
    /** 初始化位置和朝向 */
    protected virtual void initPos()
    {
        _pos.copyPos(_unit.pos.getPos());

        if (!_data.isInitiative && _data.targetData.dir != null)
        {
            _dir.copyDir(_data.targetData.dir);
        }
        else
        {
            //这两种取自己的
            if (_data.targetData.type == SkillTargetType.None || _data.targetData.type == SkillTargetType.AttackScope)
            {
                getMoveDirectionBySelf(_dir);
            }
            else
            {
                _scene.fight.getSkillTargetDirection(_dir, _pos, _data.targetData);
            }
        }

        float[] castOff;
        if ((castOff = _config.castOff).Length > 0)
        {
            _scenePosLogic.addPolar2D(_pos, castOff[0], _dir);

            if (castOff.Length > 1)
            {
                _pos.y += castOff[1];
            }
        }
    }
Exemple #4
0
    /// <summary>
    /// 朝向 相加
    /// </summary>
    public DirData func_AddDirFloat(SceneTriggerExecutor e, TriggerArg a, DirData dir, float value)
    {
        DirData re = new DirData();

        re.copyDir(dir);
        re.direction = MathUtils.directionCut(re.direction + value);
        return(re);
    }
    /** 移动朝向 */
    public void moveDir(DirData dir)
    {
        clearCurrentCommand();

        _commandType = UnitAICommandType.MoveDir;
        _commandDir.copyDir(dir);

        runCommand();
    }
Exemple #6
0
    /// <summary>
    /// 朝向 相加
    /// </summary>
    public DirData func_AddDir(SceneTriggerExecutor e, TriggerArg a, DirData dir, DirData value)
    {
        DirData re = new DirData();

        re.copyDir(dir);
        re.direction = MathUtils.directionCut(re.direction + value.direction);
        //re.directionX+=dir2.directionX;
        return(re);
    }
Exemple #7
0
 /** 获取自身子弹移动朝向 */
 protected virtual void getMoveDirectionBySelf(DirData re)
 {
     re.copyDir(_unit.pos.getDir());
 }
Exemple #8
0
 private void makeShootDir(DirData data)
 {
     data.copyDir(((GUnitPosData)_unit.getUnitData().pos).shootDir);
 }