Пример #1
0
    /** 上载具 */
    public void onGetOnVehicle(int vehicleInstanceID, int index)
    {
        Unit unit = _scene.getUnit(vehicleInstanceID);

        if (unit == null)
        {
            Ctrl.warnLog("上载具时,未找到载具");
            return;
        }

        VehicleIdentityLogic logic = unit.getVehicleIdentityLogic();

        logic.addDrive(index, _unit.instanceID);

        stopMove();

        _vehicle             = unit;
        _vehicleIndex        = index;
        _d.vehicleInstanceID = unit.instanceID;

        //可控的话,赋值控制
        if (logic.canDriveIndex(index))
        {
            logic.getData().controlPlayerID = unit.identity.controlPlayerID;
        }

        //设置位置朝向
        _unit.pos.setByPosDir(_vehicle.pos.getPosDir());

        //添加影响
        // logic.addDriveInfluence(_unit);

        onDriveChanged();
    }
Пример #2
0
    protected void doGetOffVehicle(PosData pos)
    {
        VehicleIdentityLogic logic = _vehicle.getVehicleIdentityLogic();

        // logic.removeDriveInfluence(_unit);

        logic.removeDrive(_vehicleIndex);

        _d.vehicleInstanceID = -1;
        _vehicle             = null;
        _vehicleIndex        = -1;

        _unit.pos.setPos(pos);

        onDriveChanged();
    }