private void InitializationButton()
 {
     if (guidContainer == null)
     {
         guidContainer = GetComponent(typeof(IEntityGuidContainer))
                         as IEntityGuidContainer;
     }
 }
Example #2
0
        private void Start()
        {
            //Find every gameobject in the scene that is tagged as an entity.
            foreach (GameObject go in Resources.FindObjectsOfTypeAll <GameObject>()
                     .Where(go => go.scene != null && !String.IsNullOrEmpty(go.scene.name))
                     .Where(go => go.GetComponent <IEntityGuidContainer>() != null)
                     .Where(go => go.GetComponent <ITagProvider <GameObjectPrefab> >() != null))
            {
                IEntityGuidContainer guid = go.GetComponent <IEntityGuidContainer>();

                entityCollection[guid.NetworkGuid] = new EntityContainer(guid.NetworkGuid, go);

                Debug.Log($"Found Entity Name: {go.name} Id: {guid.NetworkGuid.EntityId}.");
            }
        }
        public IEnumerator AddNetworkedObjects()
        {
            yield return(new WaitForFixedUpdate());

            //TODO: Check if already in collection
            //Find every gameobject in the scene that is tagged as an entity.
            foreach (GameObject go in Resources.FindObjectsOfTypeAll <GameObject>()
                     .Where(go => go.scene != null && !String.IsNullOrEmpty(go.scene.name))
                     .Where(go => go.GetComponent <IEntityGuidContainer>() != null))
            {
                IEntityGuidContainer guid = go.GetComponent <IEntityGuidContainer>();

                EntityCollection[guid.NetworkGuid] = new EntityContainer(guid.NetworkGuid, go);

                Debug.Log($"Found Entity Name: {go.name} Id: {guid.NetworkGuid.EntityId}.");
            }
        }