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; } } }
// Use this for initialization void Start() { previousHeight = Camera.main.transform.position.y; walkBounce = GetComponent <HeadLookWalkBounce> (); }