Пример #1
0
 public override void Initialize()
 {
     mCamera = new Camera();
     mScene = new SceneData();
     mScene.GamePlane = new Rectangle(0, 0, EngineSettings.VirtualResWidth, EngineSettings.VirtualResHeight);
     mCamera.GameScreen = mScene.GamePlane;
     mPlayer = new Hansel();
 }
Пример #2
0
		public void Update(bool pMayMove, float pMovementSpeedFactor, SceneData pScene)
		{
			base.Update();
			if (pMayMove && pMovementSpeedFactor > 0)
			{
				Vector2 TmpMovement = mInput.Movement * mSpeed * pMovementSpeedFactor * (EngineSettings.Time.ElapsedGameTime.Milliseconds / 1000f);
				AnimBasicAnimation(Move(ViewportCheckedVector(TmpMovement), GetBodiesForCollisionCheck(pScene)));
			}
		}
Пример #3
0
 public void Update(bool pMayMove, SceneData pScene)
 {
     base.Update();
     if (pMayMove)
     {
         Vector2 TmpMovement = mInput.Movement * mSpeed * (EngineSettings.Time.ElapsedGameTime.Milliseconds / 1000f);
         AnimBasicAnimation(Move(ViewportCheckedVector(TmpMovement), GetBodiesForCollisionCheck(pScene)));
     }
 }
Пример #4
0
        /// <summary>
        /// Get Scene.MoveArea + OtherPlayers CollisionBox as Rectangle-List.
        /// </summary>
        protected List <Rectangle> GetBodiesForCollisionCheck(SceneData pScene)
        {
            List <Rectangle> TmpMoveArea = new List <Rectangle>(pScene.MoveArea);

            foreach (InteractiveObject iObj in pScene.InteractiveObjects)
            {
                TmpMoveArea.AddRange(iObj.CollisionRectList);
            }
            TmpMoveArea.Add(rOtherPlayer.CollisionBox);
            return(TmpMoveArea);
        }
Пример #5
0
		public void MoveManually(Vector2 pMovementDirection, float pMovementSpeedFactor, SceneData pScene = null, bool pIgnoreCollision = true)
		{
			Vector2 TmpMovement;
			List<Rectangle> TmpBodies;
			if (pIgnoreCollision)
			{
				TmpMovement = ViewportCheckedVector(pMovementDirection * mSpeed * pMovementSpeedFactor * (EngineSettings.Time.ElapsedGameTime.Milliseconds / 1000f));
				TmpBodies = new List<Rectangle>();
			}
			else
			{
				TmpMovement = pMovementDirection * mSpeed * pMovementSpeedFactor * (EngineSettings.Time.ElapsedGameTime.Milliseconds / 1000f);
				TmpBodies = GetBodiesForCollisionCheck(pScene);
			}
			AnimBasicAnimation(Move(TmpMovement, TmpBodies));
		}
Пример #6
0
 public void Initialize()
 {
     ScenePath          = Environment.CurrentDirectory + @"\Content\hug";
     SavegamePath       = Environment.CurrentDirectory + @"\save.hugs";       //Hänsel Und Gretel Savegame
     SceneSerializer    = new XmlSerializer(typeof(SceneData));
     SavegameSerializer = new XmlSerializer(typeof(Savegame));
     Collectables       = new List <Collectable>();
     SceneId            = 0;
     Scenes             = new SceneData[19]; //ToDo: Anzahl Scenes setzen !---!---!---!---!
     for (int i = 0; i < Scenes.Length; i++)
     {
         Scenes[i] = new SceneData();                 //Scenes initialisieren
     }
     hansel = new Hansel();
     gretel = new Gretel();
 }
Пример #7
0
		public void Initialize()
		{
			ScenePath = Environment.CurrentDirectory + @"\Content\hug";
			SavegamePath = Environment.CurrentDirectory + @"\save.hugs"; //Hänsel Und Gretel Savegame
			SceneSerializer = new XmlSerializer(typeof(SceneData));
			SavegameSerializer = new XmlSerializer(typeof(Savegame));
			Collectables = new List<Collectable>();
			InventoryHansel = new Inventory();
			InventoryGretel = new Inventory();
			Chalk = 0;
			PositionHansel = new Vector2(80, 500); //ToDo: Init Position setzen !---!---!---!---!
			PositionGretel = new Vector2(150, 500); //ToDo: Init Position setzen !---!---!---!---!
			SceneId = 0;
			Scenes = new SceneData[1]; //ToDo: Anzahl Scenes setzen !---!---!---!---!
			for (int i = 0; i < Scenes.Length; i++)
				Scenes[i] = new SceneData(); //Scenes initialisieren
		}
Пример #8
0
        public void MoveManually(Vector2 pMovementDirection, SceneData pScene, bool pIgnoreCollision)
        {
            Vector2          TmpMovement;
            List <Rectangle> TmpBodies;

            if (pIgnoreCollision)
            {
                TmpMovement = ViewportCheckedVector(pMovementDirection * mSpeed * (EngineSettings.Time.ElapsedGameTime.Milliseconds / 1000f));
                TmpBodies   = new List <Rectangle>();
            }
            else
            {
                TmpMovement = pMovementDirection * mSpeed * (EngineSettings.Time.ElapsedGameTime.Milliseconds / 1000f);
                TmpBodies   = GetBodiesForCollisionCheck(pScene);
            }
            AnimBasicAnimation(Move(TmpMovement, TmpBodies));
        }
Пример #9
0
 public void Initialize()
 {
     ScenePath          = Environment.CurrentDirectory + @"\Content\hug";
     SavegamePath       = Environment.CurrentDirectory + @"\save.hugs";       //Hänsel Und Gretel Savegame
     SceneSerializer    = new XmlSerializer(typeof(SceneData));
     SavegameSerializer = new XmlSerializer(typeof(Savegame));
     Collectables       = new List <Collectable>();
     InventoryHansel    = new Inventory();
     InventoryGretel    = new Inventory();
     Chalk          = 0;
     PositionHansel = new Vector2(80, 500);  //ToDo: Init Position setzen !---!---!---!---!
     PositionGretel = new Vector2(150, 500); //ToDo: Init Position setzen !---!---!---!---!
     SceneId        = 0;
     Scenes         = new SceneData[2];      //ToDo: Anzahl Scenes setzen !---!---!---!---!
     for (int i = 0; i < Scenes.Length; i++)
     {
         Scenes[i] = new SceneData();                 //Scenes initialisieren
     }
 }
Пример #10
0
        /// <summary>
        /// Move Player to Point (Call by Call).
        /// </summary>
        /// <param name="pTargetPoint">Point</param>
        /// <param name="pMovementSpeedFactor">Speed wird hiermit multipliziert</param>
        /// <param name="pScene">Scene für ggf Kollisionsprüfung, darf bei pIgnoreCollision = true null sein.</param>
        /// <param name="pIgnoreCollision">Keine Kollision</param>
        /// <param name="pIgnoreOtherPlayer">Wenn pIgnoreCollision = false ist auch anderen Spieler ignorieren.</param>
        public void MoveAgainstPoint(Vector2 pTargetPoint, float pMovementSpeedFactor = 1f, SceneData pScene = null, bool pIgnoreCollision = true, bool pIgnoreOtherPlayer = false, bool pAnimate = true, bool pIgnoreTemp = false)
        {
            Vector2 TmpMovementDirection = pTargetPoint - SkeletonPosition;

            TmpMovementDirection.Normalize();
            Vector2          TmpMovement;
            List <Rectangle> TmpBodies;

            if (pIgnoreCollision)
            {
                TmpMovement = ViewportCheckedVector(GetMovement(TmpMovementDirection, pMovementSpeedFactor, pIgnoreTemp));
                TmpBodies   = new List <Rectangle>();
                if (!pIgnoreOtherPlayer)
                {
                    TmpBodies.Add(rOtherPlayer.CollisionBox);
                }
            }
            else
            {
                TmpMovement = GetMovement(TmpMovementDirection, pMovementSpeedFactor, pIgnoreTemp);
                TmpBodies   = GetBodiesForCollisionCheck(pScene);
            }
            if ((pTargetPoint - SkeletonPosition).Length() < TmpMovement.Length())             //Nicht über Punkt hinaus gehen.
            {
                TmpMovement = pTargetPoint - SkeletonPosition;
            }
            Vector2 Movement = Move(TmpMovement, TmpBodies);

            if (pAnimate)
            {
                AnimBasicAnimation(Movement, Lantern, true, IsLanternRaised);
            }
        }
Пример #11
0
        /// <summary>
        /// Spieler manuell entsprechend bewegen.
        /// </summary>
        /// <param name="pMovementDirection">Auszuführende Bewegungsrichtung (muss normalisiert sein)</param>
        /// <param name="pMovementSpeedFactor">Speed wird hiermit multipliziert</param>
        /// <param name="pScene">Scene für ggf Kollisionsprüfung, darf bei pIgnoreCollision = true null sein.</param>
        /// <param name="pIgnoreCollision">Keine Kollision</param>
        /// <param name="pIgnoreOtherPlayer">Wenn pIgnoreCollision = false ist auch anderen Spieler ignorieren.</param>
        public void MoveManually(Vector2 pMovementDirection, float pMovementSpeedFactor = 1f, SceneData pScene = null, bool pIgnoreCollision = true, bool pIgnoreOtherPlayer = false, bool pIgnoreMapBounds = false)
        {
            Vector2          TmpMovement;
            List <Rectangle> TmpBodies;

            if (pIgnoreCollision)
            {
                TmpMovement = GetMovement(pMovementDirection, pMovementSpeedFactor);
                TmpBodies   = new List <Rectangle>();
                if (!pIgnoreOtherPlayer)
                {
                    TmpBodies.Add(rOtherPlayer.CollisionBox);
                }
            }
            else
            {
                if (pIgnoreMapBounds)
                {
                    TmpMovement = GetMovement(pMovementDirection, pMovementSpeedFactor);
                }
                else
                {
                    TmpMovement = ViewportCheckedVector(GetMovement(pMovementDirection, pMovementSpeedFactor));
                }
                TmpBodies = GetBodiesForCollisionCheck(pScene);
            }
            AnimBasicAnimation(Move(TmpMovement, TmpBodies), Lantern, true, IsLanternRaised);
        }
Пример #12
0
		/// <summary>
		/// Get Scene.MoveArea + OtherPlayers CollisionBox as Rectangle-List.
		/// </summary>
		protected List<Rectangle> GetBodiesForCollisionCheck(SceneData pScene)
		{
			List<Rectangle> TmpMoveArea = new List<Rectangle>(pScene.MoveArea);
			TmpMoveArea.Add(rOtherPlayer.CollisionBox);
			return TmpMoveArea;
		}