コード例 #1
0
        public static UnitController CreateNewUnit(UnitDef def, FloatCoords topLeft, WorldController world, Faction_Controller factionController)
        {
            UnitController unitController = new UnitController(def)
            {
                UnitView =
                {
                    Texture = def.Image, Width = def.Width, Height = def.Height
                },
                UnitModel =
                {
                    Speed   = def.Speed,
                    Faction = factionController
                }
            };

            Location_Controller location = new Location_Controller(world, topLeft.x, topLeft.y)
            {
                LocationModel =
                {
                    Parent = unitController
                }
            };

            unitController.LocationController = location;
            return(unitController);
        }
コード例 #2
0
 public UnitController CreateNewUnit(UnitDef def)
 {
     return(CreateNewUnit(def, new FloatCoords(), game.GameModel.World, faction));
 }