Beispiel #1
0
 /// <summary>
 /// Creates new instance representing a camera behavior that follows a set point in a game world.
 /// </summary>
 /// <param name="map">The level map in which the camera exists.</param>
 /// <param name="cameraNode">The node containing the <see cref="Camera"/> component. </param>
 /// <param name="cameraHolder">The point the camera will be offset from and following.</param>
 /// <param name="stateSwitched">The handler to invoke when a state switch occurs.</param>
 protected PointFollowingCamera(IMap map, Node cameraNode, Node cameraHolder, StateSwitchedDelegate stateSwitched)
     : base(map, stateSwitched)
 {
     this.Map          = map;
     this.CameraNode   = cameraNode;
     this.CameraHolder = cameraHolder;
 }
Beispiel #2
0
 /// <summary>
 /// Creates new instance of the representation of camera behavior.
 /// </summary>
 /// <param name="map">The level map in which the camera exists.</param>
 /// <param name="stateSwitched">The handler to invoke when a state switch occurs.</param>
 protected CameraState(IMap map, StateSwitchedDelegate stateSwitched)
 {
     this.Map           = map;
     this.StateSwitched = stateSwitched;
 }
Beispiel #3
0
 /// <summary>
 /// Creates new camera behavior that follows an artificial invisible fixed point in the game world.
 /// </summary>
 /// <param name="map">The map of the level the camera exists in.</param>
 /// <param name="levelNode">The <see cref="Node"/> representing the whole level.</param>
 /// <param name="cameraNode">The <see cref="Node"/> containing the <see cref="Camera"/> component.</param>
 /// <param name="initialPosition">The initial position of the followed point in the game world.</param>
 /// <param name="stateSwitched">The handler to invoke when a state switch occurs.</param>
 public FixedCamera(IMap map, Node levelNode, Node cameraNode, Vector2 initialPosition, StateSwitchedDelegate stateSwitched)
     : base(map, cameraNode, levelNode.CreateChild("CameraHolder"), stateSwitched)
 {
     CameraHolder.Position = new Vector3(initialPosition.X,
                                         map.GetTerrainHeightAt(initialPosition),
                                         initialPosition.Y);
 }
Beispiel #4
0
 public EntityFollowingCamera(IMap map, Node cameraNode, StateSwitchedDelegate stateSwitched)
     : base(map, cameraNode, null, stateSwitched)
 {
 }
Beispiel #5
0
 /// <summary>
 /// Creates a camera behavior that moves the camera freely inside the bounds of the level.
 /// </summary>
 /// <param name="map">The map the camera will be moving around in.</param>
 /// <param name="levelNode">The <see cref="Node"/> representing the whole level.</param>
 /// <param name="cameraNode">The <see cref="Node"/> containing the <see cref="Camera"/> component.</param>
 /// <param name="stateSwitched">Handler that will be called when a state switch occurs.</param>
 public FreeFloatCamera(IMap map, Node levelNode, Node cameraNode, StateSwitchedDelegate stateSwitched)
     : base(map, stateSwitched)
 {
     this.levelNode  = levelNode;
     this.cameraNode = cameraNode;
 }