예제 #1
0
    void FixedUpdate()
    {
        if (stickSide != lastStickSide)
        {
            lastStickSide = stickSide;
            calculateDirections();
        }

        applyMovement();
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        if (!rigidbody)
        {
            rigidbody = GetComponent <Rigidbody2D>();
        }
        if (!transform)
        {
            transform = GetComponent <Transform>();
        }
        if (!collider)
        {
            collider = GetComponent <Collider2D>();
        }

        rigidbody.isKinematic    = true;
        rigidbody.freezeRotation = true;
        lastStickSide            = stickSide;
        calculateDirections();
    }