Exemple #1
0
    private IEnumerator PhysicsSwing()
    {
        //TODO: use Rigidbody.MoveRotation instead
        GetComponent <Rigidbody> ().AddForce(batForce);
        GetComponent <Rigidbody> ().AddRelativeTorque(batTorque, ForceMode.Acceleration); //旋轉
        //-y 90度 z 25度
        yield return(new WaitForSeconds(swingDuration));

        originalTransform.Set(this.gameObject);
        AfterSwing();
    }
Exemple #2
0
    public void Reset()
    {
        Debug.Log("Reset ball");
        GetComponent <TrailRenderer> ().Clear();
        GetComponent <Rigidbody> ().useGravity = false;
        startTransform.Set(this.gameObject);
        isHit = false;

        Stop();

        state = new PitchState(this);

        angleText.text    = "";
        distanceText.text = "";
    }
Exemple #3
0
 public void Reset()
 {
     startTransform.Set(this.gameObject);
     Enable();
 }