public void ImpactForce( Vector3 _vF ) { gameObject.rigidbody.useGravity = true; Physics.gravity = new Vector3(0.0f,-3.0f,0.0f); gameObject.rigidbody.AddForce( _vF, ForceMode.Impulse ); m_Camera.SendMessage( "Trace" ); m_eStat = e_Stat.HITTED; }
public void Init() { m_fPitchTimer = m_fPitchTime; m_eStat = e_Stat.NONE; m_Throw.Init(); gameObject.rigidbody.useGravity = false; gameObject.rigidbody.velocity = Vector3.zero; gameObject.rigidbody.angularVelocity = Vector3.zero; }
public void BackSwing() { switch( m_eStat ) { case e_Stat.STAND: m_eStat = e_Stat.BACKSWING; m_MyAnim.CrossFade( "BackSwing" ); break; default: break; } }
public void Stand() { m_eStat = e_Stat.STAND; m_MyAnim.CrossFade( "Stand" ); }
public void Throw( ThrowParam _param ) { if( e_Stat.NONE != m_eStat ) return; m_Throw.Copy( _param ); m_eStat = e_Stat.THROWING; }
// Update is called once per frame private void Update() { switch( m_eStat ) { case e_Stat.NONE: m_fPitchTimer -= Time.deltaTime; if( 0.0f > m_fPitchTimer ) { Throw( m_Throw ); m_fPitchTimer = m_fPitchTime; } break; case e_Stat.THROWING: switch( m_Throw.m_eStuff ) { case e_Stuff.NONE: case e_Stuff.SLOW: gameObject.rigidbody.velocity = new Vector3(0.0f,1.6f,-4.0f); gameObject.rigidbody.useGravity = true; Physics.gravity = new Vector3(0.0f,-3.0f,0.0f); m_eStat = e_Stat.THROWED; break; case e_Stuff.STRAIGHT: gameObject.rigidbody.velocity = new Vector3(0.0f,0.0f,-8.0f); gameObject.rigidbody.useGravity = true; Physics.gravity = new Vector3(0.0f,-1.0f,0.0f); m_eStat = e_Stat.THROWED; break; default: break; } m_ComInfoScript.m_eGameSeq = e_GameSeq.PITCHER_THROW; break; case e_Stat.THROWED: if( ShouldReturn() ) { Return(); m_ComInfoScript.m_eGameSeq = e_GameSeq.BEGIN; } break; case e_Stat.HITTED: if( ShouldReturn() ) { Return(); m_ComInfoScript.m_eGameSeq = e_GameSeq.BEGIN; } break; default: break; } }