コード例 #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);
        }
コード例 #2
0
        public ShotModelData CreateGroup(EntityShot entity)
        {
            ShotGroup group = new ShotGroup(entity, World);

            group.AddEntity(entity);
            GroupList.Add(group);

            return(group.Data);
        }