Esempio n. 1
0
        public void AddEntity(EntityShotBase entity, out ShotModelData data)
        {
            if (!IsUpdated)
            {
                Update();
            }

            int hash = GetPropertyHashCode(entity.Property, entity.Parent);

            ShotGroup group = null;

            if (ReusableGroupDict.ContainsKey(hash))
            {
                var groupList = ReusableGroupDict[hash];

                group = groupList.FirstOrDefault();

                if (groupList.Count == 1)
                {
                    ReusableGroupDict.Remove(hash);
                }
                else
                {
                    groupList.RemoveAt(0);
                }
            }
            group = group ?? new ShotGroup(entity);

            group.SetEntity(entity);
            data = group.Data;

            GroupList.Add(group);
        }
Esempio n. 2
0
 public ShotGroup(EntityShotBase entity)
 {
     Data         = new ShotModelData(entity.World, entity.Property);
     ParentEntity = entity.Parent;
 }
Esempio n. 3
0
 public void SetEntity(EntityShotBase entity)
 {
     CurrentEntity = entity;
 }
Esempio n. 4
0
 public virtual void InitEntity(EntityShotBase entity)
 {
 }