Skip to content

GameObject

Morasiu edited this page Jan 4, 2019 · 4 revisions

GameObject

Class that represents object in scene. Contains:

  • Position
  • Content
  • ColorMask
public class GameObject

Constructors

  • Creates empty game object at position Vector2.Zero (0, 0).
public GameObject()
  • Crates game object at position with given content and default (white) colorMask.
public GameObject(Vector2 position, string content)
  • Crates game object at position with given content and colorMask. See ColorMask for more information.
public GameObject(Vector2 position, string content, string colorMask)
  • Crates game object at position with given content and colorMask sets to given Color. See ColorMask for more information.
public GameObject(Vector2 position, string content, char color)

Properties

Position

Represents current GameObject position. It cannot be less that (0, 0).

Position in equal to first char position, so it's top left corner.

public Vector2 Position { get; set; }

Exception

  • ArgumentOutOfRangeException - throw, when at least one of coordinates is less than 0.

Content

Repreents GameObject content in string.

public string Content { get; set; }

ColorMask

Represents GameObject color mask in string, which should have same size as Content.

public string ColorMask { get; set; }

Width

Represent width of GameObject. Width is equal to the longest line in Content.

public int Width { get; }

Height

Represents height of GameObject. Height is equal to the number of lines in GameObject.Content.

public int Height

Methods

SetColor()

Sets all ColorMask to given color.

public void SetColor(char color)

Paramters

color char

Color represented by char. Must be between 0 and 9;

Exceptions

  • ArgumentException - throw, if color in not between 0 and 9

Types of GameObjects

Clone this wiki locally