예제 #1
0
파일: Car.cs 프로젝트: iAmGhost/OverDrive
 public virtual void CopyCat(Car car)
 {
     TexturePath = car.TexturePath;
     AcceleratingSpeed = car.AcceleratingSpeed;
     SteerSpeed = car.SteerSpeed;
     MaxSpeed = car.MaxSpeed;
     MinSpeed = car.MinSpeed;
     MaxSpeed_Copy = MaxSpeed;
     MinSpeed_Copy = MinSpeed;
     Init();
 }
예제 #2
0
파일: Car.cs 프로젝트: iAmGhost/OverDrive
 public virtual void CopyCat(Car car)
 {
     TexturePath = car.TexturePath;
     AcceleratingSpeed = car.AcceleratingSpeed;
     SteerSpeed = car.SteerSpeed;
     MaxSpeed = car.MaxSpeed;
     MinSpeed = car.MinSpeed;
     MaxSpeed_Copy = MaxSpeed;
     MinSpeed_Copy = MinSpeed;
     if (TexturePath != null)
     {
         ContentManager content = Game1.Singleton.Content;
         texture = content.Load<Texture2D>(TexturePath);
         TexturePath = null;
     }
     Init();
 }
예제 #3
0
 public void Add(string carName, Car car)
 {
     cars[carName] = car;
 }
예제 #4
0
 private void ParseCarsCollisionCheck(Car carA, Car carB, float deltaTime)
 {
     Random random = Game1.Singleton.Random;
     if (carA.Rect.Intersects(carB.Rect))
     {
         #region Steering-Related
         if (carB.X + carB.Width / 2 <= carA.X + carA.Width / 2)
         {
             //오른쪽 충돌
             if (carB.Weight > carA.Weight)
             {
                 //carB가 carA보다 무거움
                 carB.Steer(-10 * deltaTime);
                 carA.Steer(10 * deltaTime);
             }
             else if (carB.Weight < carA.Weight)
             {
                 //carA가 carB보다 무거움
                 carB.Steer(10 * deltaTime);
                 carA.Steer(-10 * deltaTime);
             }
             else
             {
                 //무게가 같음
                 carB.Steer(-10 * deltaTime);
                 carA.Steer(10 * deltaTime);
             }
         }
         else
         {
             //왼쪽 충돌
             if (carB.Weight > carA.Weight)
             {
                 //carB가 carA보다 무거움
                 carB.Steer(10 * deltaTime);
                 carA.Steer(-10 * deltaTime);
                 carB.Accelerate(-20 * deltaTime);
             }
             else if (carB.Weight < carA.Weight)
             {
                 //carA가 carB보다 무거움
                 carB.Steer(-10 * deltaTime);
                 carA.Steer(10 * deltaTime);
                 carA.Accelerate(-20 * deltaTime);
             }
             else
             {
                 //무게가 같음
                 carB.Steer(10 * deltaTime);
                 carA.Steer(-10 * deltaTime);
                 carA.Accelerate(-100 * deltaTime);
                 carB.Accelerate(-100 * deltaTime);
             }
         }
         #endregion
     }
 }