示例#1
0
        public void Update(float deltaTime)
        {
            Random random = Game1.Singleton.Random;

            currentTime += deltaTime;

            if (currentTime >= Interval)
            {
                if (MaxCount != currentCount)
                {
                    NpcCar car = new NpcCar();

                    int rand = random.Next(0, 4);

                    if (rand == 0)
                    {
                        car.CopyCat(CarGarage.Singleton.Get("Yellow"));
                    }
                    else if (rand == 1)
                    {
                        car.CopyCat(CarGarage.Singleton.Get("Bus_Blue"));
                    }
                    else if (rand == 2)
                    {
                        car.CopyCat(CarGarage.Singleton.Get("Bus_Green"));
                    }
                    car.Y = -300;
                    Add(car);
                }
                currentTime = 0;
            }
        }
示例#2
0
        public void Update(float deltaTime)
        {
            Random random = Game1.Singleton.Random;

            currentTime += deltaTime;

            if (currentTime >= Interval)
            {
                if (MaxCount != currentCount)
                {
                    NpcCar car = new NpcCar();

                    int rand = random.Next(0, 6);

                    if (rand == 0 || rand == 2 || rand == 3)
                    {
                        car.CopyCat(CarGarage.Singleton.Get("Orange"));
                    }
                    else if (rand == 4)
                    {
                        car.CopyCat(CarGarage.Singleton.Get("Bus_Blue"));
                    }
                    else
                    {
                        car.CopyCat(CarGarage.Singleton.Get("Bus_Green"));
                    }
                    car.Y = -300;
                    Add(car);
                }
                currentTime = 0;
            }

            if (npcs != null)
            {
                NpcCar[] arr = npcs.ToArray();

                for (int i = 0; i < arr.Count(); i++)
                {
                    for ( int j = 0; j < arr.Count(); j++)
                    {
                        if ( i != j )
                        {
                            this.ParseCarsCollisionCheck(arr[i], arr[j], deltaTime);
                        }
                    }
                }
            }
        }