public HeavyObject GetHeavyObject(FlyWeightObject key) { if (repository.TryGetValue(key, out HeavyObject heavyObj)) { return(heavyObj); } else { repository.Add(key, new HeavyObject(key)); return(repository[key]); } }
public HeavyObject(FlyWeightObject flyObject) { this.flyObject = flyObject; this.Value = Math.Pow(flyObject.Base, flyObject.Power); }