public Platform(float width, float height, Color color, GameObject parent = null, string objectName = null, bool isActiveAtStart = true) : base(parent, objectName, isActiveAtStart) { var shaderSetup = new VertexColorShader(); var indices = new int[] { 0, 2, 1, 1, 2, 3 }; var points = new Vertex[] { new Vertex() { Location = new Vector3(-width / 2, height / 2, .0f), Color = color.ToVector4() }, // upper left new Vertex() { Location = new Vector3(width / 2, height / 2, .0f), Color = color.ToVector4() }, // upper right new Vertex() { Location = new Vector3(-width / 2, -height / 2, .0f), Color = color.ToVector4() }, // lower left new Vertex() { Location = new Vector3(width / 2, -height / 2, .0f), Color = color.ToVector4() }, // lower right }; Mesh = new SimplePointsMeshComponent(this, shaderSetup, points, indices); Collider = new RectangleColliderComponent(this, width, height); Collider.OnOverlapBegin += Collider_OnOverlapBegin; }
public void SetUp() { // Arrange _rectangleColliderComponent = new RectangleColliderComponent { Dimension = new Vector2(1, 2) }; _rectangleColliderComponentModel = new RectangleColliderComponentModel(_rectangleColliderComponent); }
public override void OnStart() { Debug.Assert(Entity != null, nameof(Entity) + " != null"); _transformComponent = Entity.GetComponent <Transform2DComponent>(); _rectangleColliderComponent = Entity.GetComponent <RectangleColliderComponent>(); _birdSoundComponent = Entity.GetComponent <BirdSoundComponent>(); GlobalGameState.CurrentPhase = GlobalGameState.Phase.Playing; }
public void SerializeAndDeserialize() { // Arrange var component = new RectangleColliderComponent { Dimension = new Vector2(12.34, 56.78) }; // Act var actual = SerializeAndDeserialize(component); // Assert Assert.That(actual.Dimension, Is.EqualTo(component.Dimension)); Assert.That(actual.IsColliding, Is.False); Assert.That(actual.CollidingEntities, Is.Empty); }
public RectangleColliderComponentModel(RectangleColliderComponent component) { _component = component; }
public FieldEdge(float width, float height, GameObject parent = null, string objectName = null, bool isActiveAtStart = true) : base(parent, objectName, isActiveAtStart) { Collider = new RectangleColliderComponent(this, width, height); }