Beispiel #1
0
        private int moveCount = 0;      // used to compute the cost of a train

        /// <summary>
        /// 1voxel動かす
        /// </summary>
        public void move(CarState next)
        {
            if (next.isOutside && next.asOutside().timeLeft == OUTSIDE_COUNTER_INITIAL_VALUE / 2)
            {
                // unload the passengers and reload them
                unloadPassengers();
                loadPassengers(null, Math.Min(100, passengerCapacity)); // TODO: compute the value seriously
            }

            for (int i = 0; i < cars.Length; i++)
            {
                next = cars[i].moveTo(next);
            }

            // moving a train costs money
            if (((moveCount++) & 15) == 0)
            {
                // TODO: exact amount is still under debate
                AccountManager.theInstance.spend(length * 20 + (passenger / 20), AccountGenre.RailService);
            }

            playSound(thudSound);
        }