public bool PlaceItemOnMap(InteractiveObject item, Vector2Int mapIndex, ObjectDir dir = ObjectDir.Horizontal) { GameObject obj = item.gameObject; bool accessible = true; if (IsMapIndexOutOfBound(mapIndex) || !mapNodes[mapIndex.x, mapIndex.y].IsEmpty()) { accessible = false; } if (accessible) { mapNodes[mapIndex.x, mapIndex.y].AddItemToNode(obj); gameObjectOnMapDictionary[obj] = true; obj.transform.parent = sceneRoot.transform; obj.transform.localPosition = MapIndexToWorldPos(mapIndex + new Vector2(1 / 2.0f, 1 / 2.0f)); if (dir == ObjectDir.Vertical && !item.objectMetadata.fixDir) { obj.transform.localPosition = MapIndexToWorldPos(mapIndex + new Vector2(1 / 2.0f, 1 / 2.0f)); } if (item.objectMetadata.fixDir) { obj.transform.localRotation = Quaternion.identity; } item.posOnMap = mapIndex; } return(accessible); }
public bool Compile(Configuration solutionConfiguration) { ConfigurationBase projectConfig = BuildConfigurations[solutionConfiguration]; if (projectConfig == null) { Log(Level.Info, "Skipping '{0}' [{1}] ...", Name, solutionConfiguration); return(true); } Log(Level.Info, "Building '{0}' [{1}] ...", Name, projectConfig.Name); // ensure project-level object directory exists, no need to do this // for the project-level output directory as we already this before if (!ObjectDir.Exists) { ObjectDir.Create(); ObjectDir.Refresh(); } // build the project BuildResult result = Build(solutionConfiguration); return(result != BuildResult.Failed); }
public string GenerateCompilerArgs(string outName, IEnumerable <string> filepaths) { var sb = new StringBuilder(); if (IsDebug) { sb.Append("/Zi "); } else { sb.Append("/O2 /GL "); } if (ObjectDir != null) { var objDir = ObjectDir.TrimEnd('\\'); sb.AppendFormat("/Fo\"{0}\\{1}.obj\" ", objDir, outName); } if (ExecutableDir != null) { var exeDir = ExecutableDir.TrimEnd('\\'); sb.AppendFormat("/Fe\"{0}\\{1}.exe\" ", exeDir, outName); } foreach (var include in IncludeDirs) { var incDir = include.TrimEnd('\\'); sb.AppendFormat("/I\"{0}\" ", incDir); } foreach (var filepath in filepaths) { sb.AppendFormat("\"{0}\" ", filepath); } return(sb.ToString()); }
public bool CanPlaceItemOnMap(InteractiveObject item) { ObjectDir dir = item.GetItemDirection(); Vector2Int pos = GeItemMapPosition(item); if (IsBlocked(pos)) { return(false); } return(true); }
public Vector2Int GeItemMapPosition(InteractiveObject item) { if (item == null) { return(new Vector2Int(int.MinValue, int.MinValue)); } ObjectDir itemDirection = item.GetItemDirection(); Vector2Int index = MapManager.Instance.WorldPosToMapIndex(item.transform.position); index -= new Vector2Int(1 / 2, 1 / 2); return(index); }
private bool TryPlaceItemOnMap(Player actor) { if (!CanPlaceItemOnMap(actor)) { return(false); } Vector2Int itemPos = MapManager.Instance.GeItemMapPosition(this); ObjectDir itemDirection = GetItemDirection(); actor.UnsetCarryingItem(); actor.SetPlayerActionState(EPlayerActionState.IDLE); MapManager.Instance.PlaceItemOnMap(this, itemPos, itemDirection); if (callbacks.OnPlacedOnMap != null) { callbacks.OnPlacedOnMap(); } return(true); }