LTDescr.setDirection C# (CSharp) Method

setDirection() public method

public setDirection ( float direction ) : LTDescr
direction float
return LTDescr
    public LTDescr setDirection( float direction )
    {
        if(this.direction!=-1f && this.direction!=1f){
            Debug.LogWarning("You have passed an incorrect direction of '"+direction+"', direction must be -1f or 1f");
            return this;
        }

        if(this.direction!=direction){
            // Debug.Log("reverse path:"+this.path+" spline:"+this._optional.spline+" hasInitiliazed:"+this.hasInitiliazed);
            if(this.hasInitiliazed){
                this.direction = direction;
            }else{
                if(this._optional.path!=null){
                    this._optional.path = new LTBezierPath( LTUtility.reverse( this._optional.path.pts ) );
                }else if(this._optional.spline!=null){
                    this._optional.spline = new LTSpline( LTUtility.reverse( this._optional.spline.pts ) );
                }
                // this.passed = this.time - this.passed;
            }
        }

        return this;
    }

Usage Example

Beispiel #1
0
 private void OnMovingBlockTriggerExit(int id)
 {
     if (id == Id)
     {
         // If the movement is completed, we need to create a new one in a reversed direction
         if (movement.ratioPassed == 1f)
         {
             movement = LeanTween.moveSpline(gameObject, spline.pts, MovementSpeed / 2).setEase(LeanTweenType.easeInOutQuad).setDirection(-1);
             rotation = LeanTween.rotate(gameObject, initialRotation.eulerAngles, MovementSpeed / 2);
         }
         else
         {
             movement.setDirection(-1).setTime(MovementSpeed / 2);
             rotation.setDirection(-1).setTime(MovementSpeed / 2);
         }
     }
 }
All Usage Examples Of LTDescr::setDirection
LTDescr