private void ShowMoveRange(bool show, UnitAndOrder unit) { if (unit.orders == null) { return; } GraphGrid grid = unit.orders.Grid; List <Node> nodesInRange = grid.GetAllNodesInRange(grid.FindNode(unit.GO.transform.position), unit.GO.GetComponent <Stats>().moveRange); foreach (Node node in nodesInRange) { if (show) { node.gameObject.GetComponent <MeshRenderer>().material = nodeInRangeMaterial; } else { node.gameObject.GetComponent <MeshRenderer>().material = normalNodeMaterial; } } if (show) { Node activeUnitNode = grid.FindNode(unit.GO.transform.position); activeUnitNode.gameObject.GetComponent <MeshRenderer>().material = activeUnitNodeMaterial; } }
public BezierCurveModelItem(BezierCurve curve, GraphGrid grid, double[][] cameraMatrix) { _curve = new List <BezierCurve>(); _curve.Add(curve); Grid = grid; Matrix = cameraMatrix; _totalCount = curve.Points.Count; }
public void OnRoomEnter() { currentNode = GetOnNode(transform.position); Debug.Log(currentNode); if (currentNode) { currentRoom = currentNode.GetComponentInParent <Room>(); currentRoom.IsPlayerInside = true; grid = currentRoom.Grid; currentNode.isOccupied = true; transform.position = new Vector3(currentNode.transform.position.x, currentNode.transform.position.y + 0.25f, currentNode.transform.position.z); } }
public void Add(CurveGraphModel model) { if (Items != null) { Items.Clear(); modelitems = null; } else { Items = new ObservableCollection <FrameworkElement>(); modelitems = new CurveGraphModel(); } modelitems = model; GraphGrid grid = DrawGrid.RenderGrid(model, camera); model.Item.Grid = grid; if (UpdateRender != null) { UpdateRender(this, EventArgs.Empty); } }
public AddOptionAlgorythm(GraphGrid grid, GraphViewModel graph) { _grid = grid; _graph = graph; }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _basicEffect = new BasicEffect(GraphicsDevice) { VertexColorEnabled = true, // Transform your model to place it somewhere in the world //World = Matrix.CreateRotationZ(MathHelper.PiOver4) * Matrix.CreateTranslation(0.5f, 0, 0), // for sake of example // Transform the entire world around (effectively: place the camera) View = Matrix.CreateLookAt(new Vector3(0, 0, -4), Vector3.Zero, Vector3.Up), // Specify how 3D points are projected/transformed onto the 2D screen Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 1.0f, 100.0f) }; GraphicsDevice.RasterizerState = RasterizerState.CullNone; //GraphicsDevice.BlendState = BlendState.Opaque; //GraphicsDevice.DepthStencilState = DepthStencilState.Default; //GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; _font = Content.Load <SpriteFont>("Consolas"); _pointTexture = GeometricTextureFactory.Circle(GraphicsDevice, 5, SceneColors.Point); _triangle = new EquilateralTriangle(_pointTexture, 2f); _inscribedTriangle = new InscribedEquilateralTriangle( _pointTexture, _triangle); _easingFn.Next(3); _triangleAnimator = new Animator( _easingFn.GetCurrent().Apply, _triangle.SideLength, value => _triangle.SideLength = value, .125f, 0.5); _graphGrid = new GraphGrid(GraphicsDevice, size: 30); _keyboard.OnPress(Keys.Right, () => { _easingFn.Next(); _triangleAnimator.Easing = _easingFn.GetCurrent().Apply; }); _keyboard.OnPress(Keys.Left, () => { _easingFn.Prev(); _triangleAnimator.Easing = _easingFn.GetCurrent().Apply; }); _keyboard.OnPress(Keys.W, toggleWireframeDisplay); _keyboard.OnPress(Keys.Up, () => { _triangleAnimator.Duration += 0.5f; }); _keyboard.OnPress(Keys.J, () => _inscribedTriangle.StepTheta(0.01f)); _keyboard.OnPress(Keys.K, () => _inscribedTriangle.StepTheta(-.01f)); _keyboard.OnPress(Keys.Down, () => { _triangleAnimator.Duration -= 0.5f; }); _keyboard.OnPress(Keys.Space, () => _updating = !_updating); toSolidDisplay(); }
public ConnectOptionAlgorythm(GraphGrid grid, GraphViewModel graph) { _graph = graph; _grid = grid; }
public DirectionOptionAlgorythm(GraphGrid grid, GraphViewModel graph) { _graph = graph; _grid = grid; }
//public MoveOptionAlgorythm(GraphCanvas canvas) => _canvas = canvas; public MoveOptionAlgorythm(GraphGrid grid) => _grid = grid;