public static void TerrainToFile(LayerManager layerManager, List<Layer> layers, string filename) { using (StreamWriter sw = new StreamWriter(filename)) { sw.Write(TerrainToString(layerManager, layers)); } }
public static string TerrainToString(LayerManager lm, List<Layer> layers) { StringBuilder sb = new StringBuilder(); int x_min = lm.lt.globalTerrainC.definedArea.botLeft.x; int z_min = lm.lt.globalTerrainC.definedArea.botLeft.x; int x_max = lm.lt.globalTerrainC.definedArea.topRight.x; int z_max = lm.lt.globalTerrainC.definedArea.topRight.z; //Debug.Log(lm.rg.lt.tg.scaleTerrain); for (int x = x_min; x< x_max; x++) { for (int z = z_min; z < z_max; z++) { sb.Append(string.Format("v {0} {1} {2}\n", x, lm.GetValueFromLayers(x, z, layers) * lm.rg.lt.tg.scaleTerrain.y, z)); } } sb.Append("\n"); int w = x_max - x_min; //width int h = z_max - z_min; //height for (int x = 0; x < w - 1; x++) { for (int z = 0; z < h - 1; z++) { sb.Append(string.Format("f {0} {1} {2} {3}\n", x*h+z+1, x*h+z+2, x*h+h+z+2, x*h+h+z+1)); } } return sb.ToString(); }
public void AssignFunctions() { localTerrain.AssignFunctions(globalTerrain.globalTerrainC, terrainGenerator, filterGenerator, riverGenerator, erosionGenerator); terrainGenerator.AssignFunctions(globalTerrain, localTerrain, filterGenerator, functionMathCalculator, riverGenerator, gridManager, guiManager, erosionGenerator); filterGenerator.AssignFunctions(functionMathCalculator, localTerrain, functionTerrainManager); riverGenerator.AssignFunctions(functionTerrainManager, functionRiverPlanner, functionDebugger, functionMathCalculator, functionRiverDigger, guiManager.river); functionDebugger.AssignFunctions(riverGenerator); functionRiverDigger.AssignFunctions(riverGenerator); functionRiverPlanner.AssignFunctions(riverGenerator); functionMathCalculator.AssignFunctions(localTerrain); functionTerrainManager.AssignFunctions(localTerrain, functionMathCalculator, riverGenerator, layerManager); layerManager.AssignFunctions(terrainGenerator, filterGenerator, riverGenerator, erosionGenerator); erosionGenerator.AssignFunctions(functionTerrainManager); layerManager = localTerrain.lm; }
public static void do_test(DbgGUI window, string[] args) { if (args.Length < 1) { Console.WriteLine("Usage:\n index - clear the db and index email\n search - perform search tests"); Environment.Exit(1); } if (args[0].CompareTo("index") == 0) { LayerManager db = new LayerManager(InitMode.NEW_REGION, DB_PATH ); db.startMaintThread(); PsudoEmailInjector injector = new PsudoEmailInjector(db, window); injector.parse_email_messages(); injector.indexer.find_email_test(); } else if (args[0].CompareTo("search") == 0) { LayerManager db = new LayerManager(InitMode.RESUME, DB_PATH); PsudoEmailInjector injector = new PsudoEmailInjector(db, window); window.debugDump(db); injector.indexer.find_email_test(); } else if (args[0].CompareTo("merge") == 0) { LayerManager db = new LayerManager(InitMode.RESUME, DB_PATH); window.debugDump(db); // merge... for (int x = 0; x < 30; x++) { var mc = db.rangemapmgr.mergeManager.getBestCandidate(); window.debugDump(db, mc); if (mc == null) { Console.WriteLine("no more merge candidates."); break; } db.performMerge(mc); window.debugDump(db); } } else if (args[0].CompareTo("test") == 0) { LayerManager db = new LayerManager(InitMode.RESUME, DB_PATH); window.debugDump(db); var key1 = new RecordKey() .appendParsedKey(@".zdata/index/which/c:\EmailTest\Data\Sent:5441/10"); var key2 = new RecordKey() .appendParsedKey(@".zdata/index/zzn/c:\EmailTest\Data\saved_mail_2003:4962/385"); var segkey = new RecordKey() .appendParsedKey(".ROOT/GEN") .appendKeyPart(new RecordKeyType_Long(1)) .appendKeyPart(key1) .appendKeyPart(key2); var nextrow = db.FindNext(segkey, false); Console.WriteLine("next: {0}", nextrow); var exactRow = db.FindNext(nextrow.Key, true); Console.WriteLine("refind: {0}", exactRow); } Console.WriteLine("done...."); Environment.Exit(0); }
public TransportPolylineLayer(LayerManager lm, Config config) { this._layerType = LayerType.PolylineCanvas; this.Visible = this.Changed = true; polylines = new List<IShape>(); this.layermanager = lm; this.commentFont = new Font("Arial", 10, FontStyle.Regular); this.config = config; lm.GetMainControler().SettingsLoaded += new MainControler.SettingsLoadedDelegate(TransportPolylineLayer_SettingsLoaded); }
public static void Init() { if(layerManager==null){ GameObject obj=new GameObject(); obj.name="LayerManager"; layerManager=obj.AddComponent<LayerManager>(); //Debug.Log("init "+layerManager); } }
void Awake() { layerManager=this; #if UNITY_EDITOR GameControl gameControl=gameObject.GetComponent<GameControl>(); if(gameControl!=null){ gameControl.layerManager=this; } #endif }
public TransportPolygonLayer(LayerManager lm, Config config) { this._layerType = LayerType.PolygonCanvas; this.Changed = this.Visible = true; polygons = new List<IShape>(); this.layermanager = lm; this.config = config; lm.GetMainControler().SettingsLoaded +=new MainControler.SettingsLoadedDelegate(TransportPolygonLayer_SettingsLoaded); }
public RemoveGeometryAction(ShpPoint shapeToRemove, IShape container, LayerManager layerManager) { this.layerManager = layerManager; this.d.x = this.layerManager.GetMainControler().MapPanel.DX; this.d.y = this.layerManager.GetMainControler().MapPanel.DY; this.scale = layerManager.Scale; this.shapeToDelete = shapeToRemove; this.container = container; this.pointSize = 2; deletedPoint.x = shapeToDelete.RootX; deletedPoint.y = shapeToDelete.RootY; }
public LocalTerrain(int terrainWidth, int terrainHeight, int stepSize, GlobalTerrain globalTerrain, LayerManager layerManager) { gt = globalTerrain; gt.lt = this; lm = layerManager; localTerrainC = new LocalCoordinates(new Vector3(0, 0, 0), terrainWidth, terrainHeight); //visibleTerrain = new float[terrainHeight, terrainWidth]; this.terrainHeight = terrainHeight; this.terrainWidth = terrainWidth; this.stepSize = stepSize; }
public ShapeObject(LayerManager layerManager, String filePath) { this.layerManager = layerManager; this.filePath = filePath; this.fileName = filePath.Split('\\')[filePath.Split('\\').Length-1]; this.access = "rb"; this.shapePen = new Pen(layerManager.GetRandomColor(), 1.0f); int i = filePath.LastIndexOf("\\"); name = filePath.Substring(i + 1, filePath.LastIndexOf(".") - i - 1); }
/// <summary> /// Moves a certain Transport to a certain position /// </summary> /// <param name="selectedTransportShape"></param> /// <param name="unscaledDifference"></param> /// <param name="pointSize"></param> /// <param name="scale"></param> /// <param name="d"></param> /// <param name="mapPanel"></param> //public MoveTransportShapeAction(Point newM, Point oldM,Point dragStartPoint,int pointSize,double scale,MapPanel mapPanel) //{ // this.mapPanelDiff[0] = (newM.X - dragStartPoint.X); // this.mapPanelDiff[1] = (newM.Y - dragStartPoint.Y); // this.mapPanel = mapPanel; // this.d.x = mapPanel.DX; // this.d.y = mapPanel.DY; // this.pointSize = pointSize; // this.scale = scale; // this.newM = newM; // this.oldM = oldM; // this.this.selshpInfo.iShapeInf = mapPanel.SelectedTransportShape; //} public MoveIShapeAction(IShape shapeToMove, Point m, Point dragStartPoint, int pointSize, double scale, LayerManager layerManager) { this.mapPanelDiff[0] = (m.X - dragStartPoint.X); this.mapPanelDiff[1] = (m.Y - dragStartPoint.Y); this.layerManager = layerManager; this.d.x = this.layerManager.GetMainControler().MapPanel.DX; this.d.y = this.layerManager.GetMainControler().MapPanel.DY; this.pointSize = pointSize; this.scale = scale; this.m = m; this.selShpInfo.iShapeInf = shapeToMove; this.selShpInfo.quadTreePosItemInf = selShpInfo.iShapeInf.Reference; this.dragStartPoint = dragStartPoint; }
/// <summary> /// Moves a certain Transport to a certain position /// </summary> /// <param name="selectedTransportShape"></param> /// <param name="unscaledDifference"></param> /// <param name="pointSize"></param> /// <param name="scale"></param> /// <param name="d"></param> /// <param name="mapPanel"></param> //public MoveTransportShapeAction(Point newM, Point oldM,Point dragStartPoint,int pointSize,double scale,MapPanel mapPanel) //{ // this.mapPanelDiff[0] = (newM.X - dragStartPoint.X); // this.mapPanelDiff[1] = (newM.Y - dragStartPoint.Y); // this.mapPanel = mapPanel; // this.d.x = mapPanel.DX; // this.d.y = mapPanel.DY; // this.pointSize = pointSize; // this.scale = scale; // this.newM = newM; // this.oldM = oldM; // this.this.selshpInfo.iShapeInf = mapPanel.SelectedTransportShape; //} public MoveCommentAction(Point m, Point dragStartPoint, int pointSize, double scale, LayerManager layerManager) { this.mapPanelDiff[0] = (m.X - dragStartPoint.X); this.mapPanelDiff[1] = (m.Y - dragStartPoint.Y); this.layerManager = layerManager; this.d.x = this.layerManager.GetMainControler().MapPanel.DX; this.d.y = this.layerManager.GetMainControler().MapPanel.DY; this.pointSize = pointSize; this.scale = scale; this.m = m; this.selShpInfo.iShapeInf = layerManager.GetMainControler().MapPanel.SelectedTransportShape; this.selShpInfo.quadTreePosItemInf = layerManager.SelectedTransportQuadtreeItem; this.dragStartPoint = dragStartPoint; }
public ImageLayer(LayerManager lm, GravurGIS.MapPanelBindings.ImageLayerInfo info, string name, string path) { this.Description = "Rasterbild"; this._layerType = LayerType.Image; this.Visible = true; this.Changed = true; this.layerID = info.id; this._boundingBox = new GravurGIS.Topology.WorldBoundingBoxD(info.minBX, info.maxBY, info.maxBX, info.minBY); this.LayerName = name; this.layerInfo = new LayerInfo(path + "\\" + name); this.layermanager = lm; this.resolution = new double[2]; this.resolution[0] = info.resolutionX; this.resolution[1] = info.resolutionY; }
// Use this for initialization void Start () { // Instantiate internal managers gui = gameObject.AddComponent<GUIManager>(); musicManager = (GameObject) Instantiate(Resources.Load(ResourcePaths.musicManager), Vector3.zero, Quaternion.identity); musicManager.transform.SetParent(transform); soundManager = (GameObject) Instantiate(Resources.Load(ResourcePaths.soundManager), Vector3.zero, Quaternion.identity); soundManager.transform.SetParent(transform); music = musicManager.GetComponent<MusicManager>(); sound = soundManager.GetComponent<SoundManager>(); objects = gameObject.AddComponent<ObjectManager>(); levels = gameObject.AddComponent<LevelGenerator>(); art = gameObject.GetComponent<LayerManager>(); reactionTable = new ReactionTable(); if(layerTracks.Length > 0) { music.clips = layerTracks; } //Find camera if not explicitly done in the Editor (this is a failsafe.. shouldn't rely on this) if (!mainCamera) { mainCamera = GameObject.Find("Main Camera"); } // Start first level state = GameState.loading; PopulateReactionTable(); //This is just so the old "Gameplay" scene doesn't break #pragma warning disable 0618 // Type or member is obsolete if(Application.loadedLevelName == "Gameplay") { worldProperties = gameObject.AddComponent<WorldProperties>(); levels.CreateSampleLevel(); // Set the camera to follow the game's player mainCamera.GetComponent<CameraFollow>().SetPlayer(ref worldProperties.player); } #pragma warning restore 0618 // Type or member is obsolete }
float T = 0.1f; //delta time #endregion Fields #region Constructors public HydraulicErosion(ErosionGenerator erosionGenerator) { eg = erosionGenerator; lm = eg.lt.lm; hydraulicErosionMap = new GlobalCoordinates(100); sedimentMap = new GlobalCoordinates(100); waterMap = new GlobalCoordinates(100); stepMap = new GlobalCoordinates(100); //inflowMap = new GlobalCoordinates(100); outflowTop = new GlobalCoordinates(100); outflowRight = new GlobalCoordinates(100); outflowBot = new GlobalCoordinates(100); outflowLeft = new GlobalCoordinates(100); velocityX = new GlobalCoordinates(100); velocityZ = new GlobalCoordinates(100); erosionEffect = new HashSet<Vertex>(); outflowField = new HashSet<Vertex>(); noWater = new HashSet<Vertex>(); }
public ShapeObject(LayerManager layerManager, String filePath) { this._layerType = LayerType.Shape; this.Description = "ESRI Shapedatei"; this.Changed = this.Visible = true; this.layerManager = layerManager; this.LayerInfo = new LayerInfo(filePath); this.access = "rb"; Color tempColor = layerManager.NewLayerStyle.NewColor; this.vectorInfo = new VectorInfo(tempColor,Color.White,new Pen(tempColor,1.0f)); this.m_filePath = System.IO.Path.GetDirectoryName(filePath); this.m_fileName = System.IO.Path.GetFileNameWithoutExtension(filePath); int i = filePath.LastIndexOf("\\"); this.LayerName = filePath.Substring(i + 1, filePath.LastIndexOf(".") - i - 1); // new InmageAttributes imageAttributes = new ImageAttributes(); imageAttributes.SetColorKey(Color.NavajoWhite, Color.NavajoWhite); bitmap = new Bitmap(1, 1, PixelFormat.Format16bppRgb555); }
public void Delete() { LayerManager.DeleteLayer(this); }
public GazeAdornment(Microsoft.VisualStudio.Text.Editor.IWpfTextView view) { var componentModel = (Microsoft.VisualStudio.ComponentModelHost.IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(Microsoft.VisualStudio.ComponentModelHost.SComponentModel)); Workspace = componentModel.GetService <Microsoft.VisualStudio.LanguageServices.VisualStudioWorkspace>(); View = view; LayerManager = GazeLayerManager.Get(view); LayerManager.SingletonLayers = new System.Collections.Generic.List <GazeResponseLayer>() { new EllipseInformationalGazeLayerElement(View, Brushes.Red, 5, 5), // show a 5x5 core target that is the discrete X,Y coordinates new EllipseInformationalGazeLayerElement(View, Brushes.Cyan, 100, 100), // show a 100x100 extended target that is the scan area for the gaze targeting system }; EyeTracking.PointAvailable += (sender, e) => Stabilization.AddPoint(e); Stabilization.StabilizedPointAvailable += (sender, e) => { if (_inFlight) { return; } _inFlight = true; // workflow goes here, point should be stabilized coming from point provider try { if (View.VisualElement.Dispatcher.Invoke(() => (View.VisualElement.ActualHeight == 0 || !View.VisualElement.IsInitialized || !View.VisualElement.IsLoaded))) { _inFlight = false; return; // gaze point available before WPF draw is finished } // localize point to our editor view var localPt = View.VisualElement.Dispatcher.Invoke(() => View.VisualElement.PointFromScreen(e)); localPt.X += View.ViewportLeft; localPt.Y += View.ViewportTop; // infer/guess gaze targets var gazedElements = GazeTargeting.GetTargetCandidateTokens(View, Workspace, localPt.X, localPt.Y); // draw singleton layers (coordinate-based) LayerManager.DrawSingletonLayers(localPt.X, localPt.Y); // draw highlights around gazed elements LayerManager.ScrubLayers(); foreach (GazeTarget element in gazedElements.OrderByDescending(el => el.Weight)) { var span = new SnapshotSpan(View.TextSnapshot, element.DefinitionLocation.Start, element.DefinitionLocation.Length); if (!LayerManager.IsTracking(span)) { // gradate opacity of the debug layer based on target weights (on green) LayerManager.Layers.Add(new TextHighlightInformationalGazeLayerElement(View, span, element.Weight)); } var model = EditTimeVisualizerModel.Create(element); if (model != null && model.IsValid) { LayerManager.Layers.Add(new EditTimeVisualizationLayer(View, span, model)); } } LayerManager.Draw(); } catch (Exception ex) { } _inFlight = false; }; }
public virtual void Down(RenderTexture targetTexture, PaintParameters parameters, LayerManager layers) { }
public static _TileStatus CheckBuildPoint(Vector3 pointer, int footprint) { footprint = -1; //if(currentBuildInfo!=null) return false; _TileStatus status = _TileStatus.Available; BuildableInfo buildableInfo = new BuildableInfo(); //layerMask for platform only LayerMask maskPlatform = 1 << LayerManager.LayerPlatform(); //layerMask for detect all collider within buildPoint LayerMask maskAll = 1 << LayerManager.LayerPlatform(); int terrainLayer = LayerManager.LayerTerrain(); if (terrainLayer >= 0) { maskAll |= 1 << terrainLayer; } Ray ray = Camera.main.ScreenPointToRay(pointer); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, maskPlatform)) { for (int i = 0; i < buildManager.buildPlatforms.Length; i++) { Transform basePlane = buildManager.platforms[i]; if (hit.transform == basePlane) { //calculating the build center point base on the input position Vector3 pos = GetTilePos(basePlane, hit.point); //check if the position is blocked, by any other obstabcle other than the baseplane itself Collider[] cols = Physics.OverlapSphere(pos, _gridSize / 2 * 0.9f + footprint * _gridSize, ~maskAll); if (cols.Length > 0) { //Debug.Log("something's in the way "+cols[0]); return(_TileStatus.Unavailable); } else { //confirm that we can build here buildableInfo.buildable = true; buildableInfo.position = pos; buildableInfo.platform = buildManager.buildPlatforms[i]; //Debug.Log(buildableInfo.platform+" !!! "+buildManager.buildPlatforms[i]); } //check if the platform is walkable, if so, check if building on the point wont block all possible path if (buildManager.buildPlatforms[i].IsWalkable()) { //return true is the platform is not block if (buildManager.buildPlatforms[i].CheckForBlock(pos, footprint)) { //Debug.Log("all path is blocked "+Time.time); status = _TileStatus.Blocked; } } //~ buildableInfo.buildableType=buildManager.buildPlatforms[i].buildableType; //~ buildableInfo.specialBuildableID=buildManager.buildPlatforms[i].specialBuildableID; if (status == _TileStatus.Blocked) { List <TowerAvailability> tempList = new List <TowerAvailability>(); for (int n = 0; n < buildManager.buildPlatforms[i].towerAvaiList.Count; n++) { UnitTower tower = GetTower(buildManager.buildPlatforms[i].towerAvaiList[n].ID); if (tower.type == _TowerType.Mine) { tempList.Add(buildManager.buildPlatforms[i].towerAvaiList[n]); } } buildableInfo.towerAvaiList = tempList; } else { buildableInfo.towerAvaiList = buildManager.buildPlatforms[i].towerAvaiList; } break; } } } else { return(_TileStatus.NoPlatform); } currentBuildInfo = buildableInfo; if (buildManager.tileIndicatorMode != _TileIndicatorMode.None) { Utility.SetActive(indicator, true); indicator.transform.position = currentBuildInfo.position; if (currentBuildInfo.platform != null) { indicator.transform.rotation = currentBuildInfo.platform.thisT.rotation; } } return(status); }
// Use this for initialization void InitPlatform() { if (autoSearchForPlatform) { LayerMask mask = 1 << LayerManager.LayerPlatform(); Collider[] platformCols = Physics.OverlapSphere(Vector3.zero, Mathf.Infinity, mask); platforms = new Transform[platformCols.Length]; for (int j = 0; j < platformCols.Length; j++) { platforms[j] = platformCols[j].transform; } } buildPlatforms = new PlatformTD[platforms.Length]; int i = 0; foreach (Transform basePlane in platforms) { //clear the platform of any unneeded collider ClearPlatformColliderRecursively(basePlane); //if the platform object havent got a platform componet on it, assign it PlatformTD platform = basePlane.gameObject.GetComponent <PlatformTD>(); if (platform == null) { platform = basePlane.gameObject.AddComponent <PlatformTD>(); //~ platform.buildableType=new _TowerType[7]; //~ //by default, all tower type is builidable //~ platform.buildableType[0]=_TowerType.TurretTower; //~ platform.buildableType[1]=_TowerType.AOETower; //~ platform.buildableType[2]=_TowerType.DirectionalAOETower; //~ platform.buildableType[3]=_TowerType.SupportTower; //~ platform.buildableType[4]=_TowerType.ResourceTower; //~ platform.buildableType[5]=_TowerType.Mine; //~ platform.buildableType[6]=_TowerType.Block; } buildPlatforms[i] = platform; buildPlatforms[i].InitTowerList(towerAvaiList); //make sure the plane is perfectly horizontal, rotation around the y-axis is presreved basePlane.eulerAngles = new Vector3(0, basePlane.rotation.eulerAngles.y, 0); //adjusting the scale float scaleX = Mathf.Floor(UnitUtility.GetWorldScale(basePlane).x *10 / gridSize) * gridSize * 0.1f; float scaleZ = Mathf.Floor(UnitUtility.GetWorldScale(basePlane).z *10 / gridSize) * gridSize * 0.1f; if (scaleX == 0) { scaleX = gridSize * 0.1f; } if (scaleZ == 0) { scaleZ = gridSize * 0.1f; } basePlane.localScale = new Vector3(scaleX, 1, scaleZ); //adjusting the texture if (AutoAdjustTextureToGrid) { Material mat = basePlane.renderer.material; float x = (UnitUtility.GetWorldScale(basePlane).x *10f) / gridSize; float z = (UnitUtility.GetWorldScale(basePlane).z *10f) / gridSize; mat.mainTextureOffset = new Vector2(0.5f, 0.5f); mat.mainTextureScale = new Vector2(x, z); } //get the platform component, if any //Platform p=basePlane.gameObject.GetComponent<Platform>(); //buildPlatforms[i]=new BuildPlatform(basePlane, p); i++; } }
public HydraulicErosionLayer(LayerManager layerManager, TerrainEngine terrainEngine) : base(layerManager, terrainEngine) { hydraulicErosion = new HydraulicErosionAlgorithm(); InitProperties(); }
void Start() { guiManager = GameObject.Find("GUI").GetComponent<GUIManager>(); terrainWidth = 100; terrainHeight = terrainWidth; try { GUIterrainPlannerMenu tpMenu = GameObject.Find("TerrainPlanner").GetComponent<GUIterrainPlannerMenu>(); patchSize = tpMenu.patch.patchSize; } catch (Exception e) { Debug.Log("TerrainPlanner not found"); patchSize = 64; } cameraMovement camera = transform.GetComponent<cameraMovement>(); camera.ChangePosition(new Vector3(0, 100, 0)); camera.ChangeRotation(new Vector3(90, 0, 0)); scaleTerrainY = 12; int quadrantSize = Math.Max(terrainWidth, terrainHeight); layerManager = new LayerManager(); globalTerrain = new GlobalTerrain(quadrantSize); localTerrain = new LocalTerrain(terrainWidth, terrainHeight, 30, globalTerrain, layerManager); filterGenerator = new FilterGenerator(quadrantSize, localTerrain); functionMathCalculator = new FunctionMathCalculator(); functionDebugger = new FunctionDebugger(); functionRiverDigger = new FunctionRiverDigger(); functionRiverPlanner = new FunctionRiverPlanner(); functionTerrainManager = new FunctionTerrainManager(); terrainGenerator = new TerrainGenerator(patchSize); riverGenerator = new RiverGenerator(localTerrain); erosionGenerator = new ErosionGenerator(localTerrain); gridManager = new GridManager(new Vector3(0,0,0), patchSize, patchSize); AssignFunctions(); terrainGenerator.initialize(scaleTerrainY); localTerrain.UpdateVisibleTerrain(new Vector3(0, 0, 0), false); }
public PhysicsDemoComponent() { game = LayerManager.NameToLayer("physics"); }
public static LayerManager MakeTemp(GraphicsDevice graphicsDevice, ContentManager content) { LayerManager result = new LayerManager(graphicsDevice, content); //bottom right result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 0, 0); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 25, 25); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 50, 50); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 75, 75); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 125, 125); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 150, 150); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 175, 175); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 200, 200); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 250, 250); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 300, 300); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 350, 350); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 400, 400); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 450, 450); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 500, 500); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 550, 550); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 600, 600); //top right result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 0, 0); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 25, -25); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 50, -50); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 75, -75); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 125, -125); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 150, -150); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 175, -175); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 200, -200); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 250, -250); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 300, -300); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 350, -350); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 400, -400); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), 450, -450); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), 500, -500); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 550, -550); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), 600, -600); //bottom left result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 0, 0); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -25, 25); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -50, 50); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -75, 75); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -125, 125); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -150, 150); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), -175, 175); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -200, 200); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), -250, 250); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -300, 300); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -350, 350); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -400, 400); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -450, 450); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -500, 500); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), -550, 550); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -600, 600); //top left result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), 0, 0); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -25, -25); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -50, -50); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -75, -75); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -125, -125); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -150, -150); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), -175, -175); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -200, -200); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), -250, -250); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -300, -300); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -350, -350); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -400, -400); result.GetLayer(1).AddStaticSprite(content.Load <Texture2D>("Layer1"), -450, -450); result.GetLayer(2).AddStaticSprite(content.Load <Texture2D>("Layer2"), -500, -500); result.GetLayer(0).AddStaticSprite(content.Load <Texture2D>("Layer0"), -550, -550); result.GetLayer(-1).AddStaticSprite(content.Load <Texture2D>("Layer-1"), -600, -600); return(result); }
void Awake() { lm = this; }
void OnEnable() { targetObject = (LayerManager)target; }
private void LayerIsSelectedChanged(ILayer layer) { Layerage layerage = LayerManager.FindFirstLayerage(layer); this.MethodViewModel.MethodSelectedNot(layerage); // Method }
public void Init(Team team) { enemyLayer = LayerManager.GetEnemyLayer(team); }
public FinishDrawingAction(LayerType layerType,LayerManager layerManager) { this.layerType = layerType; this.layerManager = layerManager; this.shpInfo = layerManager.getDrawShapeInformation(); }
void Start() { controller = gameObject.transform.parent.GetComponent <ViveController> (); layerManager = GameObject.FindObjectOfType <LayerManager> (); }
public static GameObject[] CreatePlayer(Vector3 position, BasicCamera cam) { Mesh mouseTargetModel = MeshLoader.FileToMesh("assets/models/sphere_smooth.obj"); GameObject mouseTarget = new GameObject(Vector3.UnitY * -3, "BG"); mouseTarget.Scale = new Vector3(1, 1, 1); mouseTarget.AddComponent(new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, mouseTargetModel, Prefabs.White, 1)); Mesh playerModel = MeshLoader.FileToMesh("assets/models/sphere_smooth.obj"); Mesh headModel = MeshLoader.FileToMesh("assets/models/cube_flat.obj"); Mesh bullet = MeshLoader.FileToMesh("assets/models/cube_flat.obj"); GameObject player = new GameObject(new Vector3(0, 10, 0), "Player"); GameObject playerH = new GameObject(new Vector3(0, 10, 0), "PlayerHead"); GameObject lightS = new GameObject(Vector3.UnitY * 2f, "Light"); playerH.Add(lightS); lightS.AddComponent(new LightComponent() { AmbientContribution = 0f }); lightS.LocalPosition = Vector3.UnitY * 14f; //Movement for camera OffsetConstraint cameraController = new OffsetConstraint { Damping = 0, MoveSpeed = 2 }; cameraController.Attach(player, new Vector3(0, 15, 5)); cam.AddComponent(cameraController); //Rotation for Player Head depending on mouse position cam.AddComponent(new CameraRaycaster(mouseTarget, playerH)); //Movement for Player Head OffsetConstraint connection = new OffsetConstraint() { Damping = 0, //Directly over the moving collider, no inertia MoveSpeed = 20, //Even less inertia by moving faster in general }; connection.Attach(player, Vector3.UnitY * 1); playerH.AddComponent(connection); playerH.Scale = new Vector3(0.6f); playerH.AddComponent(new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, headModel, TextureLoader.FileToTexture("assets/textures/playerHead.png"), 1)); //Player Setup Collider collider = new Collider(new Sphere(Vector3.Zero, 1, 10), LayerManager.NameToLayer("physics")); collider.PhysicsCollider.PositionUpdateMode = PositionUpdateMode.Continuous; collider.PhysicsCollider.Material = new Material(1.5f, 1.5f, 0); collider.PhysicsCollider.LinearDamping = 0.99f; player.AddComponent(collider); player.AddComponent(new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, playerModel, TextureGenerator.GetPlayerTexture(), 1)); AudioSourceComponent source = new AudioSourceComponent(); AudioLoader.TryLoad("assets/audio/ShootSound.wav", out ShootSound); AudioLoader.TryLoad("assets/audio/ShootSound2.wav", out ShootSound2); AudioLoader.TryLoad("assets/audio/SpawnSound.wav", out SpawnSound); AudioLoader.TryLoad("assets/audio/JumpSound.wav", out JumpSound); source.Clip = SpawnSound; source.Play(); source.UpdatePosition = false; source.Gain = 0.5f; player.AddComponent(source); player.AddComponent(new PlayerController(playerH, bullet, TextureLoader.ColorToTexture(Color.Red), DefaultFilepaths.DefaultLitShader, 650, false, source)); player.LocalPosition = position; GameObject playerUI = new GameObject("PlayerHUD"); playerUI.AddComponent(new PlayerHUD()); return(new[] { player, playerH, playerUI }); }
public ShowLayerSelectionCommand(LayerManager layerManager) { _layerManager = layerManager; }
protected override void InitializeScene() { Add(DebugConsoleComponent.CreateConsole()); BasicCamera inPicCam = new BasicCamera( Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(75f), GameEngine.Instance.Width / (float)GameEngine.Instance.Height, 0.01f, 1000f), Vector3.Zero); inPicCam.Rotate(Vector3.UnitX, MathHelper.DegreesToRadians(-90f)); inPicCam.Translate(Vector3.UnitY * 25); Add(inPicCam); splitCam = new RenderTarget(inPicCam, 1, Color.FromArgb(0, 0, 0, 0)) { MergeType = RenderTargetMergeType.Additive, ViewPort = new Rectangle(0, 0, (int)(GameEngine.Instance.Width * 0.3f), (int)(GameEngine.Instance.Height * 0.3f)) }; GameEngine.Instance.AddRenderTarget(splitCam); BasicCamera bc = new BasicCamera( Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(75), 16 / 9f, 0.1f, 1000f), new Vector3(0, 5, 30)); //Creating a Basic Camera SetCamera(bc); Add(bc); //Creating a Box that is meant to fall down on the kinetic box GameObject box = new GameObject(Vector3.UnitZ * -3 + Vector3.UnitY * 2, "Box"); LitMeshRendererComponent lmr = new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, Prefabs.Cube, TextureLoader.ColorToTexture(Color.Red), 1); box.AddComponent(lmr); Add(box); //Creating a Kinetic Box that will rotate slowly GameObject kinetic = new GameObject(Vector3.UnitZ * -3 + Vector3.UnitY * -2, "Box"); LitMeshRendererComponent kineticlmr = new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, Prefabs.Cube, TextureLoader.ColorToTexture(Color.Green), 1); kinetic.AddComponent(kineticlmr); kinetic.AddComponent(new RotateSelfComponent()); Add(kinetic); //A Large sphere that will act as a ground GameObject ground = new GameObject(Vector3.UnitZ * -3 + Vector3.UnitY * -1, "Box"); LitMeshRendererComponent groundlmr = new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, Prefabs.Sphere, TextureLoader.ColorToTexture(Color.Blue), 1); ground.AddComponent(groundlmr); Add(ground); ground.Scale = new Vector3(20, 20, 20); ground.LocalPosition = Physics.BEPUutilities.Vector3.UnitY * -25; //Creating the Collider Shapes Entity boxShape = new Box( Physics.BEPUutilities.Vector3.Zero, 2f, 2f, 2f, 1f); Entity kineticShape = new Box( Physics.BEPUutilities.Vector3.Zero, 2f, 2f, 2f, 1f); Entity groundShape = new Sphere( Vector3.Zero, 20f); //Note: Not specifying the mass when creating makes the shape a static shape that is really cheap computatinally //Ground(Sphere) and the falling box is going to have 0 friction and maximum bounciness. Material groundPhysicsMaterial = new Material(0, 0, 1f); Material boxPhysicsMaterial = new Material(0, 0, 1f); //Creating A physics layer to be able to control which objects are meant to collide with each other int physicsLayerID = LayerManager.RegisterLayer("physics", new Layer(1, 1)); //Creating the Components for the Physics Engine //Note: There are different ways to get the LayerID than storing it. Collider boxCollider = new Collider(boxShape, physicsLayerID); Collider groundCollider = new Collider(groundShape, "physics"); Collider kineticCollider = new Collider(kineticShape, LayerManager.LayerToName(physicsLayerID)); //Final Collider Setup //Kinetic becomes Kinetic kineticCollider.PhysicsCollider.BecomeKinematic(); //Adding the Physics Materials boxCollider.PhysicsCollider.Material = boxPhysicsMaterial; groundCollider.PhysicsCollider.Material = groundPhysicsMaterial; //Adding the Components box.AddComponent(boxCollider); kinetic.AddComponent(kineticCollider); ground.AddComponent(groundCollider); //Making the Camera LookAt the origin bc.LookAt(Vector3.Zero); }
private void CreateControls() { SuspendLayout(); #region 패널 //분리선 separator = new Panel(); separator.Location = new Point(139, 12); separator.Size = new Size(1, 352); separator.BackColor = Color.FromArgb(202, 202, 202); separator.Enabled = false; //컨텐츠영역 contentArea = new Panel(); contentArea.Location = new Point(18, 21); contentArea.Size = new Size(636, 343); contentArea.BackColor = Color.White; //닫기버튼 closeBtn = new PictureBox(); closeBtn.Cursor = Cursors.Hand; closeBtn.SizeMode = PictureBoxSizeMode.AutoSize; closeBtn.Image = Resources.Option_CloseBtn; closeBtn.Location = new Point(30, 364); closeBtn.SetMouseEvent(Color.White, Color.White.Lighting(-10), Color.White.Lighting(-20)); closeBtn.Click += (object sender, EventArgs e) => { Close(); }; //버튼 const int btnPadding = 10; const int btnHeight = 31; buttons = new MenuButton[3]; buttons[0] = new MenuButton(Resources.Option_SystemBtn_on, Resources.Option_SystemBtn_off); buttons[1] = new MenuButton(Resources.Option_DisplayBtn_on, Resources.Option_DisplayBtn_off); buttons[2] = new MenuButton(Resources.Option_DataBtn_on, Resources.Option_DataBtn_off); for (int i = 0; i < buttons.Length; i++) { buttons[i].Cursor = Cursors.Hand; buttons[i].Location = new Point(5, (btnHeight + btnPadding) * i); contentArea.Controls.Add(buttons[i]); int index = i; buttons[i].Click += (object sender, EventArgs e) => { ScrollTo(index); }; } //스크롤바 scrollBar = new PictureBox(); scrollBar.SizeMode = PictureBoxSizeMode.AutoSize; scrollBar.Image = Resources.Option_ScrollBar; scrollBar.Location = new Point(642 - contentArea.Location.X, 27); //패널 const int itemPadding = 10; scrollArea = new Panel(); scrollArea.Location = new Point(125, 0); panels = new ScrollItem[3]; panels[0] = new ScrollItem(Resources.Option_SystemPanel); panels[1] = new ScrollItem(Resources.Option_DisplayPanel); panels[2] = new ScrollItem(Resources.Option_DataPanel); for (int i = 0; i < buttons.Length; i++) { panels[i].SizeMode = PictureBoxSizeMode.AutoSize; panels[i].Location = new Point(0, heightStack); heightStack += panels[i].Height + itemPadding; scrollArea.Controls.Add(panels[i]); } scrollArea.Size = new Size(500, heightStack + contentArea.Height - panels.Last().Height - itemPadding); //마우스 휠 이벤트 scrollArea.MouseWheel += (object sender, MouseEventArgs e) => { scroller.scrollMode = ScrollMode.Manual; scroller.speedY += e.Delta / 120 * 15; Renderer.AddRenderQueue(scroller); }; #endregion //시스템 startProcessCheckbox = new CheckBox(); startProcessCheckbox.Location = new Point(27, 105); topMostCheckbox = new CheckBox(); topMostCheckbox.Location = new Point(27, 133); panels[0].Controls.Add(startProcessCheckbox); panels[0].Controls.Add(topMostCheckbox); startProcessCheckbox.OnSelected += (bool isChecked) => { Option.System.startProcess = isChecked; Option.OnOptionChanged(); }; topMostCheckbox.OnSelected += (bool isChecked) => { Option.System.topMost = isChecked; Option.OnOptionChanged(); }; //알림 alertCheckbox = new CheckBox(); alertCheckbox.Location = new Point(27, 222); alertSoundCheckbox = new CheckBox(); alertSoundCheckbox.Location = new Point(27, 247); alert_comCheckbox = new CheckBox(); alert_comCheckbox.Location = new Point(27, 296); alert_1hCheckbox = new CheckBox(); alert_1hCheckbox.Location = new Point(213, 296); alert_1dCheckbox = new CheckBox(); alert_1dCheckbox.Location = new Point(425, 296); panels[0].Controls.Add(alertCheckbox); panels[0].Controls.Add(alertSoundCheckbox); panels[0].Controls.Add(alert_comCheckbox); panels[0].Controls.Add(alert_1hCheckbox); panels[0].Controls.Add(alert_1dCheckbox); alertCheckbox.OnSelected += (bool isChecked) => { Option.System.alert = isChecked; Option.OnOptionChanged(); }; alertSoundCheckbox.OnSelected += (bool isChecked) => { Option.System.alertSound = isChecked; Option.OnOptionChanged(); }; alert_comCheckbox.OnSelected += (bool isChecked) => { Option.System.alert_com = isChecked; Option.OnOptionChanged(); }; alert_1hCheckbox.OnSelected += (bool isChecked) => { Option.System.alert_1h = isChecked; Option.OnOptionChanged(); }; alert_1dCheckbox.OnSelected += (bool isChecked) => { Option.System.alert_1d = isChecked; Option.OnOptionChanged(); }; //화면 //투명도 const int opacityBarY = 101; opacityBar = new DragBar(180); opacityBar.Location = new Point(26, opacityBarY); panels[1].Controls.Add(opacityBar); //폰트 const int fontSelectorY = 181; fontSelector = new RadioBtnSet(2); fontSelector.radioBtn[0].Location = new Point(26, fontSelectorY); fontSelector.radioBtn[1].Location = new Point(26, fontSelectorY + 28); fontSelector.AddControl(panels[1]); fontInspector = new Button(); fontInspector.Location = new Point(127, fontSelectorY + 26); panels[1].Controls.Add(fontInspector); //폰트크기 const int fontSizeY = 277; fontSizeSelector = new RadioBtnSet(3); fontSizeSelector.radioBtn[0].Location = new Point(28, fontSizeY); fontSizeSelector.radioBtn[1].Location = new Point(188, fontSizeY); fontSizeSelector.radioBtn[2].Location = new Point(352, fontSizeY); fontSizeSelector.AddControl(panels[1]); //최소길이 const int widthOffset = 372; widthOffsetSelector = new RadioBtnSet(3); widthOffsetSelector.radioBtn[0].Location = new Point(28, widthOffset); widthOffsetSelector.radioBtn[1].Location = new Point(188, widthOffset); widthOffsetSelector.radioBtn[2].Location = new Point(352, widthOffset); widthOffsetSelector.AddControl(panels[1]); //날자타입 const int dateTypeY = 505; dateTypeSelector = new RadioBtnSet(3); dateTypeSelector.radioBtn[0].Location = new Point(28, dateTypeY); dateTypeSelector.radioBtn[1].Location = new Point(188, dateTypeY); dateTypeSelector.radioBtn[2].Location = new Point(352, dateTypeY); dateTypeSelector.AddControl(panels[1]); //애니스피드 const int animSpeedY = 665; animSpeedSelector = new RadioBtnSet(3); animSpeedSelector.radioBtn[0].Location = new Point(28, animSpeedY); animSpeedSelector.radioBtn[1].Location = new Point(188, animSpeedY); animSpeedSelector.radioBtn[2].Location = new Point(352, animSpeedY); animSpeedSelector.AddControl(panels[1]); //이벤트 bool isScrollbarPressed = false; int scrollbarPressedPos = 0, scrollbarOriginPos = 0; scrollBar.MouseDown += (object sender, MouseEventArgs e) => { if (e.Button == MouseButtons.Left) { isScrollbarPressed = true; scrollbarPressedPos = Cursor.Position.Y; scrollbarOriginPos = scrollBar.Location.Y; } }; scrollBar.MouseMove += (object sender, MouseEventArgs e) => { if (isScrollbarPressed) { ScrollAreaPos(scrollbarOriginPos + Cursor.Position.Y - scrollbarPressedPos); } }; scrollBar.MouseUp += (object sender, MouseEventArgs e) => { if (e.Button == MouseButtons.Left) { isScrollbarPressed = false; } }; //화면 opacityBar.OnDrag += (int percent) => { Option.Display.opacity = percent; Option.OnOptionChanged(); }; RadioBtnSet.IndexHandler fontSelectEvent = (int index) => { switch (index) { case 0: Option.Display.fontValue = index; break; case 1: Option.Display.fontValue = index; Option.Display.font = fontInspector.textArea.Font = this.fontDialog.Font; break; } Option.OnOptionChanged(); }; fontSelector.OnSelected += fontSelectEvent; fontInspector.Click += (object sender, EventArgs e) => { DialogResult result = this.fontDialog.ShowDialog(); if (result == DialogResult.OK) { Option.Display.fontValue = 1; Option.Display.font = fontInspector.textArea.Font = this.fontDialog.Font; fontInspector.textArea.Text = this.fontDialog.Font.FontFamily.Name; Option.OnOptionChanged(); fontSelector.SelectWithoutEvent(1); } }; fontSizeSelector.OnSelected += (int index) => { Option.Display.fontSize = index; Option.OnOptionChanged(); }; widthOffsetSelector.OnSelected += (int index) => { Option.Display.widthOffset = index; Option.OnOptionChanged(); }; dateTypeSelector.OnSelected += (int index) => { Option.Display.dateType = index; Option.OnOptionChanged(); }; animSpeedSelector.OnSelected += (int index) => { Option.Display.animSpeed = index; Option.OnOptionChanged(); }; //데이터 saveBtn = new Button("일정 저장"); saveBtn.Location = new Point(29, 101); loadBtn = new Button("일정 불러오기"); loadBtn.Location = new Point(29, 137); panels[2].Controls.Add(saveBtn); panels[2].Controls.Add(loadBtn); saveBtn.OnClick += () => { DialogResult result = dataSaveDialog.ShowDialog(); if (result == DialogResult.OK) { SaveManager.Data.Save(new FileInfo(dataSaveDialog.FileName)); } }; loadBtn.OnClick += () => { DialogResult result = dataLoadDialog.ShowDialog(); if (result == DialogResult.OK) { LayerManager.ClearLayer(); SaveManager.Data.Load(new FileInfo(dataLoadDialog.FileName)); } }; Controls.Add(closeBtn); Controls.Add(separator); Controls.Add(contentArea); contentArea.Controls.Add(scrollArea); contentArea.Controls.Add(scrollBar); contentArea.BringToFront(); separator.BringToFront(); closeBtn.BringToFront(); scrollBar.BringToFront(); mainPanel.SetDragable(this); contentArea.SetDragable(this); scrollArea.SetDragable(this); for (int i = 0; i < panels.Length; i++) { panels[i].SetDragable(this); } ResumeLayout(); LoadOption(); }
public override void Execute() { try { var DateTimeStart = DateTime.Now; DsApp.AbortRunningCommand(); CommandMessage CmdLine = DsApp.GetCommandMessage(); if (null == CmdLine) { return; } //============================================================================== CmdLine.PrintLine("Calque '0' actif"); Document DsDoc = DsApp.GetActiveDocument(); LayerManager LyMgr = DsDoc.GetLayerManager(); Layer L0 = LyMgr.GetLayer("0"); L0.Activate(); // Creer les calques de pliage Color c; dsCreateObjectResult_e Erreur; //============================================================================== CmdLine.PrintLine("Création du claque 'LIGNES DE PLIAGE'"); Layer LigneDePliage; LyMgr.CreateLayer("LIGNES DE PLIAGE", out LigneDePliage, out Erreur); c = LigneDePliage.Color; c.SetColorByIndex(252); LigneDePliage.Color = c; //============================================================================== CmdLine.PrintLine("Création du claque 'NOTE DE PLIAGE'"); Layer NoteDePliage = null; LyMgr.CreateLayer("NOTE DE PLIAGE", out NoteDePliage, out Erreur); c = NoteDePliage.Color; c.SetColorByIndex(126); NoteDePliage.Color = c; Model Mdl = DsDoc.GetModel(); SketchManager SkMgr = Mdl.GetSketchManager(); SelectionManager SlMgr = DsDoc.GetSelectionManager(); SelectionFilter SlFilter; object ObjType = null; object ObjEntites = null; Int32[] TabTypes = null; object[] TabEntites = null; string[] TabNomsCalques = null; //============================================================================== CmdLine.PrintLine("Couleur des entité sur 'DuCalque'"); TabNomsCalques = GetTabNomsCalques(DsDoc); SkMgr.GetEntities(null, TabNomsCalques, out ObjType, out ObjEntites); TabEntites = (object[])ObjEntites; EntityHelper dsEntityHelper = DsApp.GetEntityHelper(); foreach (object entity in TabEntites) { Color ce = dsEntityHelper.GetColor(entity); ce.SetNamedColor(dsNamedColor_e.dsNamedColor_ByLayer); dsEntityHelper.SetColor(entity, ce); } //============================================================================== CmdLine.PrintLine("Transfert des lignes et notes de pliage sur les calques correspondants"); TabNomsCalques = new string[] { "0" }; SkMgr.GetEntities(null, TabNomsCalques, out ObjType, out ObjEntites); TabTypes = (Int32[])ObjType; TabEntites = (object[])ObjEntites; for (int i = 0; i < TabEntites.GetLength(0); i++) { dsObjectType_e tpe = (dsObjectType_e)TabTypes[i]; if (tpe == dsObjectType_e.dsLineType) { Line L = (Line)TabEntites[i]; if (L.LineStyle == "SLD-Center") { L.Layer = LigneDePliage.Name; } } else if (tpe == dsObjectType_e.dsNoteType) { Note N = (Note)TabEntites[i]; N.Layer = NoteDePliage.Name; } } //============================================================================== CmdLine.PrintLine("Conversion des textes à graver en lignes"); SlFilter = SlMgr.GetSelectionFilter(); SlFilter.Clear(); SlFilter.AddEntityType(dsObjectType_e.dsNoteType); SlFilter.Active = true; TabNomsCalques = new string[] { "GRAVURE" }; SkMgr.GetEntities(SlFilter, TabNomsCalques, out ObjType, out ObjEntites); TabTypes = (Int32[])ObjType; TabEntites = ObjEntites as object[]; if (TabEntites != null && TabEntites.Length > 0) { CmdLine.PrintLine(TabEntites.Length + " texte(s) convertis"); foreach (var Texte in TabEntites) { SlMgr.ClearSelections(dsSelectionSetType_e.dsSelectionSetType_Current); dsEntityHelper.Select(Texte, true); DsApp.RunCommand("ECLATERTEXTE\n", true); } } DsApp.RunCommand("_CSICON\nP\n", true); //============================================================================== CmdLine.PrintLine("Purger le dessin"); DsApp.RunCommand("_-CLEAN\n_All\n*\n_No\n", true); TimeSpan t = DateTime.Now - DateTimeStart; CmdLine.PrintLine(String.Format("Executé en {0}", GetSimplestTimeSpan(t))); } catch (Exception e) { Log.Write(e); } }
//called to set indicator to a particular node, set the color as well //not iOS performance friendly static public void SetIndicator(Vector3 pointer) { //~ if(!buildManager.enableTileIndicator) return; if (buildManager.tileIndicatorMode == _TileIndicatorMode.None) { return; } //layerMask for platform only LayerMask maskPlatform = 1 << LayerManager.LayerPlatform(); //layerMask for detect all collider within buildPoint LayerMask maskAll = 1 << LayerManager.LayerPlatform(); int terrainLayer = LayerManager.LayerTerrain(); if (terrainLayer >= 0) { maskAll |= 1 << terrainLayer; } Ray ray = Camera.main.ScreenPointToRay(pointer); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, maskPlatform)) { for (int i = 0; i < buildManager.buildPlatforms.Length; i++) { Transform basePlane = buildManager.buildPlatforms[i].thisT; if (hit.transform == basePlane) { //calculating the build center point base on the input position Vector3 pos = GetTilePos(basePlane, hit.point); //Debug.Log(new Vector3(remainderX, 0, remainderZ)+" "+new Vector3(signX, 0, signZ)+" "+p+" "+basePlane.position); indicator2.transform.position = pos; indicator2.transform.rotation = basePlane.rotation; Collider[] cols = Physics.OverlapSphere(pos, _gridSize / 2 * 0.9f, ~maskAll); if (cols.Length > 0) { if (buildManager.tileIndicatorMode == _TileIndicatorMode.All) { Utility.SetActive(indicator2, true); indicator2.renderer.material.SetColor("_TintColor", Color.red); } else { Utility.SetActive(indicator2, false); } } else { Utility.SetActive(indicator2, true); indicator2.renderer.material.SetColor("_TintColor", Color.green); } } } } else { Utility.SetActive(indicator2, false); } }
private void Awake() { instance = this; }
protected override void Activate() { base.Activate(); LayerManager.GetInstance().AddPopUpView <GuideWindow>(); }
//////////////////////////////////////////////////////////////////////////// // Create Map Nodes //////////////////////////////////////////////////////// public static Dictionary <WorldNode, List <MapNode> > CreateMapNodes(List <WorldNode> worldNodes) { // Wrap map Nodes around around Initial Dictionary <WorldNode, List <MapNode> > worldNodeAndWrapperNodes = new Dictionary <WorldNode, List <MapNode> >(); foreach (WorldNode worldNode in worldNodes) { List <Vector3> mapVects = GetMapVects(worldNode); List <MapNode> mapNodes = new List <MapNode>(); int mapCount = 1; int layerCount = 0; int nodeLayerCount = -1; foreach (Vector3 vect in mapVects) { int rotation = 0; int mapType = -1; if (worldNode.entrance) { mapType = MapSettings.MAPTYPE_SHIPPORT_FLOOR; } else { mapType = MapSettings.MAPTYPE_MAP_FLOOR; } int mapPiece = Random.Range(0, 4); // 3 is the number of availble map pieces MapNode mapNode = WorldBuilder._nodeBuilder.CreateNode <MapNode>(worldNode.gameObject.transform, vect, rotation, mapType, mapPiece, NodeTypes.MapNode); mapNode.NodeSize = 1; mapNode.neighbours = new int[6]; for (int i = 0; i < mapNode.neighbours.Length; i++) { mapNode.neighbours[i] = 1; } mapNode.worldNodeParent = worldNode; if (worldNode.NodeSize == 1) { nodeLayerCount = worldNode.NodeLayerCount + 4; // 4 total layers in 1 map and vent piece } else if (worldNode.NodeSize == 3) { nodeLayerCount = worldNode.NodeLayerCount + layerCount; if (mapCount % 9 == 0) { layerCount = layerCount + 4; // 4 total layers in 1 map and vent piece } } else { Debug.LogError("something weird here"); } mapNode.NodeLayerCount = nodeLayerCount; mapNodes.Add(mapNode); if (!worldNode.entrance) { WorldBuilder._nodeBuilder.AttachCoverToNode(mapNode, mapNode.gameObject, CoverTypes.NormalCover, new Vector3(0, 0, 0)); } LayerManager.AddNodeToLayer(mapNode); // for camera layers mapCount++; } worldNode.mapNodes = mapNodes; worldNodeAndWrapperNodes.Add(worldNode, mapNodes); //////////////// //// Map Neighbours int[] worldNodeNeighbours = worldNode.neighbours; if (worldNode.NodeSize == 1) { MapNode mapNode = worldNode.mapNodes[0]; int[] mapNeighbours = mapNode.neighbours; for (int i = 0; i < worldNodeNeighbours.Length; i++) { if (worldNodeNeighbours[i] != -1) { mapNeighbours[i] = 1; } else { mapNeighbours[i] = -1; //mapNode.entranceSides.Add(i); } } } //////// if (worldNode.NodeSize == 3) { // bottom SetMapNeighboursWithMultipleLinks(worldNode, 0, 4, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, worldNode.entrance); // Front SetMapNeighboursWithMultipleLinks(worldNode, 1, 10, new int[] { 0, 1, 2, 9, 10, 11, 18, 19, 20 }, worldNode.entrance); // Left SetMapNeighboursWithMultipleLinks(worldNode, 2, 12, new int[] { 0, 3, 6, 9, 12, 15, 18, 21, 24 }, worldNode.entrance); // Right SetMapNeighboursWithMultipleLinks(worldNode, 3, 14, new int[] { 2, 5, 8, 11, 14, 17, 20, 23, 26 }, worldNode.entrance); // Back SetMapNeighboursWithMultipleLinks(worldNode, 4, 16, new int[] { 6, 7, 8, 15, 16, 17, 24, 25, 26 }, worldNode.entrance); // Top SetMapNeighboursWithMultipleLinks(worldNode, 5, 22, new int[] { 18, 19, 20, 21, 22, 23, 24, 25, 26 }, worldNode.entrance); } } return(worldNodeAndWrapperNodes); }
void Start() { _okDialog.SetActive(false); _yesNoDialog.SetActive(false); _footItemCommandWindow.SetActive(false); _footTrapCommandWindow.SetActive(false); LayerManager.CreateAllLayer(); _itemWindow.SetActive(false); _btnItem.onClick.AddListener(() => { if (_gameState != GameState.InputWait) { return; } ChangeGameState(GameState.DisplayItemWindow); _itemWindow.SetActive(true); var sc = GameObject.Find("Canvas/ScrollView/Panel/Content").GetComponent <ScrollController>(); sc.Init(_player.Items); sc.SetCloseCallback(() => { ChangeGameState(GameState.InputWait); }); sc.SetItemActionCallback((ItemActionType actionType, Item item) => { Debug.Log("callback = " + actionType); Debug.Log("item = " + item); ExecutePlayerItemAction(actionType, item); }); }); _btnFoot.onClick.AddListener(() => { if (_gameState != GameState.InputWait) { return; } Debug.Log("足下ボタンが押されました"); // 足下アイテム var fieldItem = FindFieldItem(_player.Loc); if (fieldItem != null) { ChangeGameState(GameState.DisplayFootItemCommandWindow); var c = _footItemCommandWindow.GetComponent <FootItemCommandWindow>(); c.Init(fieldItem, (ItemActionType actionType, FieldItem fitem) => { Debug.LogFormat("--> type:{0} fieldItem:{1}", actionType, fitem); ExecutePlayerFootItemAction(actionType, fitem); }); _footItemCommandWindow.SetActive(true); return; } // 足下ワナ var trap = _floor.FindTrap(_player.Loc); if (trap != null) { ChangeGameState(GameState.DisplayFootTrapCommandWindow); var c = _footTrapCommandWindow.GetComponent <FootTrapCommandWindow>(); c.Init(trap, (TrapActionType actionType, Trap t) => { Debug.LogFormat("--> type:{0} trap:{1}", actionType, t); ExecutePlayerFootTrapAction(actionType, t); }); _footTrapCommandWindow.SetActive(true); return; } // 足下階段 if (_player.Loc == _floor.StairsLoc) { ConfirmDownStairs(GameState.InputWait); ChangeGameState(GameState.ConfirmStairsDialog); return; } }); _btnGiveup.onClick.AddListener(() => { if (_gameState != GameState.InputWait) { return; } ChangeGameState(GameState.ConfirmGiveup); }); _btnChangeDir.onClick.AddListener(() => { if (_gameState != GameState.InputWait) { return; } Debug.Log("方向転換します"); _player.ShowDirectionAll(); ChangeGameState(GameState.ChangeDirWaitPress); }); DLog.Enable = false; _keyPad = new KeyPad(); _banner = new FloorBanner(); _gm = new GameManager(); _mm = new MessageManager(this); _player = _gm.CreatePlayer(new Loc(3, 3)); _player.setCallback(OnPlayerStatusAdded, OnPlayerStatusRemoved); var camera = GameObject.Find("Main Camera"); camera.GetComponent <Camera>().orthographicSize = _cameraManager.CurrentSize; // Zoom ボタンのクリックイベント var btnZoom = GameObject.Find("Button_Zoom"); btnZoom.GetComponent <Button>().onClick.AddListener(() => { if (_gameState == GameState.InputWait) { camera.GetComponent <Camera>().orthographicSize = _cameraManager.NextSize(); } }); btnZoom.SetActive(false); ChangeGameState(GameState.NextFloorTransition); StartCoroutine(NextFloor(true)); }
public CameraRaycaster(GameObject targetmarker, GameObject looker) { cast = LayerManager.NameToLayer("raycast"); sphereTargetMarker = targetmarker; this.looker = looker; }
void Awake() { generationZone = GameObject.FindGameObjectWithTag("GenerationZone"); layerManager = GameObject.FindObjectOfType <LayerManager> (); frame = GetComponentInChildren <Frame> (); }
void Awake() { layerManager = this; }
internal override void Init() { base.Init(); _layerManager = new LayerManager(this); AddEventHandler(); }
public override void Execute() { try { DsDoc = DsApp.GetActiveDocument(); DsMdl = DsDoc.GetModel(); LyM = DsDoc.GetLayerManager(); SkM = DsMdl.GetSketchManager(); SlM = DsDoc.GetSelectionManager(); DsApp.AbortRunningCommand(); CommandMessage CmdLine = DsApp.GetCommandMessage(); if (null == CmdLine) { return; } // Erreur avec le premier prompt, la commande est automatiquement annulée // Pour contourner le pb, on lance une commande à vide. { String sss = ""; CmdLine.PromptForString(true, "", "", out sss); } SelectionFilter SlFilter; SlFilter = SlM.GetSelectionFilter(); ReferenceImage Image = null; SlFilter.Clear(); SlFilter.AddEntityType(dsObjectType_e.dsReferenceImageType); SlFilter.Active = true; int NbPoint = 5000; Double Jeu = 5; Double DiamMin = 5; Double DiamMax = 45; // Double.PositiveInfinity; int SeuilNoirs = 8; int BlancPctDiam = 65; int TypeSampler = 2; int NbAffinage = 6; bool MaillageEtPoint = false; CmdLine.PromptForInteger("Nb de points maximum ", NbPoint, out NbPoint); CmdLine.PromptForDouble("Jeu entre les cercles ", Jeu, out Jeu); CmdLine.PromptForDouble("Supprimer les cercles de diam inf. à ", DiamMin, out DiamMin); CmdLine.PromptForDouble("Réduire les cercles de diam sup. à ", DiamMax, out DiamMax); CmdLine.PromptForInteger("Seuil mini pour les noirs (0 à 255) ", SeuilNoirs, out SeuilNoirs); CmdLine.PromptForInteger("Blanc, % du diam mini (0 à 100)", BlancPctDiam, out BlancPctDiam); CmdLine.PromptForInteger("Type de sampler : 1 -> Poisson / 2 -> Rejection ", TypeSampler, out TypeSampler); CmdLine.PromptForInteger("Nb d'iteration pour l'affinage ", NbAffinage, out NbAffinage); CmdLine.PromptForBool("Dessiner le maillage et les points d'origine ", "Oui", "Non", MaillageEtPoint, out MaillageEtPoint); if (CmdLine.PromptForSelection(true, "Selectionnez l'image", "Ce n'est pas une image")) { dsObjectType_e entityType; var count = SlM.GetSelectedObjectCount(dsSelectionSetType_e.dsSelectionSetType_Previous); object selectedEntity = SlM.GetSelectedObject(dsSelectionSetType_e.dsSelectionSetType_Previous, 0, out entityType); if (dsObjectType_e.dsReferenceImageType == entityType) { Image = (ReferenceImage)selectedEntity; } } //object ObjType = null; //object ObjEntites = null; //string[] TabNomsCalques = GetTabNomsCalques(DsDoc); //SkM.GetEntities(SlFilter, TabNomsCalques, out ObjType, out ObjEntites); //object[] TabEntites = ObjEntites as object[]; //Image = (ReferenceImage)TabEntites[0]; TimeSpan t; DateTime DateTimeStart; DateTimeStart = DateTime.Now; if (Image != null) { CmdLine.PrintLine(String.Format("Image : {0}", Image.GetPath())); Double ImgX, ImgY, ImgZ; Image.GetPosition(out ImgX, out ImgY, out ImgZ); CmdLine.PrintLine("Sampler"); Log.Message("Sampler"); List <PointF> listePoint; if (TypeSampler == 1) { Double fact1 = 2; Double fact2 = 0.7; CmdLine.PromptForDouble("Facteur multip. du rayon de rejection ", fact1, out fact1); CmdLine.PromptForDouble("Facteur multip. du rayon minimum à l'initialisation ", fact2, out fact2); listePoint = BitmapPoissonSampler.Run(Image, NbPoint, fact1, fact2); } else { listePoint = BitmapRejectionSampler.Run(Image, NbPoint); } dsCreateObjectResult_e res; var CalquePoint = LyM.GetLayer("Point"); if (CalquePoint == null) { LyM.CreateLayer("Point", out CalquePoint, out res); var c = CalquePoint.Color; c.SetColorByIndex(230); CalquePoint.Color = c; } if (MaillageEtPoint) { CalquePoint.Activate(); foreach (var pc in listePoint) { SkM.InsertCircleByDiameter(ImgX + pc.X, ImgY + Image.Height - pc.Y, 0, 2); } } CmdLine.PrintLine("Sampler terminé"); Log.Message("Sampler terminé"); Log.Message("Equilibrage des points"); VoronoiMap.VoronoiGraph graph; var listeSitePoincon = VoronoiEquilibreur.Start(Image, listePoint, NbAffinage, out graph); Log.Message("Equilibrage terminé"); var CalquePoincon = LyM.GetLayer("Poincon"); if (CalquePoincon == null) { LyM.CreateLayer("Poincon", out CalquePoincon, out res); var c = CalquePoincon.Color; c.SetColorByIndex(252); CalquePoincon.Color = c; } var CalqueMaillage = LyM.GetLayer("Maillage"); if (CalqueMaillage == null) { LyM.CreateLayer("Maillage", out CalqueMaillage, out res); var c = CalqueMaillage.Color; c.SetColorByIndex(126); CalqueMaillage.Color = c; } var CalqueHachures = LyM.GetLayer("Hachures"); if (CalqueHachures == null) { LyM.CreateLayer("Hachures", out CalqueHachures, out res); var c = CalqueHachures.Color; c.SetColorByIndex(100); CalqueMaillage.Color = c; } var ListeCercles = new List <Circle>(); CalquePoincon.Activate(); var facteurGris = (100 - BlancPctDiam) / (255 - SeuilNoirs); var DiamMiniDessin = Double.PositiveInfinity; var DiamMaxiDessin = 0.0; foreach (var pc in listeSitePoincon) { var diam = pc.CercleInscrit - (Jeu * 0.5); var reduce = (BlancPctDiam + (255 - pc.GrisCercleInscrit) * facteurGris) / 100; var diamReduce = Math.Min(DiamMax, diam * reduce); if (pc.GrisCercleInscrit > SeuilNoirs && diamReduce >= DiamMin) { //Log.Message("Ø : " + diam + " / f : " + reduce + " / Øred : " + diamReduce); DiamMiniDessin = Math.Min(DiamMiniDessin, diamReduce); DiamMaxiDessin = Math.Max(DiamMaxiDessin, diamReduce); var cercle = SkM.InsertCircleByDiameter(ImgX + pc.Site.X, ImgY + Image.Height - pc.Site.Y, 0, diamReduce); ListeCercles.Add(cercle); } } var format = String.Format("Nb de percages : {0} / DiamMaxi : {1:0.0} / DiamMini : {2:0.0}", ListeCercles.Count, DiamMaxiDessin, DiamMiniDessin); CmdLine.PrintLine(format); Log.Message(format); CalqueHachures.Activate(); foreach (var item in ListeCercles) { var ent = new DispatchWrapper[1] { new DispatchWrapper(item) }; SkM.InsertHatchByEntities(ent, "SOLID", 1, 0); } if (MaillageEtPoint) { CalqueMaillage.Activate(); foreach (var s in graph.Segments) { SkM.InsertLine(ImgX + s.P1.X, ImgY + Image.Height - s.P1.Y, 0, ImgX + s.P2.X, ImgY + Image.Height - s.P2.Y, 0); } } LyM.GetLayer("0").Activate(); CalqueMaillage.Shown = false; CalquePoint.Shown = false; CalquePoincon.Shown = false; } else { CmdLine.PrintLine("Pas d'image"); } t = DateTime.Now - DateTimeStart; CmdLine.PrintLine(String.Format("Executé en {0}", GetSimplestTimeSpan(t))); } catch (Exception e) { Log.Write(e); } }
public ParticleManager(LayerManager layerManager) { layerManager.ForEach(AddParticleRenderer); layerManager.LayerAdded += LayerManager_LayerAdded; }
//private string _projectFileLocation; //public ProjectContainer Container { get; private set; } //public LayoutSheetController LayoutSheetController { get; private set; } public DocumentManagementDocumentStore(Document doc, Type[] managerTypes, ILogger <CoreExtensionApplication> log, LayerManager layerManager, IConfiguration settings) : base(doc, managerTypes, log, layerManager, settings) { }
public PsudoEmailInjector(LayerManager db, DbgGUI gui) { this.db = db; this.gui = gui; this.indexer = new TextIndexer(db); }
//***************************************************************************************************************************** //UI & input related code // Update is called once per frame void Update() { //for touch input on mobile device #if UNITY_IPHONE || UNITY_ANDROID if (Input.touchCount == 1) { Touch touch = Input.touches[0]; //if(touch.phase == TouchPhase.Ended){ if (touch.phase == TouchPhase.Began) { if (!IsCursorOnUI(Input.mousePosition)) { Ray ray = Camera.main.ScreenPointToRay(touch.position); RaycastHit hit; LayerMask mask = 1 << LayerManager.GetLayerTile(); if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask)) { Tile tile = hit.collider.gameObject.GetComponent <Tile>(); /**/ //if this is the second tap on the tile if (tile == lastTileTouched) { lastTileTouched = null; tile.OnTouchMouseDown(); } //if the tile is a new one else { //clear any effect off previously selected tile if (lastTileTouched != null) { lastTileTouched.OnTouchMouseExit(); } //if the tile contain friendly unit, select it directly if (tile.unit != null && tile.unit.factionID == 0) { lastTileTouched = tile; tile.OnTouchMouseEnter(); tile.OnTouchMouseDown(); } //a new tile with no friendly unit, just call mouse tnter else { lastTileTouched = tile; tile.OnTouchMouseEnter(); } } //*/ } else { if (lastTileTouched != null) { lastTileTouched.OnTouchMouseExit(); lastTileTouched = null; } } if (onUnitInfoE != null) { onUnitInfoE(lastTileTouched); } } } } #else //enable this section and disable OnMouseEnter, OnMouseExit, OnMouseDown, and OnMouseOver in Tile.cs to emulate touch device input scheme on desktop /* * if(Input.GetMouseButtonUp(0)){ * if(!IsCursorOnUI(Input.mousePosition)){ * Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); * RaycastHit hit; * LayerMask mask=1<<LayerManager.GetLayerTile(); * if(Physics.Raycast(ray, out hit, Mathf.Infinity, mask)){ * Tile tile=hit.collider.gameObject.GetComponent<Tile>(); * //if this is the second tap on the tile * if(tile==lastTileTouched){ * lastTileTouched.OnTouchMouseExit(); * lastTileTouched=null; * tile.OnTouchMouseDown(); * } * //if the tile is a new one * else{ * //clear any effect off previously selected tile * if(lastTileTouched!=null) lastTileTouched.OnTouchMouseExit(); * //if the tile contain friendly unit, select it directly * if(tile.unit!=null && tile.unit.factionID==0){ * lastTileTouched=tile; * tile.OnTouchMouseEnter(); * tile.OnTouchMouseDown(); * } * //a new tile with no friendly unit, just call mouse tnter * else{ * lastTileTouched=tile; * tile.OnTouchMouseEnter(); * } * } * } * else{ * if(lastTileTouched!=null){ * lastTileTouched.OnTouchMouseExit(); * lastTileTouched=null; * } * } * * if(onUnitInfoE!=null) onUnitInfoE(lastTileTouched); * } * } */ #endif }
public RemoveShapeAction(QuadTreePositionItem<IShape> item,LayerManager layerManager) { this.selectedTransportQuadtreeItem = item; this.layerManager = layerManager; }
public void DrawFrontView() { LayerManager.SetLayerCurrent("SidePanel"); var sideView = geometry.DrawRectangle("Side Panel", Length, Width, StartPoint); }