//----------------------------------------------------------------------------------------------- private WorkingMap ConstructActiveMapFromBaseMap(int indexIntoMapList) { WorkingMap activeMap = new WorkingMap(); activeMap.AddMap(m_influenceSystemRef.InfluenceMaps[indexIntoMapList], 1f); activeMap.Normalize(); return(activeMap); }
//----------------------------------------------------------------------------------------------- public override void Run() { OperatorParam influenceMapParamName = FindParamWithName("Influence"); // Can't exactly move if we don't have a goal if (influenceMapParamName == null) { return; } string[] mapIdentifiers = influenceMapParamName.Value.Split('_'); // Determine map type InfluenceSystem influenceSys = InfluenceSystem.GetInstance(); InfluenceMapPoint mapPoint; if (mapIdentifiers[0].Equals("Base", StringComparison.CurrentCultureIgnoreCase)) { WorkingMap queryMap = new WorkingMap(); queryMap.AddMap(influenceSys.GetInfluenceMapByIDWithTag(mapIdentifiers[1], mapIdentifiers[2])); queryMap.Normalize(); mapPoint = queryMap.GetPointOfHighestInfluence(); } else if (mapIdentifiers[0].Equals("Formula", StringComparison.CurrentCultureIgnoreCase)) { MapFormula formulaToUse = influenceSys.GetMapFormulaByID(mapIdentifiers[1]); WorkingMap queryMap = formulaToUse.ConstructMapFromFormula(); mapPoint = queryMap.GetPointOfHighestInfluence(); } else { throw new ArgumentException("Invalid name for influence map in move to operator!"); } InfluenceObjectWorldPoint worldPoint = influenceSys.ConvertMapPosToWorldPos(mapPoint); Vector2 newLocation = new Vector2(worldPoint.x, worldPoint.y); AgentToOperateOn.transform.position = newLocation; InfluenceGameManager influenceManager = GameObject.FindObjectOfType <InfluenceGameManager>(); influenceManager.UpdateInfluenceSystem(); }