Beispiel #1
0
        public void cannot_be_claimed()
        {
            var ID         = new Guid("2a6e749e-94b6-4f76-8b96-8217d361895e");
            var idRegistry = new DictionaryIdRegistry();
            var agent      = new ClaimsAgent(idRegistry);
            var gameObject = new GameObject("Entity");

            agent.ClaimIDFor(ID, gameObject.GetInstanceID());
            Assert.IsTrue(agent.IsClaimed(ID));
            Assert.Throws <EntityIdAlreadyClaimed>(() =>
            {
                agent.ClaimIDFor(ID, gameObject.GetInstanceID());
            });
            UnityEngine.Object.Destroy(gameObject);
        }
Beispiel #2
0
        private void Start()
        {
            Debug.Assert(entityID != "", "entityID must not be empty.");
            Debug.Assert(registry != null, "registry must not be null.");
            var claimsAuthority = new ClaimsAgent(registry);
            var ID = new Guid(entityID);

            if (!claimsAuthority.IsClaimed(ID))
            {
                claimsAuthority.ClaimIDFor(ID, gameObject.GetInstanceID());
            }
            else
            {
                Debug.LogError("Entity ID '" + ID + "' is already claimed.");
            }
        }