Пример #1
0
 public FreeMovementCtrl(AnimationCurve releasingCurve, bool toAlign,
                         float overGoingDistanceThreshold,
                         Func <float> getAligningDistance, Func <PositionState> getPositionState)
 {
     _releasingMovement = new VelocityMovement(releasingCurve);
     _aligningMovement  = new DistanceMovement(
         AnimationCurve.EaseInOut(0.0f, 0.0f, 0.25f, 1.0f));
     _toAlign = toAlign;
     _overGoingDistanceThreshold = overGoingDistanceThreshold;
     _getAligningDistance        = getAligningDistance;
     _getPositionState           = getPositionState;
 }
Пример #2
0
    public UnitMovementCtrl(AnimationCurve movementCurve, float bouncingDeltaPos,
                            Func <float> getAligningDistance, Func <PositionState> getPositionState)
    {
        var bouncingCurve = new AnimationCurve(
            new Keyframe(0.0f, 0.0f, 0.0f, 5.0f),
            new Keyframe(0.125f, 1.0f, 0.0f, 0.0f),
            new Keyframe(0.25f, 0.0f, -5.0f, 0.0f));

        _unitMovement        = new DistanceMovement(movementCurve);
        _bouncingMovement    = new DistanceMovement(bouncingCurve);
        _bouncingDeltaPos    = bouncingDeltaPos;
        _getAligningDistance = getAligningDistance;
        _getPositionState    = getPositionState;
    }