Beispiel #1
0
        /// <summary>
        /// Locates common frontiers points between France and Germany and add custom sprites over that line
        /// </summary>
        void FindFranceGermanyLine()
        {
            int            franceIndex  = map.GetCountryIndex("France");
            int            germanyIndex = map.GetCountryIndex("Germany");
            List <Vector2> points       = map.GetCountryFrontierPoints(franceIndex, germanyIndex);

            points.ForEach((point) => AddRandomSpriteAtPosition(point));
            if (points.Count > 0)
            {
                map.FlyToLocation(points[0], 2, 0.2f);
            }
        }
        void ToggleFrontierSpainFrance()
        {
            List <Vector2> blockedPositions = map.GetCountryFrontierPoints(map.GetCountryIndex("France"), map.GetCountryIndex("Spain"), 1);

            canCross = !canCross;
            map.PathFindingCustomRouteMatrixSet(blockedPositions, canCross ? -1 : 0);
        }
Beispiel #3
0
 void ToggleFrontierSpainFrance() {
     List<Vector2> blockedPositions = map.GetCountryFrontierPoints(map.GetCountryIndex("France"), map.GetCountryIndex("Spain"), 1);
     canCross = !canCross;
     map.PathFindingCustomRouteMatrixSet(blockedPositions, canCross ? -1 : 0);
     if (canCross) {
         for(int k=0;k<blocks.Count;k++) {
             Destroy(blocks[k]);
         }
         blocks.Clear();
     } else {
         blocks.Clear();
         foreach(Vector2 blockPosition in blockedPositions) {
             GameObject o = GameObject.CreatePrimitive(PrimitiveType.Cube);
             map.AddMarker3DObject(o, blockPosition, 0.05f);
             blocks.Add(o);
         }
     }
 }