Ejemplo n.º 1
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="coordinate">坐标</param>
    /// <param name="index">传送类型</param>
    public void InitData(Vector2 coordinate, int index)
    {
        int id = TileModel.GetTileIdByCoordinate(coordinate);

        door      = DoorsModel.GetDoorJsonById(id);
        door.id   = id;
        door.view = this;
        SetDoorTypeAndPosition(index);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 根据id取得传送数据
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static DoorJson GetDoorJsonById(int id)
    {
        DoorJson door = null;

        if (doorMap.ContainsKey(id))
        {
            door = doorMap[id];
        }
        else
        {
            door = new DoorJson();
            doorMap.Add(id, door);
        }
        return(door);
    }