public void Update(GameTime gameTime, Character Player) { if (IsThirdPerson()) _Position = Matrix.CreateLookAt(new Vector3(7 * (float)Math.Cos(0) * (float)Math.Sin(Player._Angle), 5, 7 * (float)Math.Cos(Player._Angle)) + Player._Position, Player._Position + new Vector3(0,2,0), Vector3.UnitY); if (IsFirstPerson()) _Position = Matrix.CreateLookAt(Player._Position + new Vector3(0,2,0), Player._Position + new Vector3(-1 * (float)Math.Cos(0) * (float)Math.Sin(Player._Angle), 2, -1 * (float)Math.Cos(Player._Angle)), Vector3.UnitY); }
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 }