예제 #1
0
        public int GetArea(IUnitDef unitdef, Float3 currentpos)
        {
            int         mapx        = (int)(currentpos.x / 16);
            int         mapy        = (int)(currentpos.z / 16);
            UnitDefHelp unitdefhelp = new UnitDefHelp(aicallback);

            if (unitdefhelp.IsBoat(unitdef))
            {
                return(boatareas[mapx, mapy]);
            }
            else if (unitdef.movedata.maxSlope > maxvehicleslope)  // so infantry, approximately
            {
                return(infantryareas[mapx, mapy]);
            }
            else // vehicle, approximately
            {
                return(vehicleareas[mapx, mapy]);
            }
        }
예제 #2
0
        public int GetArea(IUnitDef unitdef, Float3 currentpos)
        {
            int         mapx        = (int)(currentpos.x / 16);
            int         mapy        = (int)(currentpos.z / 16);
            UnitDefHelp unitdefhelp = new UnitDefHelp(aicallback);

            logfile.WriteLine("MovementMaps.GetArea unitdefhelp is null? " + (unitdefhelp == null).ToString() + " unitdef is null? " + (unitdef == null).ToString());
            if (unitdefhelp.IsAirCraft(unitdef))
            {
                return(1); // alwasy area 1, easy :-DDD
            }
            if (unitdefhelp.IsBoat(unitdef))
            {
                return(boatareas[mapx, mapy]);
            }
            else if (unitdef.movedata.maxSlope > maxvehicleslope)  // so infantry, approximately
            {
                return(infantryareas[mapx, mapy]);
            }
            else // vehicle, approximately
            {
                return(vehicleareas[mapx, mapy]);
            }
        }
 public int GetArea(IUnitDef unitdef, Float3 currentpos)
 {
     int mapx = (int)( currentpos.x / 16 );
     int mapy = (int)( currentpos.z / 16 );
     UnitDefHelp unitdefhelp = new UnitDefHelp( aicallback );
     logfile.WriteLine("MovementMaps.GetArea unitdefhelp is null? " + (unitdefhelp == null).ToString() + " unitdef is null? " + (unitdef == null).ToString());
     if( unitdefhelp.IsAirCraft( unitdef ) )
     {
         return 1; // alwasy area 1, easy :-DDD
     }
     if( unitdefhelp.IsBoat( unitdef ) )
     {
         return boatareas[ mapx, mapy ];
     }
     else if( unitdef.movedata.maxSlope > maxvehicleslope ) // so infantry, approximately
     {
         return infantryareas[ mapx, mapy ];
     }
     else // vehicle, approximately
     {
         return vehicleareas[ mapx, mapy ];
     }
 }