Пример #1
0
 private Food(Food Food)
     : base(Food._Model, Food._Bound)
 {
     _Type = Food._Type;
     _Strength = Food._Strength;
     _World = Matrix.CreateRotationX((float)-(Math.PI / 2)) * Matrix.CreateTranslation(_Position);
 }
Пример #2
0
        public void Setup()
        {
            #region Necessary To Load
            Random r = new Random();
            bool Overlap = true;

            Model[] m = new Model[3];
            m[0] = Content.Load<Model>("Models/Pizza");
            m[1] = Content.Load<Model>("Models/Orange");
            m[2] = Content.Load<Model>("Models/Banana");
            FoodType[] ft = new FoodType[3];
            ft[0] = FoodType.Pizza;
            ft[1] = FoodType.Orange;
            ft[2] = FoodType.Banana;
            #endregion
            #region Hole
            for (int i = 0; i < _HOLECOUNT; ++i)
            {
                Hole h;

                do
                {
                    h = new Hole(Content.Load<Model>("Models/Hole"),
                    new Vector3(r.Next(-(_WIDTH / 2), _WIDTH / 2) * -2f, 0, r.Next(1, _DEPTH - 1) * -2f),
                    new Vector3(-1f, 0, -1f),
                    new Vector3(1f, 0.5f, 1f),
                    new Chef(Content.Load<Model>("Models/Chef"), new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 3, 0.5f),
                    _MINTHROWTIMER,
                    _MAXTHROWTIMER,
                    _ChefStrength),
                    _MINMOVE,
                    _MAXMOVE,
                    _MINSPAWN,
                    _MAXSPAWN);

                    Overlap = false;
                    foreach (Hole node in _HoleList)
                        if (node._Bound.Intersects(h._Bound))
                            Overlap = true;

                } while (Overlap);
                Overlap = true;
                _HoleList.Add(h);
            }
            #endregion
            #region Food
            for (int i = 0; i < _FOODCOUNT; ++i)
            {
                Food f;
                do
                {
                    int num = r.Next(3);
                    f = new Food(m[num],
                        new Vector3(r.Next(-(_WIDTH / 2), _WIDTH / 2) * -2f, 0, r.Next(1, _DEPTH - 1) * -2f),
                        new Vector3(-0.5f, 0, -0.5f),
                        new Vector3(0.5f, 1, 0.5f),
                        ft[num]);

                    Overlap = false;
                    foreach (Hole node in _HoleList)
                        if (node._Bound.Intersects(f._Bound))
                            Overlap = true;
                    foreach (Food node in _FoodList)
                        if (node._Bound.Intersects(f._Bound))
                            Overlap = true;

                } while (Overlap);
                Overlap = true;
                _FoodList.Add(f);
            }

            _TypeList.Add(new Food(m[0], new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), _PizzaStrength));
            _TypeList.Add(new Food(m[1], new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), _OrangeStrength));
            _TypeList.Add(new Food(m[2], new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), _BananaStrength));

            _ThrownList = new List<Food>();
            #endregion

            _IceCream.SetPosition(new Vector3(r.Next(-(_WIDTH / 2), (_WIDTH / 2) + 1) * -2, 0, (_DEPTH) * -2));
            _Player.SetPosition(Vector3.Zero);
            _Player.SetStrength(_PlayerStrength);
        }
Пример #3
0
 internal Food Clone()
 {
     Food f = new Food(this);
     return f;
 }
Пример #4
0
        public void Initialize(ContentManager Content)
        {
            this.Content = Content;
            _Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 600f, 0.1f, 600);
            _Bounds = new BoundingBox(new Vector3(((_WIDTH / 2) + 1) * -2f, -10, (_DEPTH + 1) * -2f), new Vector3((-(_WIDTH / 2) - 1) * -2f, 10, 2f));
            _Camera = new Camera();
            _FoodList = new List<Food>();
            _HoleList = new List<Hole>();
            _ObjectList = new List<Object>();
            _TypeList = new List<Food>();
            #region Ice Cream
            _IceCream = new Food(Content.Load<Model>("Models/IceCream"), Vector3.Zero, new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 1, 0.5f), FoodType.None);
            #endregion
            #region Player
            _Player = new Character(Content.Load<Model>("Models/Player"), new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 3, 0.5f), _PlayerStrength);
            #endregion
            #region Floor
            for (int i = -(_WIDTH / 2) - 1; i < (_WIDTH / 2) + 1; ++i)
                for (int j = -1; j < _DEPTH + 1; ++j)
                    _ObjectList.Add(new Object(Content.Load<Model>("Models/floor"), new Vector3(i * -2f, 0, j * -2f)));

            #endregion
            #region Wall Right
            for (int j = -1; j < _DEPTH + 1; ++j)
                for (int i = 0; i < 3; ++i)
                    _ObjectList.Add(new Object(Content.Load<Model>("Models/wall"), new Vector3(((-(_WIDTH / 2) - 1) * -2f)+1, i * 2, j * -2f), (float)-Math.PI / 2, true));
            #endregion
            #region Wall Left
            for (int j = -1; j < _DEPTH + 1; ++j)
                for (int i = 0; i < 3; ++i)
                    _ObjectList.Add(new Object(Content.Load<Model>("Models/wall"), new Vector3((((_WIDTH / 2)) * -2f) - 1, i * 2, j * -2f), (float)Math.PI / 2, true));
            #endregion
            #region Wall Near
            for (int j = -(_WIDTH / 2) - 1; j < (_WIDTH / 2) + 1; ++j)
                for (int i = 0; i < 3; ++i)
                    _ObjectList.Add(new Object(Content.Load<Model>("Models/wall"), new Vector3(j * -2f, i * 2, (-1 * -2f) + 1), (float)-Math.PI / 2));
            #endregion
            #region Wall Far
            for (int j = -(_WIDTH / 2) - 1; j < (_WIDTH / 2) + 1; ++j)
                for (int i = 0; i < 3; ++i)
                    _ObjectList.Add(new Object(Content.Load<Model>("Models/wall"), new Vector3(j * -2f, i * 2, ((_DEPTH) * -2f) - 1), (float)Math.PI / 2));
            #endregion
            #region Ceiling
            for (int i = -(_WIDTH / 2) - 1; i < (_WIDTH / 2) + 1; ++i)
                for (int j = -1; j < _DEPTH + 1; ++j)
                    _ObjectList.Add(new Object(Content.Load<Model>("Models/floor"), new Vector3(i * -2f, 5, j * -2f),(float) Math.PI));
            #endregion
        }