예제 #1
0
 public static void RegisterToEntity(GameObject go, int entId)
 {
     go.GetComponentsInChildren(_tempIdentifiers);
     for (int i = 0; i < _tempIdentifiers.Count; i++)
     {
         if (_tempIdentifiers[i] == null)
         {
             continue;
         }
         _tempIdentifiers[i].EntityID = entId;
     }
     go.GetComponentsInChildren(_tempColliders);
     for (int i = 0; i < _tempColliders.Count; i++)
     {
         if (_tempColliders[i] == null || _tempColliders[i].CompareTag(StringConst.TagSensor))
         {
             continue;
         }
         if (_colliderToDictionary.ContainsKey(_tempColliders[i]))
         {
             continue;
         }
         _colliderToDictionary.Add(_tempColliders[i], entId);
     }
     EntityController.Get(entId).Tags.Set(EntityTags.CanUnityCollide, 1);
 }
예제 #2
0
        private void TryRestore()
        {
            if (_serializedId >= 0)
            {
                var prefab = Serializer.GetPrefabEntity(_serializedId);
                if (prefab != null)
                {
                    if (!string.IsNullOrEmpty(_transformChild))
                    {
                        var targetTr = prefab.transform.Find(_transformChild);
                        if (targetTr != null)
                        {
                            _value = targetTr.GetComponent <IAnimator>();
                        }
                    }
                    if (_value == null)
                    {
                        _value = prefab.GetComponentInChildren <IAnimator>();
                    }
                }
                return;
            }
            if (_entityId < 0)
            {
                return;
            }
            var entity = EntityController.Get(_entityId);

            if (entity == null)
            {
                return;
            }
            var cref = entity.GetComponentReference(_componentType);

            if (cref != null)
            {
                _value = cref.Value.Get() as IAnimator;
            }
        }
예제 #3
0
 public static void RegisterToEntity(Collider collider, int entId)
 {
     EntityController.Get(entId).Tags.Set(EntityTags.CanUnityCollide, 1);
     _colliderToDictionary.AddOrUpdate(collider, entId);
 }
예제 #4
0
 public CachedStat(int entity, string statId)
 {
     _entityId = entity;
     _statId   = statId;
     _stat     = EntityController.Get(_entityId)?.Get <StatsContainer>()?.Get <T>(_statId);
 }