示例#1
0
 // Use this for initialization
 void Start()
 {
     controller = GetComponent <RB_Controller2D> ();
     rb         = GetComponent <Rigidbody2D> ();
     //spriteCollider = GetComponentInChildren<PolygonCollider2D> ();
     boxCollider   = GetComponent <BoxCollider2D> ();
     leftCollision = rightCollision = bottomCollision = topCollision = grounded = false;
 }
    /*public float jumpHeight = 4;
     * public float timeToJumpApex = 0.4f;
     * public float moveSpeed = 6;
     *
     * public float jumpVelocity = 5;*/

    // Use this for initialization
    void Start()
    {
        controller = GetComponent <RB_Controller2D> ();
        rb         = GetComponent <Rigidbody2D> ();
        collider   = GetComponent <PolygonCollider2D> ();

        /*rb.gravityScale = (2 * jumpHeight) / Mathf.Pow (timeToJumpApex, 2);
         * rb.gravityScale = rb.gravityScale / 10;
         * //jumpVelocity = Mathf.Abs (rb.gravityScale) * timeToJumpApex;
         * print (jumpVelocity);*/
    }