/// <summary>
        /// Aktualisiert den FadingProgress des Switchings.
        /// </summary>
        public void Switch(Savegame pSavegame, ref SceneData pScene, Hansel pHansel, Gretel pGretel, Camera pCamera, TwoDRenderer pRenderer)
        {
            AIManager.Instance.ClearAgents();
            FadingProgress += EngineSettings.Time.ElapsedGameTime.Milliseconds;
            pHansel.MoveManually(LeaveHansel, 1f, pScene);
            pGretel.MoveManually(LeaveGretel, 1f, pScene);
            if (FadingProgress >= FadingDuration)
            {
                //Switch
                pHansel.MoveInteractiveObject(DestinationHansel - pHansel.SkeletonPosition);
                pGretel.MoveInteractiveObject(DestinationGretel - pGretel.SkeletonPosition);
                pSavegame.SceneId  = DestinationScene;
                pScene             = pSavegame.Scenes[DestinationScene];
                pCamera.GameScreen = pScene.GamePlane;
                pScene.SetupRenderList(pHansel, pGretel);
                pRenderer.AmbientLight = pScene.SceneAmbientLight;
                //Show on new Scene
                FadingProgress = 0;
                CurrentState   = State.Entering;

                GameReferenzes.Level = pScene;
                AIManager.Instance.ChangeMap(pCamera.GameScreen, pScene.MoveArea);

                // Für alle weiteren Felder die nicht betreten werden können.
                AIManager.Instance.SetInterActiveObjects(pScene.InteractiveObjects);
                AIManager.Instance.SetAgents(pScene.Enemies);

                GameReferenzes.SceneID = DestinationScene;

                SoundHandler.Instance.ResetTime();
                FmodMediaPlayer.Instance.SetBackgroundSong(GameReferenzes.GetBackgroundMusic());
                GameReferenzes.IsSceneSwitching = false;
            }
        }
 public void TestForSwitch(SceneData pScene, Hansel pHansel, Gretel pGretel, SceneData[] pSceneLookup)         //Testet ob geswitched werden soll. Gibt die SceneId zurück zu der geswitched werden soll. Wenn nicht dann =-1.
 {
     foreach (Waypoint wp in pScene.Waypoints)
     {
         if (wp.CollisionBox.Contains(new Point((int)pHansel.SkeletonPosition.X, (int)pHansel.SkeletonPosition.Y)))                 //Hänsel steht in diesem Waypoint
         {
             if (wp.CollisionBox.Contains(new Point((int)pGretel.SkeletonPosition.X, (int)pGretel.SkeletonPosition.Y)))             //Gretel steht auch in diesem Waypoint
             {
                 if (!wp.OneWay)
                 {
                     StartSwitching(pHansel, pGretel, wp, wp, pSceneLookup);
                 }
                 return;
             }
             else
             {
                 foreach (Waypoint otherWp in pScene.Waypoints)
                 {
                     if (otherWp != wp && otherWp.DestinationScene == wp.DestinationScene)                                               //Ein weiterer Waypoint dieser Map führt auf die gleiche DestinationMap
                     {
                         if (otherWp.CollisionBox.Contains(new Point((int)pGretel.SkeletonPosition.X, (int)pGretel.SkeletonPosition.Y))) //Gretel steht in diesem Waypoint
                         {
                             if (!wp.OneWay && !otherWp.OneWay)
                             {
                                 StartSwitching(pHansel, pGretel, wp, otherWp, pSceneLookup);
                             }
                             return;
                         }
                     }
                 }
             }
         }
     }
 }
 /// <summary>
 /// Berechnet Situation nach Switching und Initialisiert das Switchen.
 /// </summary>
 /// <param name="pHansel">Hänsel</param>
 /// <param name="pGretel">Gretel</param>
 /// <param name="pWpHansel">Wegpunkt, der von Hänsel betreten ist.</param>
 /// <param name="pWpGretel">Wegpunkt, der von Gretel betreten ist.</param>
 /// <param name="pSceneLookup">Scenes-Array aus dem Savegame.</param>
 public void StartSwitching(Hansel pHansel, Gretel pGretel, Waypoint pWpHansel, Waypoint pWpGretel, SceneData[] pSceneLookup)
 {
     if (ActivityHandler.AmuletBlocksWaypoints)
     {
         return;
     }
     LeaveHansel = -pWpHansel.MovementOnEnter;
     LeaveGretel = -pWpGretel.MovementOnEnter;
     //Destination auf 0,0 setzen für ErrorTest
     DestinationHansel = Vector2.Zero;
     DestinationGretel = Vector2.Zero;
     foreach (Waypoint wp in pSceneLookup[pWpHansel.DestinationScene].Waypoints) //Wegpunkte in der Zielscene durchgehen
     {
         if (wp.ObjectId == pWpHansel.DestinationWaypoint)                       //Hansels Zielwegpunkt=
         {
             DestinationHansel = wp.Position + (pHansel.SkeletonPosition - pWpHansel.Position);
         }
         if (wp.ObjectId == pWpGretel.DestinationWaypoint)                 //Gretels Zielwegpunkt?
         {
             DestinationGretel = wp.Position + (pGretel.SkeletonPosition - pWpGretel.Position);
         }
     }
     if (DestinationHansel == Vector2.Zero || DestinationGretel == Vector2.Zero)             //ErrorTest
     {
         throw new Exception("Zielwegpunkt für Hansel oder Gretel nicht gefunden!");
     }
     DestinationScene = pWpHansel.DestinationScene;
     //Switching initialisieren
     pHansel.SetAnimation();
     pGretel.SetAnimation();
     FadingProgress = 0d;
     CurrentState   = State.Switching;
     FmodMediaPlayer.Instance.FadeBackgroundOut();
     GameReferenzes.IsSceneSwitching = true;
 }
Esempio n. 4
0
 public ChargeAmulet(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
     Progress = new SteppingProgress();
     ActI     = new ActivityInstruction();
     ActI.SetThumbstickDirBoth(ActivityInstruction.ThumbstickDirection.Up);
 }
Esempio n. 5
0
 public PushDoor(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
     Progress = new SteppingProgress();
     ActI     = new ActivityInstruction();
     ActI.SetThumbstickDirBoth(ActivityInstruction.ThumbstickDirection.Down);
 }
 public void Update(Hansel pHansel, Gretel pGretel)
 {
     if ((pGretel.SkeletonPosition - pHansel.SkeletonPosition).Length() > Hardcoded.Temp_Distance)
     {
         Frost.StepForward();
     }
     else
     {
         Frost.StepBackward();
     }
     if (Frost.Progress > Hardcoded.Temp_MinBodyTemperature)
     {
         pHansel.BodyTemperature = Hardcoded.Temp_MinBodyTemperature + Frost.ProgressInverse;
         pGretel.BodyTemperature = Hardcoded.Temp_MinBodyTemperature + Frost.ProgressInverse;
         UpdateSound();
     }
     else
     {
         FmodMediaPlayer.Instance.StopSong("gretel_shiver");
         FmodMediaPlayer.Instance.StopSong("hansel_shiver");
         pHansel.BodyTemperature = 1f;
         pGretel.BodyTemperature = 1f;
         soundTimer = 23000.0f;
     }
 }
Esempio n. 7
0
 public UseWell(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
     Progress = new SteppingProgress();
     ActI     = new ActivityInstruction();
     ActI.SetThumbstickDir(pHansel, ActivityInstruction.ThumbstickDirection.Rotate);
     ActI.SetThumbstickDir(pGretel, ActivityInstruction.ThumbstickDirection.None);
 }
Esempio n. 8
0
 public KnockOverTree(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
     StartPosition = Vector2.Zero;
     Direction     = Vector2.Zero;
     Progress      = new SteppingProgress();
     ActI          = new ActivityInstruction();
 }
Esempio n. 9
0
 protected bool InLanternLight(Collectable pCollectable, Hansel pHansel, Gretel pGretel)
 {
     if (!pGretel.Lantern)
     {
         return(false);
     }
     return(((pGretel.SkeletonPosition - pCollectable.SkeletonPosition).Length() < GameReferenzes.LIGHT_RADIUS) ? true : false);
 }
 public ActivityState(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj = null)
     : base()
 {
     Initialize();
     if (pIObj != null)
     {
         rIObj = pIObj;
     }
 }
Esempio n. 11
0
 public void Draw(SpriteBatch pSpriteBatch, Hansel pHansel, Gretel pGretel)
 {
     //Buttons
     pSpriteBatch.Draw(ButtonX, pHansel.SkeletonPosition + Hardcoded.ActI_OffsetButton, Color.White * Fading.VisibilityHansel);
     pSpriteBatch.Draw(ButtonX, pGretel.SkeletonPosition + Hardcoded.ActI_OffsetButton, Color.White * Fading.VisibilityGretel);
     //Thumbsticks
     DrawThumbstick(pSpriteBatch, ThumbstickDirHansel, pHansel, Fading.VisibilityHansel);
     DrawThumbstick(pSpriteBatch, ThumbstickDirGretel, pGretel, Fading.VisibilityGretel);
 }
Esempio n. 12
0
 protected void UpdateVisibility(SceneData pScene, Hansel pHansel, Gretel pGretel)
 {
     //Update Collectables
     foreach (Collectable col in pScene.Collectables)
     {
         col.IsVisible = false;
         if (!col.IsHidden || InLanternLight(col, pHansel, pGretel))                 //Collectable befindet sich im Lichtkreis
         {
             col.IsVisible = true;
         }
     }
 }
Esempio n. 13
0
 public void DrawActionInfo(SpriteBatch pSpriteBatch, Hansel pHansel, Gretel pGretel)
 {
     //ActionInfo
     if (ActionInfoHansel != 0)
     {
         pSpriteBatch.Draw(ActionInfo[ActionInfoHansel], pHansel.SkeletonPosition + Hardcoded.ActionInfo_Offset, Color.White * ActionInfoFading.VisibilityHansel);
     }
     if (ActionInfoGretel != 0)
     {
         pSpriteBatch.Draw(ActionInfo[ActionInfoGretel], pGretel.SkeletonPosition + Hardcoded.ActionInfo_Offset, Color.White * ActionInfoFading.VisibilityGretel);
     }
     //ButtonX
     pSpriteBatch.Draw(ActionInfoButton, pHansel.SkeletonPosition + Hardcoded.ActionInfo_OffsetButton, Color.White * ActionInfoFading.VisibilityHansel);
     pSpriteBatch.Draw(ActionInfoButton, pGretel.SkeletonPosition + Hardcoded.ActionInfo_OffsetButton, Color.White * ActionInfoFading.VisibilityGretel);
 }
Esempio n. 14
0
        public void LoadContent(Hansel pHansel, Gretel pGretel)
        {
            ActionInfoButton = TextureManager.Instance.GetElementByString("button_x");
            ActionInfo       = new Texture2D[20];       //Anzahl an möglichen Activities
            string prefix = "ActivityInfo_";

            ActionInfo[1]  = TextureManager.Instance.GetElementByString(prefix + "KnockOverTree");
            ActionInfo[2]  = TextureManager.Instance.GetElementByString(prefix + "BalanceOverTree");
            ActionInfo[3]  = TextureManager.Instance.GetElementByString(prefix + "PushRock");
            ActionInfo[4]  = TextureManager.Instance.GetElementByString(prefix + "SlipThroughRock");
            ActionInfo[5]  = TextureManager.Instance.GetElementByString(prefix + "JumpOverGap");
            ActionInfo[6]  = TextureManager.Instance.GetElementByString(prefix + "LegUp");
            ActionInfo[7]  = TextureManager.Instance.GetElementByString(prefix + "LegUpGrab");
            ActionInfo[8]  = TextureManager.Instance.GetElementByString(prefix + "PushDoor");
            ActionInfo[9]  = TextureManager.Instance.GetElementByString(prefix + "PullDoor");
            ActionInfo[10] = TextureManager.Instance.GetElementByString(prefix + "UseWell");
            ActionInfo[11] = TextureManager.Instance.GetElementByString(prefix + "ChargeAmulet");
            ActionInfo[12] = TextureManager.Instance.GetElementByString(prefix + "UseAmulet");
            Amulet         = new UseAmulet(pHansel, pGretel, null);
        }
        public void Update(Savegame pSavegame, ref SceneData pScene, Hansel pHansel, Gretel pGretel, Camera pCamera, TwoDRenderer pRenderer)
        {
            switch (CurrentState)
            {
            case State.Idle:
                TestForSwitch(pScene, pHansel, pGretel, pSavegame.Scenes);
                break;

            case State.Switching:
                Switch(pSavegame, ref pScene, pHansel, pGretel, pCamera, pRenderer);
                break;

            case State.Entering:
                Enter(pScene, pHansel, pGretel, pSavegame);
                break;

            default:
                throw new Exception("SwitchScene.CurrentState not set!");
            }
        }
Esempio n. 16
0
		public static void Update(Savegame pSavegame, SceneData pScene, Hansel pHansel, Gretel pGretel)
		{
			List<Player> UpdateList = new List<Player>();
			if (InputHelper.Player1.KeyPressed(Keys.NumPad1))
				UpdateList.Add(pHansel);
			if (InputHelper.Player1.KeyPressed(Keys.NumPad2))
				UpdateList.Add(pGretel);

			float Speed = 10f;

			foreach (Player p in UpdateList)
			{
				if (InputHelper.Player1.KeyPressed(Keys.NumPad4))
					p.MoveInteractiveObject(new Vector2(-Speed, 0));
				if (InputHelper.Player1.KeyPressed(Keys.NumPad8))
					p.MoveInteractiveObject(new Vector2(0, -Speed));
				if (InputHelper.Player1.KeyPressed(Keys.NumPad6))
					p.MoveInteractiveObject(new Vector2(Speed, 0));
				if (InputHelper.Player1.KeyPressed(Keys.NumPad5))
					p.MoveInteractiveObject(new Vector2(0, Speed));
			}
		}
        public void Enter(SceneData pScene, Hansel pHansel, Gretel pGretel, Savegame pSavegame)
        {
            bool TmpEnterFinished = true;

            foreach (Waypoint wp in pScene.Waypoints)
            {
                if (wp.CollisionBox.Intersects(pHansel.CollisionBox) || wp.CollisionBox.Intersects(pGretel.CollisionBox))
                {
                    TmpEnterFinished = false;
                    pHansel.MoveManually(wp.MovementOnEnter, 1f, pScene, false, false, true);
                    pGretel.MoveManually(wp.MovementOnEnter, 1f, pScene, false, false, true);
                }
            }
            if (TmpEnterFinished)
            {
                CurrentState = State.Idle;
                //Spiel speichern wenn Spieler in der Scene angekommen sind und ein Kreidefelsen in ihr steht.
                foreach (int i in Hardcoded.Scene_Waystone)
                {
                    if (GameReferenzes.SceneID == i)
                    {
                        Savegame.Save(pSavegame, pHansel, pGretel);
                    }
                }

                /*
                 * if (GameReferenzes.SceneID == 3 | GameReferenzes.SceneID == 6 | GameReferenzes.SceneID == 12 | GameReferenzes.SceneID == 15)
                 *      Savegame.Save(pSavegame, pHansel, pGretel);
                 * foreach (InteractiveObject iObj in pScene.InteractiveObjects)
                 * {
                 *      if (iObj.Name == Hardcoded.Scene_Waystone_IObjName)
                 *      {
                 *              Savegame.Save(pSavegame, pHansel, pGretel);
                 *      }
                 * }
                 */
            }
        }
Esempio n. 18
0
        public void Update(SceneData pScene, Hansel pHansel, Gretel pGretel)
        {
            if (pScene.Events.Count == 0)
            {
                return;
            }

            List <EventTrigger> delEvents = new List <EventTrigger>();

            foreach (EventTrigger et in pScene.Events)
            {
                if (et.CollisionBox.Contains(pHansel.CollisionBox) || et.CollisionBox.Contains(pGretel.CollisionBox))
                {
                    et.TriggerActivity();
                    delEvents.Add(et);
                }
            }

            foreach (EventTrigger et in delEvents)
            {
                pScene.Events.Remove(et);
            }
        }
Esempio n. 19
0
        public void Update(Savegame pSavegame, ref SceneData pScene, Hansel pHansel, Gretel pGretel, Camera pCamera, TwoDRenderer pRenderer, ref GameScene.GameState pGameState)
        {
            //Update Logic Parts
            SceneSwitchHandler.Update(pSavegame, ref pScene, pHansel, pGretel, pCamera, pRenderer);
            ActivityHandler.Update(pScene, pHansel, pGretel, pSavegame);
            ItemHandler.Update(pScene, pHansel, pGretel, pSavegame, ref pGameState);
            EventHandler.Update(pScene, pHansel, pGretel);
            TemperatureHandler.Update(pHansel, pGretel);

            AIManager.Instance.Update();

            EnemyHandler.Update();
            SoundHandler.Instance.Update();

            //Check whether Player may move
            HanselMayMove = true;
            GretelMayMove = true;
            if (SceneSwitchHandler.CurrentState != SceneSwitchHandler.State.Idle)
            {
                HanselMayMove = false;
                GretelMayMove = false;
            }
        }
Esempio n. 20
0
        protected void UpdateLantern(Hansel pHansel, Gretel pGretel)
        {
            //Lantern
            if ((pHansel.SkeletonPosition - pGretel.SkeletonPosition).Length() <= Hardcoded.Lantern_MaxSwapDistance)
            {
                if (pHansel.Lantern && pHansel.mCurrentActivity == ActivityHandler.None && pHansel.Input.SwitchItemJustPressed)
                {
                    pGretel.Lantern = true;
                    pHansel.Lantern = false;
                }
                else if (pGretel.Lantern && pGretel.mCurrentActivity == ActivityHandler.None && pGretel.Input.SwitchItemJustPressed)
                {
                    pHansel.Lantern = true;
                    pGretel.Lantern = false;
                }
            }

            if (pHansel.Lantern)
            {
                LanternLight.Position = pHansel.SkeletonPosition;
                if (pHansel.Input.UseItemIsPressed)
                {
                    LanternRaiseProgress.StepForward();
                }
                else
                {
                    LanternRaiseProgress.StepBackward();
                }
            }
            else if (pGretel.Lantern)
            {
                LanternLight.Position = pGretel.SkeletonPosition;
                LanternRaiseProgress.Reset();
            }
            LanternLight.Depth  = Hardcoded.Lantern_Height + ((Hardcoded.Lantern_HeightRaised - Hardcoded.Lantern_Height) * LanternRaiseProgress.Progress);
            LanternLight.Radius = Hardcoded.Lantern_Radius + ((Hardcoded.Lantern_RadiusRaised - Hardcoded.Lantern_Radius) * LanternRaiseProgress.Progress);
        }
Esempio n. 21
0
        public override void Initialize()
        {
#if DEBUG
            EngineSettings.IsDebug = true;
#endif
            //GameState
            mState         = GameState.Running;
            mEndGameFading = new SteppingProgress(Hardcoded.End_FadingDuration);
            //Player
            mHansel = new Hansel();
            mGretel = new Gretel();
            mHansel.mCurrentActivity = ActivityHandler.None;
            mGretel.mCurrentActivity = ActivityHandler.None;
            //Camera
            mCamera = new Camera();
            //Savegame
            mSavegame = new Savegame();
            //Logic
            mLogic = new Logic();
            //PauseMenu
            mPauseMenu = new PauseMenu();

            FmodMediaPlayer.FadingSpeed = 1 / 90.0f;
        }
Esempio n. 22
0
 public void DrawActivityInstruction(SpriteBatch pSpriteBatch, Hansel pHansel, Gretel pGretel)
 {
     if (pHansel.mCurrentActivity != null)
     {
         pHansel.mCurrentActivity.Draw(pSpriteBatch, pHansel, pGretel);
     }
     if (pGretel.mCurrentActivity != null)
     {
         if (pHansel.mCurrentActivity != null && pGretel.mCurrentActivity == pHansel.mCurrentActivity)
         {
             return;                     //Nicht doppelt zeichnen
         }
         pGretel.mCurrentActivity.Draw(pSpriteBatch, pGretel, pHansel);
     }
 }
Esempio n. 23
0
 public void Update(SceneData pScene, Hansel pHansel, Gretel pGretel, Savegame pSavegame, ref GameScene.GameState pGameState)
 {
     UpdateLantern(pHansel, pGretel);
     UpdateVisibility(pScene, pHansel, pGretel);
     CollectCollectables(pSavegame, pScene, pHansel, pGretel, ref pGameState);
 }
Esempio n. 24
0
 protected void CollectCollectables(Savegame pSavegame, SceneData pScene, Hansel pHansel, Gretel pGretel, ref GameScene.GameState pGameState)
 {
     foreach (Collectable col in pScene.Collectables)
     {
         if (col.IsVisible)
         {
             if (col.CollisionBox.Intersects(pHansel.CollisionBox))
             {
                 pSavegame.Collectables.Add(col);
                 pScene.Collectables.Remove(col);
                 //Laterne einsammeln
                 if (col.GetType() == typeof(Lantern))
                 {
                     pHansel.Lantern = true;
                 }
                 pGameState = GameScene.GameState.CollectableInfo;
                 FmodMediaPlayer.Instance.AddSong("Collectable0" + col.CollectableId, 0.8f);
                 return;
             }
             else if (col.CollisionBox.Intersects(pGretel.CollisionBox) ||
                      (                    //Collectable bei LegUpGrab einsammeln
                          pGretel.mCurrentActivity != null &&
                          pGretel.mCurrentActivity.GetType() == typeof(LegUp) &&
                          pGretel.mCurrentActivity.m2ndState &&
                          pGretel.mCurrentState == 4 &&
                          col.CollisionBox.Intersects(new Rectangle((int)(pGretel.SkeletonPosition.X + Hardcoded.LegUp_OffsetGretel[pSavegame.SceneId].X - 10), (int)(pGretel.SkeletonPosition.Y + Hardcoded.LegUp_OffsetGretel[pSavegame.SceneId].Y - 10), 20, 20))
                      )
                      )
             {
                 pSavegame.Collectables.Add(col);
                 pScene.Collectables.Remove(col);
                 //Laterne einsammeln
                 if (col.GetType() == typeof(Lantern))
                 {
                     pGretel.Lantern = true;
                 }
                 pGameState = GameScene.GameState.CollectableInfo;
                 FmodMediaPlayer.Instance.AddSong("Collectable0" + col.CollectableId, 0.8f);
                 return;
             }
         }
     }
 }
Esempio n. 25
0
 public PushRock(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
     Progress = new SteppingProgress(Hardcoded.PushRock_SteppingDuration);
     ActI     = new ActivityInstruction();
 }
Esempio n. 26
0
 public JumpOverGap(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
     mDestination = Vector2.Zero;
 }
Esempio n. 27
0
        //-----Workaround für linerare Abhängigkeit HG_Game -> HG_Data -> KryptonEngine-----
        public void SetupInteractiveObjectsFromDeserialization(Savegame pSavegame, Hansel pHansel, Gretel pGretel)
        {
            for (int i = 0; i < pSavegame.Scenes.Length; i++)
            {
                foreach (InteractiveObject iObj in pSavegame.Scenes[i].InteractiveObjects)
                {
                    switch (iObj.ActivityId)
                    {
                    case Activity.None:
                        iObj.ActivityState = None;
                        break;

                    case Activity.KnockOverTree:
                        iObj.ActivityState = new KnockOverTree(pHansel, pGretel, iObj);
                        break;

                    case Activity.BalanceOverTree:
                        iObj.ActivityState = new KnockOverTree(pHansel, pGretel, iObj);
                        Sequences.AnimateAccordingToDirection(iObj, iObj.ActionPosition2 - iObj.ActionPosition1, Hardcoded.Anim_Tree_Fallen_Up, Hardcoded.Anim_Tree_Fallen_Down, Hardcoded.Anim_Tree_Fallen_Side);
                        iObj.ActivityState.m2ndState = true;
                        break;

                    case Activity.PushRock:
                        iObj.ActivityState = new PushRock(pHansel, pGretel, iObj);
                        break;

                    case Activity.SlipThroughRock:
                        iObj.ActivityState = new SlipThroughRock(pHansel, pGretel, iObj);
                        break;

                    case Activity.JumpOverGap:
                        iObj.ActivityState = new JumpOverGap(pHansel, pGretel, iObj);
                        break;

                    case Activity.LegUp:
                        iObj.ActivityState = new LegUp(pHansel, pGretel, iObj);
                        break;

                    case Activity.LegUpGrab:
                        iObj.ActivityState           = new LegUp(pHansel, pGretel, iObj);
                        iObj.ActivityState.m2ndState = true;
                        break;

                    case Activity.PushDoor:
                        iObj.ActivityState = new PushDoor(pHansel, pGretel, iObj);
                        break;

                    case Activity.PullDoor:
                        throw new Exception("Es gibt keine Tür mehr die von den Spielern geschlossen werden soll");

                        /*iObj.ActivityState = new PushDoor(pHansel, pGretel, iObj);
                         * Sequences.AnimateAccordingToDirection(iObj, new Vector2(iObj.CollisionRectList[0].X - iObj.ActionRectList[0].X, iObj.CollisionRectList[0].Y - iObj.ActionRectList[0].Y), Hardcoded.Anim_Door_Open_Up, Hardcoded.Anim_Door_Open_Down, Hardcoded.Anim_Door_Open_Side);
                         * iObj.ActivityState.m2ndState = true;*/
                        break;

                    case Activity.UseWell:
                        iObj.ActivityState = new UseWell(pHansel, pGretel, iObj);
                        break;

                    case Activity.ChargeAmulet:
                        iObj.ActivityState = new ChargeAmulet(pHansel, pGretel, iObj);
                        AmuletStates.Add((ChargeAmulet)iObj.ActivityState);
                        break;

                    default:
                        throw new Exception("Im InteractiveObject " + iObj.ObjectId.ToString() + " in Scene " + i.ToString() + " ist eine ungültige Action angegeben!");
                    }
                }
            }
        }
Esempio n. 28
0
        public void Update(SceneData pScene, Hansel pHansel, Gretel pGretel, Savegame pSavegame)
        {
            //-----Ist Player verfügbar für eine Activity?-----
            bool TestHansel = false;
            bool TestGretel = false;

            if (pHansel.mCurrentActivity == None)
            {
                TestHansel = true;
            }
            if (pGretel.mCurrentActivity == None)
            {
                TestGretel = true;
            }

            //-----Wenn nicht getestet wird keine ActionInfo anzeigen-----
            ActionInfoFading.ShowHudHansel = false;
            ActionInfoFading.ShowHudGretel = false;
            //-----Activity ggf starten-----
            if (TestHansel || TestGretel)
            {
                //Betretene InteractiveObjects bestimmen
                InteractiveObject IObjIntersectsHansel   = null;
                InteractiveObject IObjIntersectsGretel   = null;
                Activity          PossibleActivityHansel = Activity.None;
                Activity          PossibleActivityGretel = Activity.None;
                foreach (InteractiveObject iObj in pScene.InteractiveObjects)
                {
                    foreach (Rectangle rect in iObj.ActionRectList)
                    {
                        if (TestHansel && rect.Contains(new Point((int)pHansel.SkeletonPosition.X, (int)pHansel.SkeletonPosition.Y)))
                        {
                            IObjIntersectsHansel   = iObj;
                            PossibleActivityHansel = iObj.ActivityState.GetPossibleActivity(pHansel, pGretel);
                        }
                        if (TestGretel && rect.Contains(new Point((int)pGretel.SkeletonPosition.X, (int)pGretel.SkeletonPosition.Y)))
                        {
                            IObjIntersectsGretel   = iObj;
                            PossibleActivityGretel = iObj.ActivityState.GetPossibleActivity(pGretel, pHansel);
                        }
                    }
                }

                //-----Tür erst offen wenn Laterne eingesammelt wurde-----
                if (pSavegame.SceneId == Hardcoded.Scene_LanternDoor)
                {
                    foreach (Collectable col in pSavegame.Scenes[Hardcoded.Scene_Lantern].Collectables)
                    {
                        if (col.GetType() == typeof(Lantern))
                        {
                            if (PossibleActivityHansel == Activity.PushDoor)
                            {
                                PossibleActivityHansel = Activity.None;
                            }
                            if (PossibleActivityGretel == Activity.PushDoor)
                            {
                                PossibleActivityGretel = Activity.None;
                            }
                        }
                    }
                }

                //-----UseAmulet-----
                if (pSavegame.SceneId == Hardcoded.Scene_Amulet && AmuletCharged)
                {
                    if (TestHansel && PossibleActivityHansel == Activity.None)
                    {
                        PossibleActivityHansel = Amulet.GetPossibleActivity(pHansel, pGretel);
                        if (PossibleActivityHansel != Activity.None && Conditions.ActionPressed(pHansel))
                        {
                            pHansel.mCurrentActivity = Amulet;
                            PossibleActivityHansel   = Activity.None;
                        }
                    }
                    if (TestGretel && PossibleActivityGretel == Activity.None)
                    {
                        PossibleActivityGretel = Amulet.GetPossibleActivity(pGretel, pHansel);
                        if (PossibleActivityGretel != Activity.None && Conditions.ActionPressed(pGretel))
                        {
                            pGretel.mCurrentActivity = Amulet;
                            PossibleActivityGretel   = Activity.None;
                        }
                    }
                }

                //-----Activity aufgrund von Spielereingabe starten?-----
                if (TestHansel &&
                    IObjIntersectsHansel != null &&
                    Conditions.ActionPressed(pHansel) &&
                    PossibleActivityHansel != Activity.None)
                {
                    pHansel.mCurrentActivity = IObjIntersectsHansel.ActivityState;
                }
                if (TestGretel &&
                    IObjIntersectsGretel != null &&
                    Conditions.ActionPressed(pGretel) &&
                    PossibleActivityGretel != Activity.None)
                {
                    pGretel.mCurrentActivity = IObjIntersectsGretel.ActivityState;
                }

                //-----Update ActionInfoState-----
                if (PossibleActivityHansel != Activity.None)
                {
                    ActionInfoFading.ShowHudHansel = true;
                    ActionInfoHansel = (int)PossibleActivityHansel;
                }
                if (PossibleActivityGretel != Activity.None)
                {
                    ActionInfoFading.ShowHudGretel = true;
                    ActionInfoGretel = (int)PossibleActivityGretel;
                }
            }

            //-----Update Activities-----
            pHansel.mCurrentActivity.Update(pHansel, pGretel);
            pGretel.mCurrentActivity.Update(pGretel, pHansel);

            //Brunnen Overlay updaten
            if (pHansel.mCurrentActivity.GetType() == typeof(UseWell) && pHansel.mCurrentState == 4)
            {
                ((UseWell)pHansel.mCurrentActivity).UpdateOverlay(ref pScene.RenderList);
            }

            //AmuletStates updaten
            UpdateAmulet(pSavegame, pScene);


            ActionInfoFading.Update();
        }
Esempio n. 29
0
 public void LoadContent(Hansel pHansel, Gretel pGretel)
 {
     ActivityHandler.LoadContent(pHansel, pGretel);
 }
Esempio n. 30
0
 public SlipThroughRock(Hansel pHansel, Gretel pGretel, InteractiveObject pIObj)
     : base(pHansel, pGretel, pIObj)
 {
 }