Exemple #1
0
    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();
    }
Exemple #2
0
    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();
    }
Exemple #3
0
 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;
 }
Exemple #4
0
    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();
    }
Exemple #5
0
    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();
    }
Exemple #6
0
 public void setCharged()
 {
     mooseAnimator.state = MooseAnimator.BodyState.Charged;
     state = MooseState.Charged;
 }