当前位置: 首页>>代码示例>>C#>>正文


C# MapData类代码示例

本文整理汇总了C#中MapData的典型用法代码示例。如果您正苦于以下问题:C# MapData类的具体用法?C# MapData怎么用?C# MapData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapData类属于命名空间,在下文中一共展示了MapData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildMap

    public void BuildMap()
    {
        //����������
        m_map = new MapData[MapSizeX, MapSizeZ];

        for (int i = 0; i < MapSizeX; i++)
        {
            for (int k = 0; k < MapSizeZ; k++)
                m_map[i, k] = new MapData();
        }

        // �������TagΪgridnode�Ľڵ�
        GameObject[] nodes = (GameObject[])GameObject.FindGameObjectsWithTag("gridnode");

        foreach (GameObject nodeobj in nodes)
        {
            //��ýڵ�
            GridNode node = nodeobj.GetComponent<GridNode>();

            Vector3 pos = nodeobj.transform.position;

            //����ڵ��λ�ó���������Χ�������
            if ((int)pos.x >= MapSizeX || (int)pos.z >= MapSizeZ)
                continue;

            //���ø��ӵ�����
            m_map[(int)pos.x, (int)pos.z].fieldtype = node._mapData.fieldtype;

        }
    }
开发者ID:Wholanz,项目名称:Tower,代码行数:30,代码来源:GridMap.cs

示例2: GridUpdate

    void GridUpdate(SceneView sceneview)
    {
        e = Event.current;

        //Make sure MapData has been loaded
        _MapData = EditorHelper.CheckMapData(_MapData);

        //If a Grid exists place tiles
        if (EditorHelper.GridExsists())
        {
            if(grid == null)
            {
                grid = GameObject.FindObjectOfType<DrawGrid>();
            }

            if (EditorHelper.InsideGrid(EditorHelper.GetMousePosition(e)))
            {
                //if input is from a mouse and the mouse button was a left click event
                if (e.button == 0 && e.isMouse && e.type == EventType.MouseDown)
                {
                    PaintTile();
                }
            }
        }
    }
开发者ID:DanWeston626,项目名称:LevelEditor,代码行数:25,代码来源:GridEditorSceneView.cs

示例3: GetMapData

		internal protected override object GetMapData (object[] attributes, string scope)
		{
			DataType itemDataType = null;
			Type itemType = null;
			
			ItemPropertyAttribute at = FindPropertyAttribute (attributes, scope + "/*");
			if (at != null) {
				itemType = at.ValueType;
				if (itemType == null) itemType = handler.GetItemType ();
				if (at.SerializationDataType != null)
					itemDataType = (DataType) Activator.CreateInstance (at.SerializationDataType, new object[] { itemType });
			}
			
			if (itemType == null) itemType = handler.GetItemType ();
			if (itemDataType == null) itemDataType = Context.GetConfigurationDataType (itemType);

			object itemMapData = itemDataType.GetMapData (attributes, scope + "/*");
			if (at == null && itemMapData == null) return null;

			MapData data = new MapData ();
			data.ItemType = itemDataType;
			data.ItemName = (at != null && at.Name != null) ? at.Name : itemDataType.Name;
			data.ItemMapData = itemMapData;
			return data;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:25,代码来源:CollectionDataType.cs

示例4: Node

        public Node(Node copie, NodePos direction, MapData map, Vector2 size)
        {
            CanGo = true;
            Start = copie.Start;
            Arrival = copie.Arrival;

            switch (direction)
            {
                case NodePos.U:
                    Position = new Vector2(copie.Position.X, copie.Position.Y - 32);
                    break;
                case NodePos.D:
                    Position = new Vector2(copie.Position.X, copie.Position.Y + 32);
                    break;
                case NodePos.R:
                    Position = new Vector2(copie.Position.X + 32, copie.Position.Y);
                    break;
                case NodePos.L:
                    Position = new Vector2(copie.Position.X - 32, copie.Position.Y);
                    break;
            }

            Update(map);
            if (Id < 0 || Id > map.MapWidth * map.MapHeight || !Can(direction, map, size))
                CanGo = false;
        }
开发者ID:wiilinkpds,项目名称:Wotrn,代码行数:26,代码来源:Node.cs

示例5: ReadCSVMap

	public void ReadCSVMap()
	{
		lstMapData = new List<MapData>();
		List<Dictionary<string, object>> data = CSVReader.Read("csv/" + FILE_CSV_MAP);
		MapData mapData;
		if (data != null)
		{
			for (int i = 0; i < data.Count; i++)
			{
				int id = (int)data[i]["id"];
				int idPattern = (int)data[i]["idPattern"];
				int idModel = (int)data[i]["idModel"];
				float positionX = float.Parse(data[i]["positionX"].ToString());
				float positionY = float.Parse(data[i]["positionY"].ToString());
				float positionZ = float.Parse(data[i]["positionZ"].ToString());
				float rotationX = float.Parse(data[i]["rotationX"].ToString());
				float rotationY = float.Parse(data[i]["rotationY"].ToString());
				float rotationZ = float.Parse(data[i]["rotationZ"].ToString());
				float scaleX = float.Parse(data[i]["scaleX"].ToString());
				float scaleY = float.Parse(data[i]["scaleY"].ToString());
				float scaleZ = float.Parse(data[i]["scaleZ"].ToString());
				mapData = new MapData(id,idPattern,idModel,new Vector3(positionX,positionY,positionZ),new Vector3(rotationX,rotationY,rotationZ),new Vector3(scaleX,scaleY,scaleZ));
				lstMapData.Add(mapData);
			}
		}
	}
开发者ID:at-anhgh,项目名称:Game-RiotSamuraFight,代码行数:26,代码来源:CreatMap.cs

示例6: TryGetMapData

        public bool TryGetMapData(string signText, string worldOwner, out MapData mapData)
        {
            signText = signText.Trim();
            mapData = null;

            if (!signText.StartsWith(ScanText, StringComparison.OrdinalIgnoreCase))
                return false;

            signText = signText.Substring(ScanText.Length).Trim();
            var lowerText = signText.ToLower();

            // Try to find specified creators in text by searching for special text
            foreach (var byText in new[] {" by ", " by:"})
            {
                if (!lowerText.Contains(byText))
                    continue;

                var splitIndex = lowerText.LastIndexOf(byText, StringComparison.OrdinalIgnoreCase);

                // Name is before 'byText' and creators after
                mapData = new MapData(
                    signText.Substring(splitIndex).Trim(),
                    signText.Substring(splitIndex + byText.Length).Trim());

                return true;
            }

            mapData = new MapData(signText, worldOwner);

            return true;
        }
开发者ID:BotBitsExt,项目名称:MapManager,代码行数:31,代码来源:ScanSignFormat.cs

示例7: Create

        public static World Create(MapData mapData, LevelData newLevel, Game game, Rectangle screenRec)
        {
            var tilesetList = new List<Tileset>();
            foreach (TilesetData data in mapData.Tilesets)
            {
                tilesetList.Add(
                    TilesetFactory.Create(data, game)
                    );
            }

            var mapLayers = mapData.Layers.Select(l => MapLayer.FromMapLayerData(l)).ToList();

            // MUSTDO: modify TileMap to be able to accept multiple tile sets
            var map = new TileMap(tilesetList[0], mapLayers[0]);

            // SHOULDDO: find out why does map need tilesets to?
            for (int i = 1; i < tilesetList.Count; i++)
                map.AddTileset(tilesetList[i]);

            for (int i = 1; i < mapLayers.Count; i++)
                map.AddLayer(mapLayers[i]);

            var level = new Level(map);

            var world = new World(game, screenRec);
            world.Levels.Add(level);
            world.CurrentLevel = 0;

            return world;
        }
开发者ID:vkuts,项目名称:Gamesor,代码行数:30,代码来源:WorldFactory.cs

示例8: Generate

    public static MapData Generate()
    {
        MapData md = new MapData();

        md.Add(new FenceHMI(36,74));
        md.Add(new FenceHMI(112,-65));
        md.Add(new FenceHMI(-22,-98));
        md.Add(new FenceHMI(-237,-33));
        md.Add(new FenceHMI(-182,-93));
        md.Add(new FenceVMI(-189,73));
        md.Add(new FenceVMI(-48,-76));
        md.Add(new FenceVMI(165,-14));
        md.Add(new FenceVMI(84,-96));
        md.Add(new FenceVMI(61,97));
        md.Add(new FenceVMI(273,29));
        md.Add(new House1MI(52,-49));
        md.Add(new House1MI(132,32));
        md.Add(new House1MI(-160,120));
        md.Add(new House1MI(-183,-16));
        md.Add(new StartPosMI(-62,-134));
        md.Add(new StartPosMI(-257,127));
        md.Add(new StartPosMI(-45,132));
        md.Add(new StartPosMI(156,128));
        md.Add(new StartPosMI(189,-115));
        md.Add(new StartPosMI(237,27));
        md.Add(new StartPosMI(-272,32));
        md.Add(new StartPosMI(-228,-124));

        return md;
    }
开发者ID:BoarK,项目名称:BewareWolf,代码行数:30,代码来源:GeneratedMap.cs

示例9: RecordManager

    public RecordManager(string text)
    {
        string[] frameText = text.Split('\n');
        numFrames = frameText.Length - 1;

        //handle the first row
        string[] first_row_data = frameText[0].Split('|');
        string[] robotAIText = first_row_data[0].Split('*');
        robotAIData = new RobotAIData[robotAIText.Length];
        for(int i = 0; i<robotAIText.Length; i++)
        {
            robotAIData[i] = new RobotAIData(robotAIText[i]);
        }
        mapData = new MapData(first_row_data[1],first_row_data[2],first_row_data[3]);

        string[] achievementText = first_row_data[4].Split('*');
        achievementData = new AchievementData[achievementText.Length];
        for(int i = 0; i<achievementText.Length; i++)
        {
            achievementData[i] = new AchievementData(achievementText[i]);
        }

        winnerID = Convert.ToInt32(first_row_data[5]);

        //handle the following frame rows
        frameData = new FrameData[numFrames];

        for(int i = 1; i < frameText.Length; i++)
        {
            frameData[i-1] = new FrameData(frameText[i]);
        }
    }
开发者ID:shrekshao,项目名称:MechEmpire-Clash,代码行数:32,代码来源:RecordManager.cs

示例10: GetRandomPosition

	Position GetRandomPosition(MapData mapData)
	{
		var position = new Position();
		position.column = GetRandomPositionDimension(mapData.Size);
		position.row = GetRandomPositionDimension(mapData.Size);
		return position;
	}
开发者ID:KarolStola,项目名称:ThePatfinder,代码行数:7,代码来源:CreateMapCommand.cs

示例11: Start

        void Start()
        {
            MapData data = new MapData();
            data.Deserialize(map);

            Json_MasterParam master = LitJson.JsonMapper.ToObject<Json_MasterParam>(json.text);
            Json_CalenderParam d = master.calender;
            CalenderParam cp = new CalenderParam();
            cp.Desrialize(d);
            int year = cp.Year;

            width = data.mMapData.Width;
            height = data.mMapData.Height;
            types = data.mMapData.MapData;
            for (int h = 0; h < height; ++h)
            {
                for (int w = 0; w < width; ++w)
                {
                    //Debug.Log(h * height + w);

                    if (types[h * height + w] == FloorType.Hatake)
                    {
                        GameObject obj = Instantiate<GameObject>(hatake);
                        obj.transform.position = new Vector3((float)w, 0.1f, (float)height - h);
                        obj.transform.rotation = new Quaternion();
                    }
                }
            }
        }
开发者ID:Crokan,项目名称:ROGUE,代码行数:29,代码来源:GameScene.cs

示例12: getBoard_RandomContent

 public static MapData getBoard_RandomContent(int w, int h)
 {
     var d = new MapData(w, h);
     d.setRandomMatches(10);
     d.doUpdateMatches();
     return d;
 }
开发者ID:kyung01,项目名称:UnityProject1,代码行数:7,代码来源:MapGenerator.cs

示例13: CheckMapData

 /// <summary>
 /// Checks if the passed MapData has been initialized
 /// if it has not CheckMapData calls CreateMapData and loads
 /// the resource path to the reference
 /// </summary>
 /// <param name="_MapData"></param>
 /// <returns></returns>
 public static MapData CheckMapData(MapData _MapData)
 {
     if (_MapData == null)
     {
         CreateMapData(out _MapData);
     }
     return _MapData;
 }
开发者ID:DanWeston626,项目名称:LevelEditor,代码行数:15,代码来源:EditorHelper.cs

示例14: Init

 public static void Init()
 {
     EditorHelper.CreateMapData(out _MapData);
     _MapData = Resources.Load<MapData>("GameData/MapData");
     MapToolsEditor window = (MapToolsEditor)EditorWindow.GetWindow(typeof(MapToolsEditor));
     window.title = "Map Tools";
     window.Show();
 }
开发者ID:DanWeston626,项目名称:LevelEditor,代码行数:8,代码来源:MapToolsEditor.cs

示例15: MapRefData

 public MapRefData(MapData toAdd)
 {
     RepresentationLabel = toAdd.Geometry.RepresentationLabel;
     EntityLabel = toAdd.Product.EntityLabel;
     EntityTypeId = IfcMetaData.IfcTypeId(toAdd.Product);
     SurfaceStyleLabel = toAdd.Geometry.SurfaceStyleLabel;
     Matrix = XbimMatrix3D.Multiply(toAdd.Geometry.Transform, toAdd.Matrix);
 }
开发者ID:bnaand,项目名称:xBim-Toolkit,代码行数:8,代码来源:XbimMesher.cs


注:本文中的MapData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。