コード例 #1
0
 public void Does_not_deactivate_behaviour_when_authority_is_not_lost()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.ChangeAuthority(PositionComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithReader>().enabled,
                   "Behaviour should not be disabled if authority is not lost");
 }
 public void Does_not_activate_behaviour_when_component_is_not_present()
 {
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because it has no components");
 }
 public void Does_not_deactivate_behaviour_when_authority_is_not_lost()
 {
     ActivationManager.AddComponent(ComponentId);
     ActivationManager.ChangeAuthority(ComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TBehaviour>().enabled,
                   "Behaviour should not be disabled if authority is not lost");
     ValidateRequirablesNotNull();
 }
 public void Does_not_activate_behaviour_when_authority_is_not_present()
 {
     ActivationManager.AddComponent(ComponentId);
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because authority is not present");
 }
コード例 #5
0
 public void Activates_behaviour_when_component_is_not_present()
 {
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                   " even if it has no PlayerCreator component");
     AssertRequirablesNotNull();
 }
コード例 #6
0
 public void Activates_behaviour_when_authority_is_present()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.ChangeAuthority(PositionComponentId, Authority.Authoritative);
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourWithReader>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called even if authority is gained");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithReader>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called");
 }
 public void Activates_behaviour_when_authority_is_present()
 {
     ActivationManager.AddComponent(ComponentId);
     ActivationManager.ChangeAuthority(ComponentId, Authority.Authoritative);
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TBehaviour>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called");
     ValidateRequirablesNotNull();
 }
コード例 #8
0
 public void Activate_behaviour_when_authority_is_not_present()
 {
     ActivationManager.AddComponent(ComponentId);
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                   " even if authority is not present");
     AssertRequirablesNotNull();
 }
コード例 #9
0
 public void Activates_behaviours_only_for_current_worker()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourForOtherWorker>().enabled,
                    "TestBehaviourForOtherWorker should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because it does not match the worker type");
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourForOtherWorkerWithReader>().enabled,
                    "TestBehaviourForOtherWorkerWithReader should not be enabled after EnableSpatialOSBehaviours is called" +
                    " even if it has the components because it does not match the worker type");
     Assert.IsNull(TestGameObject.GetComponent <TestBehaviourForOtherWorkerWithReader>().PositionReader);
 }
コード例 #10
0
        public void Activate_behaviour_when_authority_is_not_present()
        {
            ActivationManager.AddComponent(PositionComponentId);
            var testBehaviourWithReader = TestGameObject.GetComponent <TestBehaviourWithReader>();

            Assert.IsFalse(testBehaviourWithReader.enabled,
                           "Behaviour should not be enabled before EnableSpatialOSBehaviours is called even if it has components");
            ActivationManager.EnableSpatialOSBehaviours();
            Assert.IsTrue(testBehaviourWithReader.enabled,
                          "Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                          " even if authority is not present");
            Assert.IsNotNull(testBehaviourWithReader.PositionReader);
        }
コード例 #11
0
 public void Activate_only_reader_behaviour_when_authority_is_not_present()
 {
     ActivationManager.AddComponent(PositionComponentId);
     Assert.IsFalse(TestGameObject.GetComponent <ReaderBehaviour>().enabled,
                    "Reader Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     Assert.IsFalse(TestGameObject.GetComponent <WriterBehaviour>().enabled,
                    "Writer Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <ReaderBehaviour>().enabled,
                   "Reader Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                   " even if authority is not present");
     Assert.IsFalse(TestGameObject.GetComponent <WriterBehaviour>().enabled,
                    "Writer Behaviour should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because authority is not present");
 }
コード例 #12
0
 public void Does_not_deactivate_behaviour_when_authority_is_lost()
 {
     ActivationManager.AddComponent(ComponentId);
     ActivationManager.ChangeAuthority(ComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.ChangeAuthority(ComponentId, Authority.NotAuthoritative);
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should not be disabled after DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should not be disabled after DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     AssertRequirablesNotNull();
 }
コード例 #13
0
 public void Does_not_alter_component_dependent_activation()
 {
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourForCurrentWorker>().enabled,
                   "TestBehaviourForCurrentWorker should be enabled after EnableSpatialOSBehaviours is called" +
                   " because it matches the worker type");
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().enabled,
                    "TestBehaviourForCurrentWorkerWithReader should not be enabled after EnableSpatialOSBehaviours is called" +
                    " even if it matches the worker type because it has no components");
     Assert.IsNull(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().PositionReader);
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().enabled,
                   "TestBehaviourForCurrentWorkerWithReader should be enabled after EnableSpatialOSBehaviours is called" +
                   " because it has the right components");
     Assert.IsNotNull(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().PositionReader);
 }
コード例 #14
0
 public void Does_not_deactivate_reader_behaviour_when_authority_is_lost()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.ChangeAuthority(PositionComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.ChangeAuthority(PositionComponentId, Authority.NotAuthoritative);
     Assert.IsTrue(TestGameObject.GetComponent <ReaderBehaviour>().enabled,
                   "Reader Behaviour should not be disabled before DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     Assert.IsTrue(TestGameObject.GetComponent <WriterBehaviour>().enabled,
                   "Writer Behaviour should not be disabled before DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <ReaderBehaviour>().enabled,
                   "Reader Behaviour should not be disabled after DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     Assert.IsFalse(TestGameObject.GetComponent <WriterBehaviour>().enabled,
                    "Writer Behaviour should not be disabled after DisableSpatialOSBehaviours is called" +
                    " after authority is lost");
 }