public void SetMode(TouchSphere sourceSphere) { Mode targetMode = null; foreach (var m in Modes) { if (m.TouchSphere != sourceSphere) { continue; } targetMode = m; break; } if (targetMode == null) { throw new System.Exception("Didn't find sourceSphere " + sourceSphere.gameObject.name + " in mode list"); } StartCoroutine(RunModeRoutine(targetMode)); }
// private void OnCollisionEnter(Collision collision) { // if( !m_bInit ) return; // if( m_bRotating || this.IsTweening ) return; // TouchSphere sphere = collision.gameObject.GetComponent<TouchSphere>(); if( sphere == null ) return; m_TouchSphere = sphere; if( sphere.Velocity.magnitude > m_TouchVelocity ) { DoFeedBack(); } else { this.transform.position += m_MoveDir * sphere.Velocity.magnitude * Time.deltaTime; } }
// private void OnRotateCompleted() { // m_bRotating = false; // m_TouchSphere = null; // if( m_TouchButton.OnClicked != null ) m_TouchButton.OnClicked( m_TouchButton ); }
// private void OnCollisionExit(Collision collision) { // if( !m_bInit ) return; // if( m_bRotating || this.IsTweening ) return; // TouchSphere sphere = collision.gameObject.GetComponent<TouchSphere>(); if( sphere == null ) return; // if( m_TouchSphere != sphere ) return; m_TouchSphere = null; iTween.MoveTo( this.gameObject, iTween.Hash( "position", m_vLocalPos, "islocal", true ) ); // if( this.OnHover != null ) this.OnHover( m_TouchButton, false ); }