Example #1
0
        public ObstacleCreator(Player U, int speed)
        {
            rand  = new Random();
            User  = U;
            Speed = speed;

            //Gives a value to avoid null errors.
            OFactory = new SlugFactory(U, speed);
        }
Example #2
0
//=============================================================================================
        //Returns the obstacle that corresponds with T.
        Obstacle Create(OTypes T)
        {
            switch (T)
            {
            case OTypes.Slug:
                OFactory = new SlugFactory(User, Speed);
                break;

            case OTypes.Beetle:
                OFactory = new BeetleFactory(User, Speed);
                break;

            case OTypes.BrokenWindow:
                OFactory = new WindowFactory(User, Speed);
                break;

            default:
                break;
            }
            return(OFactory.Create());
        }