//----------------------------------------------------------------------------------------------- public InfluenceObjectWorldPoint ConvertMapPosToWorldPos(InfluenceMapPoint mapPoint) { InfluenceObjectWorldPoint worldPos; worldPos.x = ((float)(mapPoint.x) * GameMapDimensions.x) / BaseMap.INFLUENCE_MAP_RESOLUTION; worldPos.y = ((float)(mapPoint.y) * GameMapDimensions.y) / BaseMap.INFLUENCE_MAP_RESOLUTION; return(worldPos); }
//----------------------------------------------------------------------------------------------- public void GenerateInfluenceMaps() { InfluenceSystem influenceSystemRef = InfluenceSystem.GetInstance(); List <BaseMap> baseMapsToGenerate = influenceSystemRef.InfluenceMaps; foreach (BaseMap baseMap in baseMapsToGenerate) { baseMap.Reset(); List <IInfluenceObject> objectsForMap = influenceSystemRef.GetAllObjectsWithTag(baseMap.ObjectTag); if (objectsForMap == null) { continue; } List <InfluenceTemplate> templatesForMap = influenceSystemRef.GetInfluencesTemplatesWithID(baseMap.InfluenceID); if (templatesForMap == null) { throw new ArgumentNullException("templatesForMap"); } foreach (IInfluenceObject influenceObject in objectsForMap) { uint influenceSize = influenceObject.GetTemplateSizeForInfluenceType(baseMap.InfluenceID); InfluenceTemplate templateToApply = GetInfluenceTemplateForSize(templatesForMap, influenceSize); if (templateToApply == null) { throw new ArgumentNullException("templateToApply"); } InfluenceObjectWorldPoint objWorldPos = influenceObject.WorldPosition; InfluenceMapPoint mapPos = ConvertWorldPosToMapPos(objWorldPos); baseMap.ApplyTemplate(templateToApply, mapPos.x, mapPos.y); } } }
//----------------------------------------------------------------------------------------------- public InfluenceObjectWorldPoint ConvertMapPosToWorldPos(InfluenceMapPoint mapPoint) { return(m_influenceGenerator.ConvertMapPosToWorldPos(mapPoint)); }