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); }
public ShotGroup(EntityShotBase entity) { Data = new ShotModelData(entity.World, entity.Property); ParentEntity = entity.Parent; }
public void SetEntity(EntityShotBase entity) { CurrentEntity = entity; }
public virtual void InitEntity(EntityShotBase entity) { }