void OnCollisionEnter(Collision collision) { if(LayerMask.LayerToName(collision.gameObject.layer) != "ground"){ currentMotionState = motion_state.sit; startAnimation(); transform.position -= transform.forward * Time.deltaTime*6; if (Debug.isDebugBuild)Debug.Log (collision.gameObject.name); } }
public void changeMotionState(motion_state state) { currentMotionState = state; startAnimation(); }
/*} }*/ void changeMotionState() { int r = Random.Range(0,100); int c = 0; for (int i = 0; i < MOTION_CHANGE.GetLength(0); i++) { c+=MOTION_CHANGE[(int)currentMotionState,i]; if (c >= r) { if (System.Enum.IsDefined(typeof(motion_state), i)) { currentMotionState = (motion_state) i; if (Debug.isDebugBuild)Debug.Log ("MOTIONSTATE:"+currentMotionState); break; } } } //gameObject.animation.CrossFade(System.Enum.GetName(typeof(motion_state), currentMotionState)); // motionInterval = (float) Random.Range(DEFAULT_MOTION_INTERVAL-2.0f,DEFAULT_MOTION_INTERVAL+2.0f); startAnimation(); }