/// <summary> /// Constructor. /// </summary> /// <param name="parent">The parent entity for this Component.</param> /// <note>The parent Entity MUST have a PositionComponent in order to construct this Component.</note> /// <note>The parent Entity MUST have an InputComponent in order to construct this Component.</note> public TheFinaleCameraComponent_cl(Entity_cl parent) : base(parent) { // Asserting here to ensure that the TheFinaleCameraComponent has all the required Components // These will be compiled out of the Release build Debug.Assert(mParentEntity.GetComponentOfType(typeof(PositionComponent_cl)) != null, "TheFinaleCameraComponent: No PositionComponent exists on parent Entity!"); Debug.Assert(mParentEntity.GetComponentOfType(typeof(InputComponent_cl)) != null, "TheFinaleCameraComponent: No InputComponent exists on parent Entity!"); mPositionComponent = (PositionComponent_cl)mParentEntity.GetComponentOfType(typeof(PositionComponent_cl)); mInputComponent = (InputComponent_cl)mParentEntity.GetComponentOfType(typeof(InputComponent_cl)); mInputComponent.AddKey("moveN", Keys.Up); mInputComponent.AddKey("moveW", Keys.Left); mInputComponent.AddKey("moveS", Keys.Down); mInputComponent.AddKey("moveE", Keys.Right); mInputComponent.AddKey("ShakeIt", Keys.N); // Items at the same position as the camera should appear at the bottom of the screen, horizontally centered mScreenOffsetMatrix = Matrix.CreateTranslation(new Vector3((float)Game_cl.BaseInstance.WindowWidth * 0.5f, (float)Game_cl.BaseInstance.WindowHeight, 0)); RecalculateTransformationMatrix(); }