IEnumerator AttractToCamera() { if (m_animator == null) { m_animator = GetComponentInChildren <Animator>(); } ClipPlanePoints clipPoints = ClipPlanePoints.Instance; Camera camera = clipPoints.Camera; while (clipPoints.CollidesLeft(transform.position, 3.7f)) { yield return(new WaitForSeconds(.1f)); } m_velMultiplier = 1f; //TODO: Don't hard-code this... while (clipPoints.CollidesLeft(transform.position, -.8f)) { yield return(new WaitForSeconds(.1f)); } m_animator.SetFloat("speed", Velocity.magnitude); m_animator.SetBool("isEnabled", true); //TODO: Don't hard-code this... while (!clipPoints.CollidesRight(transform.position, -4.4f)) { yield return(new WaitForSeconds(.1f)); } m_animator.SetBool("isEnabled", false); }
protected virtual IEnumerator CheckCollision() { ClipPlanePoints points = ClipPlanePoints.Instance; if (points != null) { while (true) { if (points.CollidesRight(transform.position)) { break; } yield return(new WaitForSeconds(.5f)); } //TODO: boden, should we recycle this instead? Recycle(); } }