Ejemplo n.º 1
0
    public void throwMe(Vector3 loc)
    {
        gameObject.GetComponent <AudioSource>().Play();
        StartCoroutine(spin());
        bezier = Instantiate((GameObject)Resources.Load("Prefabs/Giraffe Curve", typeof(GameObject)));

        curve = bezier.GetComponent <BezierCurves>();
        curve.controlPoints[0].transform.position = gameObject.transform.position;
        curve.controlPoints[2].transform.position = loc;
        float y = Mathf.Max(curve.controlPoints[0].transform.position.y, curve.controlPoints[2].transform.position.y) + 5;
        float x = (curve.controlPoints[0].transform.position.x + curve.controlPoints[2].transform.position.x) / 2;

        curve.controlPoints[1].transform.position = new Vector3(x, y, 0);
        curve.lockedObject = gameObject;
        curve.animateIt(2);
        StartCoroutine(finishThrow());
    }