コード例 #1
0
        public void can_be_claimed()
        {
            var ID         = new Guid("2a6e749e-94b6-4f76-8b96-8217d361895e");
            var idRegistry = new DictionaryIdRegistry();
            var agent      = new ClaimsAgent(idRegistry);

            Assert.IsFalse(agent.IsClaimed(ID));
            var gameObject = new GameObject("Entity");

            agent.ClaimIDFor(ID, gameObject.GetInstanceID());
            Assert.IsTrue(agent.IsClaimed(ID));
            UnityEngine.Object.Destroy(gameObject);
        }
コード例 #2
0
ファイル: ClaimEntityID.cs プロジェクト: wesley-brown/sakura
        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.");
            }
        }