コード例 #1
0
    void OnTriggerEnter(Collider other)
    {
        Rigidbody rb = other.GetComponent <Rigidbody> ();

        if (rb != null)
        {
            rb.AddForce(Vector3.up * bounceForce);
        }
        else
        {
            HeadLookWalkBounce locomotor = other.GetComponent <HeadLookWalkBounce> ();
            if (locomotor != null)
            {
                locomotor.bounceForce = bounceForce;
            }
        }
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     previousHeight = Camera.main.transform.position.y;
     walkBounce     = GetComponent <HeadLookWalkBounce> ();
 }