void MakeMap(IMapData mapData) { GameObject[] objs = GameObject.FindGameObjectsWithTag("Floor"); foreach (GameObject obj in objs) GameObject.DestroyImmediate (obj); foreach (Vector3 pos in mapData.CubePos) { GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube); cube.tag = "Floor"; cube.name = "C"+pos.x+pos.y+pos.z; // 'C'ube cube.transform.position = pos; } for (int i = 0; i < mapData.SlopePos.Length; i++) { GameObject slope = makeSlope (); Vector3 pos = mapData.SlopePos[i]; slope.tag = "Floor"; slope.name = "S"+pos.x+pos.y+pos.z; // 'S'lope slope.transform.position = pos; slope.transform.rotation = mapData.SlopeRot[i]; } foreach (RotatingObject data in mapData.RotObj) { GameObject obj = GameObject.Find(data.name); if (obj == null) continue; Rotating script = obj.AddComponent("Rotating") as Rotating; script.point = data.point; script.axis = data.axis; script.PlayerRot = data.playerRot; } { GameObject player = GameObject.Find ("Player"); player.transform.position = new Vector3(mapData.PlayerStart.x, mapData.PlayerStart.y + 1, mapData.PlayerStart.z); player.GetComponent<MoveCharacter>().Init(); } }
public BombermanWalkState(IMapData mapData, TilePosition targetPosition, NewAI aiBehavior, GameObject target) : base(mapData, targetPosition, aiBehavior) { this.m_Target = target; this.m_HPBehavior = this.m_AIBehavior.gameObject.GetComponent <KodoHPBehavior>(); this.m_StateName = "BombermanWalk"; }
public static bool GetIsAreaFree(this IMapData data, Vector2 position, Vector2 size) { var intSize = new Vector2Int(Mathf.CeilToInt(size.x), Mathf.CeilToInt(size.y)); var intPos = new Vector2Int(Mathf.FloorToInt(position.x), Mathf.FloorToInt(position.y)); var toCompare = data.GetHeightAt(intPos.x, intPos.y); for (int x = 0; x <= intSize.x; x++) { for (int y = 0; y <= intSize.y; y++) { var localPos = intPos + new Vector2Int(x, y); if (localPos.x < 0 || localPos.x >= data.Width || localPos.y < 0 || localPos.y >= data.Length) { return(false); } if (Math.Abs(toCompare - data.GetHeightAt(localPos.x, localPos.y)) > 0.001) { return(false); } if (data.GetMapObjectAt(localPos.x, localPos.y) != MapObject.None && x != intSize.x && y != intSize.y) { return(false); } } } return(true); }
public CharacterGCalculator(IMapData mapData, int destinationRow, int destinationColumn) { this.m_DestinationRow = destinationRow; this.m_DestinationColumn = destinationColumn; this.m_MapData = mapData; this.m_PreviousTargetLightPositions = new List <int>(); }
// Use this for initialization void Start() { IMapData mp7 = new Map07(); currentMap = mp7; MakeMap(mp7); }
private void CodeView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { IMapData data = e.OldValue as IMapData; if (data != null) { data.PropertyChanged -= Data_PropertyChanged; } data = e.NewValue as IMapData; if (data != null && data.Items != null) { data.PropertyChanged += Data_PropertyChanged; colorizer.Data = data; code.Text = data.Text; code.ScrollToHome(); var main = DataContext as MainVM; if (main.SelectedValue != null) { Goto(data.Items.FirstOrDefault(it => it is IMapValueItem && (it as IMapValueItem).Value == main.SelectedValue.Value)); } } else { colorizer.Data = null; code.Text = string.Empty; } }
public VillagerWalkState(IMapData mapData, TilePosition targetPosition, NewAI aiBehavior, IBuildingInfo targetInfo) : base(mapData, targetPosition, aiBehavior, targetInfo) { this.m_ActorConfig = ActorPrefabConfig.Instance.GetComponent <ActorConfig>(); this.WalkVelocity = this.m_ActorConfig.VillagerMoveVelocity; this.m_Offset = targetPosition - targetInfo.ActorPosition; }
public LoadButton(int x, int y) : base(x, y) { _settings = DependencyInjection.Resolve<IReadOnlySettings>(); _mapData = DependencyInjection.Resolve<IMapData>(); _ledgesLoader = DependencyInjection.Resolve<ILedgesLoader>(); }
private static void IdentifySuccessors(IMapData Map, NavigationNode Node, INode Goal, NavigationNodeStack OpenedNodes, NavigationNodeStack ClosedNodes) { INode[] neighbors = GetNeighbors(Map, Node); for (int i = 0; i < neighbors.Length; ++i) { INode neighborNode = neighbors[i]; INode jumpNode = Jump(Map, neighborNode, Node.Node, Goal, OpenedNodes); if (jumpNode == null || IsNavigationNodeInList(jumpNode, ClosedNodes)) { continue; } NavigationNode jumpNavNode = GetNavigationNode(jumpNode, OpenedNodes); bool alreadyIsInOpenNodes = (jumpNavNode != null); if (jumpNavNode == null) { jumpNavNode = GetOrAddNavigationNode(jumpNode, OpenedNodes); } Number heuristic = NavigationNode.CalculateHeuristicCost(Node.Node, jumpNode); Number nextExactCost = Node.ExactCost + heuristic; if (!alreadyIsInOpenNodes || nextExactCost < jumpNavNode.ExactCost) { jumpNavNode.SetExactCost(nextExactCost); jumpNavNode.SetHeuristicCost(jumpNavNode.HeuristicCost != 0 ? jumpNavNode.HeuristicCost : NavigationNode.CalculateHeuristicCost(jumpNode, Goal)); jumpNavNode.SetParent(Node); } } }
public InvaderWalkState(IMapData mapData, TilePosition targetPosition, NewAI aiBehavior, GameObject target) : base(mapData, targetPosition, aiBehavior) { this.m_Target = target; this.m_StateName = "InvaderWalk"; this.m_Values = new string[2]; }
/// <summary> /// Для добавления объекта разметки к записям соответствующим значениям разметки объекта /// </summary> static void AddRecordInfo <T>(IEnumerable <IMapRecordFull> lst, IMapData data, Func <string, IMapRecordFull> Getter) where T : IMapBaseItem { var items = data.Items.OfType <T>().ToArray(); #if MAPPED_DATA_OPTIMIZE var store = new List <IComparable>() { Capacity = items.Length }; #endif //SortedSet лчень быстро выкинет дубли и вернет чистенький сортированы энум foreach (var item in new SortedSet <T>(items, MapBaseItemComparer <T> .Comparer)) { var rec = Getter(item.Value); (rec as IMapRecordFull).Data.Add(data); if (rec is IMapValueRecord mvr) { mvr.WasLinked = true; } #if MAPPED_DATA_OPTIMIZE store.Add(rec); #endif } #if MAPPED_DATA_OPTIMIZE foreach (var item in items.OfType <IMapOptimizableValueItem>()) { item.SwapValueToMapRecord((IMapRecord)store[store.BinarySearch(item.Value)]); } #endif }
public static INode[] GetOptimizedNodes(IMapData Map, INode[] Nodes) { List <INode> positionList = new List <INode>(); INode start = Nodes[0]; INode lastChecked = start; positionList.Add(start); for (int i = 1; i < Nodes.Length; ++i) { INode curr = Nodes[i]; bool intersects = CheckIntersection(Map, start, curr); if (intersects) { positionList.Add(lastChecked); start = curr; } lastChecked = curr; } positionList.Add(lastChecked); return(positionList.ToArray()); }
/// <summary> /// Для удаления объекта разметки из записей ссылающихся на него /// </summary> static void RemoveRecordInfo <T>(IEnumerable <IMapRecordFull> lst, IMapData data, Func <string, IMapRecordFull> Getter) where T : IMapBaseItem { foreach (var item in new SortedSet <T>(data.Items.OfType <T>().ToArray(), MapBaseItemComparer <T> .Comparer)) { Getter(item.Value).Data.Remove(data); } }
public BuilderBuildHoverState(IObstacleInfo targetInfo, IMapData mapData, TilePosition targetPosition, NewAI aiBehavior) : base(mapData, targetPosition, aiBehavior, targetInfo) { ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>(); this.WalkVelocity = config.BuilderMoveVelocity; }
public BuilderBuildState(NewAI aiBehavior, IObstacleInfo targetInfo, IMapData mapData, TilePosition buildPosition) : base(aiBehavior) { this.m_TargetInfo = targetInfo; this.m_TargetPosition = this.m_TargetInfo.BuildingPosition; this.m_BuildPosition = buildPosition; this.m_MapData = mapData; }
public DeleteLayerController(IMapData mapData, IStatusTable statusTable, IMapLayerUpdateTopicClient topicClient) { _mapData = mapData; _statusTable = statusTable; _topicClient = topicClient; }
public void Construct(IMapData mapData, IMutableMapSectionData mutableMapSectionData, ILogger logger) { _mapData = mapData; _mapSectionData = mutableMapSectionData; _logger = logger; }
public LayerCacheRefreshService(IMapData mapData, IMapLayerUpdateSubscriptionClient subscriptionClient, ILogger <LayerCacheRefreshService> logger) { _mapData = mapData; _subscriptionClient = subscriptionClient; _logger = logger; }
private void RootOnMapLoaded(IMapData obj) { var x = (obj.Width - 1) / 2f; var z = (obj.Length - 1) / 2f; MinimapCamera.transform.localPosition = new Vector3(x, 50, z); MinimapCamera.orthographicSize = Mathf.Max(x, z); }
public Task SetLookAt(Vector2 position, IMapData mapData) { return(SyncContext.Execute(() => { mLookTarget = GameUtils.GetPosition(position, mapData); transform.rotation = Quaternion.LookRotation(mLookTarget.Value - transform.localPosition); })); }
public MaterialData(IMapData diffuse, IMapData normal, IMapData specular, Material mat) { diffuseMap = diffuse; normalMap = normal; specularMap = specular; material = mat; }
/// <summary> /// Удаляет размеченные данные из словарей /// </summary> /// <param name="data">Размеченные данные</param> static void RemoveMapInfo(IMapData data) { if (data.IsMapped) { RemoveRecordInfo <IMapValueItem>(_ValuesDictionary.OfType <IMapRecordFull>(), data, GetValueRecord); RemoveRecordInfo <IMapMethodItem>(_MethodsDictionary.OfType <IMapRecordFull>(), data, GetMethodRecord); } }
public AnimatedMaterialData(IMapData diffuse, IMapData normal, IMapData specular, IMapData emissive, Material mat) { diffuseMap = diffuse; normalMap = normal; specularMap = specular; emissiveMap = emissive; material = mat; }
// private static DocumentClient _client; /// <summary> /// Create a new GdalConversionService instance. /// </summary> /// <param name="logger">system logger</param> /// <param name="options">global options for the Map Server</param> /// <param name="mapdata">Map data layers</param> public GdalConversionService(ILogger <GdalConversionService> logger, Options options, IMapData mapdata) { _logger = logger; _mapdata = mapdata; _options = options; // var EndpointUrl = "https://localhost:8081"; // var AuthorisationKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="; // _client = new DocumentClient(new Uri(EndpointUrl), AuthorisationKey); }
//private BuildingBasePropertyBehavior m_TargetProperty; public KodoWalkState(IMapData mapData, TilePosition targetPosition, NewAI aiBehavior, GameObject target) : base(mapData, targetPosition, aiBehavior) { this.m_Target = target; this.WalkVelocity = this.CharacterAI.PropertyBehavior.MoveVelocity; this.m_HPBehavior = this.m_AIBehavior.gameObject.GetComponent<KodoHPBehavior>(); //this.m_TargetProperty = this.m_Target.GetComponent<BuildingBasePropertyBehavior>(); this.m_StateName = "KodoWalk"; }
/// <summary> /// Обновляет данные разметки /// </summary> /// <param name="data">Разметкп</param> /// <param name="ifChanged">Только если файл изменен</param> public static void UpdateData(IMapData data, bool ifChanged) { if (data != null && (!ifChanged || data.IsChanged) && _Data.Contains(data)) { RemoveMapInfo(data); data.Remap(ifChanged); AddMapInfo(data); } }
public Map(int width, int length) { var data = new float[width, length]; for (int i = 0; i < 20; i++) { var x = Random.Range(0, width); var y = Random.Range(0, length); var sizeX = Random.Range(5, 10) / 2; var sizeY = Random.Range(5, 10) / 2; for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) { for (int y1 = y - sizeY; y1 <= y + sizeY; y1++) { if (x1 < 0 || y1 < 0 || x1 >= width || y1 >= width) { continue; } var h = 1f; if ((x1 == x - sizeX || x1 == x + sizeX) && (y1 == y - sizeY || y1 == y + sizeY)) { h = 0.5f; } data[x1, y1] = h; } } } var objs = new MapObject[width, length]; for (int i = 0; i < 10; i++) { var x = Random.Range(0, width); var y = Random.Range(0, length); GenerateForest(x, y, objs, 0); } for (int i = 0; i < 20; i++) { var x = Random.Range(0, width - 1); var y = Random.Range(0, length - 1); if (objs[x, y] != MapObject.None) { i--; continue; } objs[x, y] = MapObject.Crystal; } Data = new MapData(width, length, data, objs); }
public TextureGenerator(IMapData mapData) { this.mapData = mapData; sizeX = mapData.Tiles.GetLength(0); sizeY = mapData.Tiles.GetLength(1); tileSizeX = (int)mapData.TileSize.x; tileSizeY = (int)mapData.TileSize.y; }
public GetLayerController(IMapData mapData, IResourceLinksGenerator resourceLinksGenerator, ITileStorage tileStorage, IStyleStorage styleStorage) { _mapData = mapData; _resourceLinksGenerator = resourceLinksGenerator; _tileStorage = tileStorage; _styleStorage = styleStorage; }
public LayerStyleService(IMapData mapData, ILogger <LayerStyleService> logger, IStyleStorage styleStorage, IWorkspaceStyleCache styleCache) { _styleStorage = styleStorage; _styleCache = styleCache; _mapData = mapData; _logger = logger; }
public void Construct(IInputLock inputLock, IMapData mapData, IReplayPlaybackManager playbackManager, ICommandHistorySaver commandHistorySaver) { _inputLock = inputLock; _mapData = mapData; _playbackManager = playbackManager; _commandHistorySaver = commandHistorySaver; Preconditions.CheckNotNull(_animator, _scrubSlider, _cancelReplayButton); }
public static NavigationResult GetPath(IMapData Map, INode StartNode, INode GoalNode) { Vector3[] path = CalculatePath(Map, StartNode, GoalNode); if (path == null) { return(null); } return(new NavigationResult(path, NavigationResult.Types.Complete)); }
private void MakeMap(IMapData mapData) { GameObject[] floor = GameObject.FindGameObjectsWithTag("Floor"); foreach (GameObject obj in floor) { GameObject.Destroy(obj); } GameObject[] end = GameObject.FindGameObjectsWithTag("Endpoint"); foreach (GameObject obj in end) { GameObject.Destroy(obj); } foreach (Vector3 pos in mapData.CubePos) { GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.tag = "Floor"; cube.name = "C" + pos.x + pos.y + pos.z; // 'C'ube cube.transform.position = pos; } for (int i = 0; i < mapData.SlopePos.Length; i++) { GameObject slope = makeSlope(); Vector3 pos = mapData.SlopePos[i]; slope.tag = "Floor"; slope.name = "S" + pos.x + pos.y + pos.z; // 'S'lope slope.transform.position = pos; slope.transform.rotation = mapData.SlopeRot[i]; } foreach (RotatingObject data in mapData.RotObj) { GameObject obj = GameObject.Find(data.name); if (obj == null) { continue; } Rotating script = obj.AddComponent <Rotating>() as Rotating; script.point = data.point; script.axis = data.axis; script.PlayerRot = data.playerRot; } { GameObject player = GameObject.Find("Player"); player.transform.position = new Vector3(mapData.PlayerStart.x, mapData.PlayerStart.y + 1, mapData.PlayerStart.z); // player.GetComponent <MoveCharacter>().Init(); } //关卡终点 { GameObject endpoint = (GameObject)Resources.Load("Prefabs/endpoint"); endpoint.transform.position = mapData.GameEnd; Object.Instantiate(endpoint); } }
public void Construct(IMapSectionContext mapSectionContext, IMapData mapData, IInputLock inputLock, LoadMapCommandData loadMapCommandData, ICommandQueue commandQueue) { _nextSectionButton.onClick.AddListener(HandleNextSectionButtonCLicked); _previousSectionButton.onClick.AddListener(HandlePreviousSectionButtonCLicked); _mapSectionContext = mapSectionContext; _loadMapCommandData = loadMapCommandData; _mapData = mapData; _inputLock = inputLock; _commandQueue = commandQueue; }
public static bool IsBuildingHover(this IObstacleInfo buildingInfo, IMapData mapData) { if(Application.loadedLevelName != ClientStringConstants.BUILDING_SCENE_LEVEL_NAME) { return false; } else { TilePosition buildingPosition = buildingInfo.GetBuildingFirstBuildingPosition(); return mapData.GetBuildingObjectFromBuildingObstacleMap(buildingPosition.Row, buildingPosition.Column) == null; } }
public LedgesLoader() { _mapData = DependencyInjection.Resolve<IMapData>(); }