Beispiel #1
0
    // -----------------------------
    //	private datamember
    // -----------------------------

    #region privateMember

    #endregion privateMember


    // -----------------------------
    //	monobehaviour
    // -----------------------------

    #region MonoBehaviour
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.B))
        {
            print("now adding force");
            jellySprite.AddForceAtPosition(Vector2.up * 6000.0f, new Vector2(this.transform.position.x - 40.0f, this.transform.position.y));
        }
    }
Beispiel #2
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (coll.Raycast(Camera.main.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 3.0f)), out hit, 99999.9f))
            {
                StopAllCoroutines();
                StartCoroutine(showTouchedObjsFor());
                //mJellySprite.AddForceAtPosition((new Vector2(this.transform.position.x, this.transform.position.y) - new Vector2(hit.point.x, hit.point.y)) * force , new Vector2(hit.point.x, hit.point.y));
                //mJellySprite.AddForceAtPosition(Vector2.right * force , new Vector2(hit.point.x, hit.point.y));

                if (hit.point.x < this.transform.position.x)
                {
                    mJellySprite.AddForceAtPosition(new Vector2(0.7f, 0.3f) * force, new Vector2(hit.point.x, hit.point.y));
                }
                else
                {
                    mJellySprite.AddForceAtPosition(new Vector2(-0.7f, 0.3f) * force, new Vector2(hit.point.x, hit.point.y));
                }
            }
        }
    }