/// <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)) != null, "TheFinaleCameraComponent: No PositionComponent exists on parent Entity!"); Debug.Assert(mParentEntity.GetComponentOfType(typeof(InputComponent)) != null, "TheFinaleCameraComponent: No InputComponent exists on parent Entity!"); mPositionComponent = (PositionComponent)mParentEntity.GetComponentOfType(typeof(PositionComponent)); mInputComponent = (InputComponent)mParentEntity.GetComponentOfType(typeof(InputComponent)); mInputComponent.AddKey("moveN", Keys.W); mInputComponent.AddKey("moveW", Keys.A); mInputComponent.AddKey("moveS", Keys.S); mInputComponent.AddKey("moveE", Keys.D); // Items at the same position as the camera should appear at the bottom of the screen, horizontally centered mScreenOffsetMatrix = Matrix.CreateTranslation(new Vector3((float)FNA.Game.BaseInstance.WindowWidth * 0.5f, (float)FNA.Game.BaseInstance.WindowHeight, 0)); RecalculateTransformationMatrix(); }