Exemplo n.º 1
0
 /// <summary>
 /// Adds component to a prototype
 /// </summary>
 /// <param name="e">Prototype</param>
 /// <param name="component">New component</param>
 /// <returns>Given protype</returns>
 public static Entity operator |(Entity e, Component component)
 {
     e.Components.Add(component);
     component.Parent = e;
     RequirementsAttribute.CheckRequirements(component);
     return(e);
 }
Exemplo n.º 2
0
        public void CheckRequirements_ThrowsExceptionIfThereAreSomeOutstandingRequirements()
        {
            var exceptionThrown = false;

            // arrange
            var a = new A();

            // act
            try
            {
                RequirementsAttribute.CheckRequirements(a);
            }
            catch (RequirementsException)
            {
                exceptionThrown = true;
            }

            // assert
            Assert.True(exceptionThrown);
        }
        public void CheckRequirements_ThrowsRequirementsExceptionWhenThereAreSomeOutstandingRequirements()
        {
            // arrange
            var system = new TestSystem
            {
                Ecs = Mock.Of <EcsManager>(ecs => ecs.SystemManager == Mock.Of <SystemManager>())
            };
            var exceptionThrown = false;

            // act
            try
            {
                RequirementsAttribute.CheckRequirements(system);
            }
            catch (RequirementsException)
            {
                exceptionThrown = true;
            }

            // assert
            Assert.True(exceptionThrown);
        }
Exemplo n.º 4
0
 public virtual void Start()
 {
     RequirementsAttribute.CheckRequirements(this);
 }