IEnumerator ShootOutState() { showDebugState("ShootOut: Enter"); mooseAnimator.state = MooseAnimator.BodyState.Ball; while (state == MooseState.ShootOut) { float speed = rigidbody2D.velocity.magnitude; //Debug.Log ("speed : " + speed); if (speed > shootOutSpeed || speed <= previousShoutOutSpeed) { state = MooseState.Ball; } else if (speed == previousShoutOutSpeed) { state = MooseState.Stand; } previousShoutOutSpeed = speed; yield return(null); } showDebugState("ShootOut: Exit"); NextState(); }
IEnumerator ChargedState() { showDebugState("Charged: Enter"); mooseAnimator.state = MooseAnimator.BodyState.Charged; while (state == MooseState.Charged) { //animation.Play ("Move"); float speed = rigidbody2D.velocity.magnitude; //Debug.Log ("speed : " + speed); //[self bodyAnimation:LARGE_BODY]; //TODO: change this //[self rotateToAngle:0 radians:NO]; if (Mathf.Abs(speed) > 0) { state = MooseState.Ball; //rigidbody2D.velocity = Vector3.zero; } yield return(null); } showDebugState("Charged: Exit"); if (state == MooseState.Ball) { soundManager.HitCharged.Play(); } else if (state == MooseState.ShootOut) { soundManager.Launch.Play(); } NextState(); }
void collisionStuff(Collision2D coll) { state = MooseState.ShootOut; GameManager.instance.AddSplosion((Vector3)coll.contacts[0].point); soundManager.MooseHitMoose.Play(); rigidbody2D.isKinematic = false; coll.gameObject.rigidbody2D.isKinematic = false; }
IEnumerator BallState() { showDebugState("Ball: Enter"); mooseAnimator.state = MooseAnimator.BodyState.Ball; while (state == MooseState.Ball) { float speed = rigidbody2D.velocity.magnitude; if (Mathf.Abs(speed) < stopBallingSpeed) { state = MooseState.Stand; rigidbody2D.velocity = Vector2.zero; } yield return(null); } showDebugState("Ball: Exit"); NextState(); }
IEnumerator ChargingState() { showDebugState("Charging: Enter"); mooseAnimator.state = MooseAnimator.BodyState.Charging; soundManager.Inflate.Play(); while (state == MooseState.Charging) { //animation.Play ("Move"); float speed = rigidbody2D.velocity.magnitude; if (Mathf.Abs(speed) > 0) { state = MooseState.Ball; //rigidbody2D.velocity = Vector3.zero; } yield return(null); } showDebugState("Charging: Exit"); if (state == MooseState.Ball) { soundManager.HitCharged.Play(); } NextState(); }
public void setCharged() { mooseAnimator.state = MooseAnimator.BodyState.Charged; state = MooseState.Charged; }