Ejemplo n.º 1
0
    public void Shoot(Vector3 point)
    {
        if (!aiming)
        {
            return;
        }
        //myTrans.rotation = Quaternion.LookRotation (point - myTrans.position, myTrans.up);

        rotating = false;
        aiming   = false;
        CurveCaster.singleton.done = true;
        myTrans.rotation           = targetRotation;
        //CurveCaster.singleton.SetTarget (point);

        Vector3      pos  = CurveCaster.singleton.myTrans.position;
        Vector3      spd  = CurveCaster.singleton.myTrans.rotation * Vector3.forward * CurveCaster.singleton.speed;
        TauntingRock rock = ((GameObject)GameObject.Instantiate(GameManager.singleton.rock, pos, CurveCaster.singleton.myTrans.rotation)).GetComponent <TauntingRock> ();

        rock.tauntRadiusMul = CurveCaster.singleton.tauntRadiusMul;
        //rock.Throw (CurveCaster.singleton.myTrans.position, CurveCaster.singleton.dir * CurveCaster.singleton.speed);
        rock.Throw(pos, spd);
        //CurveCaster.singleton.StopAim ();
        CurveCaster.singleton.timer   = CurveCaster.singleton.time;
        CurveCaster.singleton.stopper = rock.gameObject;

        Vector3 v = spd;

        Debug.DrawLine(pos, pos + v, Color.red, 5);
        Vector3 xz = Vector3.ProjectOnPlane(v, Vector3.up);

        Debug.DrawLine(pos + xz, pos + v, Color.red, 5);
        Debug.DrawLine(pos, pos + xz, Color.red, 5);

        MySlider.singleton.StopSlider();
    }