public void Update() { Fading.Update(); }
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(); }