public void transportObject(Money someCoin)
        {
            someCoin.Center = exitPoint;
            //someCoin.CenterY += 100f;

            if ( ! maintainVelocityDirection )
                someCoin.VelocityDirection = this.VelocityDirection;

            someCoin.ShouldTravel = true;
            someCoin.TopOfAutoDrawSet();
        }
Beispiel #2
0
        /// <summary>
        /// Start spawning Money.  Spawns one coin and only if there are coins
        /// left to spawn.
        /// </summary>
        public virtual void SpawnMoney()
        {
            /*If it's time to spawn again*/
            if (this.ticks_to_spawn <= 0 && num_active < 10 && num_spawned < num_spawns)
            {
                // set "down" texture.
                this.SetTextureSpriteAnimationFrames(2, 0, 2, 0, 40, SpriteSheetAnimationMode.AnimateForward);
                this.UseSpriteSheetAnimation = true;

                /*Reset spawn clock*/
                this.ticks_to_spawn = this.spawn_freq;

                Money newCoin = new Money(this.Center, 5f, 5.0f);

                #region Vector Calculations
                Vector2 T = this.FrontDirection;
                Vector2 N = this.NormalDirection;

                /*shoot coin off in a random velocity vector between (-theta, theta)*/
                float angle_offset = (270 + XNACS1Base.RandomFloat(-this.theta, this.theta)) * (float)Math.PI / 180; ;
                float vT = (float)(Math.Cos(angle_offset));
                float vN = (float)(Math.Sin(angle_offset));
                Vector2 V_hat = (vT * T) + (vN * N);

                newCoin.Velocity = kLaunchSpeed * V_hat;
                #endregion

                /*Draw and get coin moving*/
                newCoin.GetMoving();

                this.coins.AddLast(newCoin);

                ++num_active;
                ++num_spawned;
            }
            else
            {
                /*Countdown*/
                --this.ticks_to_spawn;

                if (this.ticks_to_spawn < this.spawn_freq * 0.75f && num_spawned < num_spawns)
                {
                    // set "up" texture.
                    this.SetTextureSpriteAnimationFrames(1, 0, 1, 0, 40, SpriteSheetAnimationMode.AnimateForward);
                    this.UseSpriteSheetAnimation = true;
                }
                else
                {
                    // set "idle" texture.
                    this.SetTextureSpriteAnimationFrames(0, 0, 0, 0, 40, SpriteSheetAnimationMode.AnimateForward);
                    this.UseSpriteSheetAnimation = true;
                }
            }
        }