public void UpdateNote(NoteInfo noteInfo) { Duration = noteInfo.Duration == 0 ? 0.25f : noteInfo.Duration; NoteMeshFilter.mesh = GeometryCreator.CreateNote(Duration, noteInfo.Deformations); NoteMeshCollider.sharedMesh = null; NoteMeshCollider.sharedMesh = NoteMeshFilter.mesh; _noteType = noteInfo.NoteType; Color newColor = Color.white; switch (_noteType) { case TypeOfNotes.Blue: newColor = Color.blue; break; case TypeOfNotes.Green: newColor = Color.green; break; case TypeOfNotes.Red: newColor = Color.red; break; case TypeOfNotes.Yellow: newColor = Color.yellow; break; } NoteRenderer.material.color = newColor; _xPosition = noteInfo.XPosition; }
public ArrowCanvas(ReferenceCanvas reference) { Reference = reference; _BindingCreator.FillBrush = Brushes.Black; _PathBinding = _BindingCreator.Create(GeometryCreator.Create(Reference)); }
private void CutNote(Transform playerTransform) { Mesh newMesh = GeometryCreator.CutGeometryAtPosition(NoteMeshFilter.mesh, this.transform.InverseTransformPoint(playerTransform.position)); NoteMeshFilter.mesh = newMesh; Debug.Break(); }
public void Move(Point point) { Center = point; _LabelBinding = new LabelBinding(this); _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); }
public void UnFocus() { if (_BindingCreator.Type != PathType.Solid) { _BindingCreator.Type = PathType.Solid; _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); } }
public void Focus() { if (_BindingCreator.Type != PathType.Dashed) { _BindingCreator.Type = PathType.Dashed; _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); } }
public ExplosionFragmentManager(Game2D game, ILevelDataProvider level) { _level = level; _texture = game.Content.Load <Texture2D>("Textures/explosionparticle"); _particleEffect = game.Content.Load <Effect>("Effects/ParticleEffect"); _worldViewProjParameter = _particleEffect.Parameters["WorldViewProjection"]; _textureParameter = _particleEffect.Parameters["DiffuseTexture"]; _instances = new List <ExplosionFragment>(); _quadVertexBuffer = new VertexBuffer(game.GraphicsDevice, VertexPositionNormalTexture.VertexDeclaration, 4, BufferUsage.WriteOnly); _quadVertexBuffer.SetData(GeometryCreator.GenerateQuad(QuadOrientation.UnitY, Vector3.Zero)); }
public Level(GraphicsDevice device, ContentManager content, ILevelDataProvider levelDataProvider) { _levelData = levelDataProvider; _device = device; _wallTexture = content.Load <Texture2D>("Textures/wall"); _boxCube = new Cube(device, content.Load <Texture2D>("Textures/box")); _grassTexture = content.Load <Texture2D>("Textures/grass"); _groundVertexBuffer = new VertexBuffer(_device, VertexPositionNormalTexture.VertexDeclaration, 4, BufferUsage.WriteOnly); _groundVertexBuffer.SetData(GeometryCreator.GenerateQuad(QuadOrientation.UnitY, Vector3.Zero, 15, 13)); GenerateContent(); }
/// <summary> /// Get a random ellipse instance /// </summary> /// <returns> /// Returns a value in geojson format /// </returns> public JsonResult DrawEllipse() { Ellipse ellipse = GeometryCreator.CreateEllipse(); string json = ellipse.SerializeObject(); try { return(Json(json, JsonRequestBehavior.AllowGet)); } finally { DataManager.SaveData(json); } }
/// <summary> /// Get a random triangle instance /// </summary> /// <returns> /// Returns a value in geojson format /// </returns> public JsonResult DrawTriangle() { Triangle triangle = GeometryCreator.CreateTriangle(); string json = triangle.SerializeObject(); try { return(Json(json, JsonRequestBehavior.AllowGet)); } finally { DataManager.SaveData(json); } }
public void Update() { if (View.type == ReferencesType.Dependency || View.type == ReferencesType.Realization) { _BindingCreator.Type = PathType.Dashed; } else { _BindingCreator.Type = PathType.Solid; } _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); Arrow.Update(); }
public SubjectCanvas(SubjectView view, Point center, int width = 100, int height = 50) { View = view; Center = center; Width = width; Height = height; _BindingCreator.Type = PathType.Solid; _LabelBinding = new LabelBinding(this); _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); }
public ReferenceCanvas(SubjectReferenceView view, SubjectCanvas subject, SubjectCanvas target) { View = view; Subject = subject; Target = target; if (View.type == ReferencesType.Dependency || View.type == ReferencesType.Realization) { _BindingCreator.Type = PathType.Dashed; } _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); Arrow = new ArrowCanvas(this); }
private void GenerateContent() { if (_vertexBuffer != null && !_vertexBuffer.IsDisposed) { _vertexBuffer.Dispose(); } if (_indexBuffer != null && !_indexBuffer.IsDisposed) { _indexBuffer.Dispose(); } var vertices = new List <VertexPositionNormalTexture>(); for (int z = 0; z < 13; z++) { for (int x = 0; x < 15; x++) { ITileBlockDataProvider data = _levelData.Data[z * 15 + x]; if (data.Type == BlockType.Wall) { vertices.AddRange(GeometryCreator.GenerateQuad(QuadOrientation.UnitY, new Vector3(0.5f + x, 1.0f, 0.5f + z))); if (x == 0 || _levelData.Data[z * BombGame.GameLevelWidth + x - 1].Type != BlockType.Wall) { vertices.AddRange(GeometryCreator.GenerateQuad(QuadOrientation.InvUnitX, new Vector3(x, 0.5f, 0.5f + z))); } if (x == BombGame.GameLevelWidth - 1 || _levelData.Data[z * BombGame.GameLevelWidth + x + 1].Type != BlockType.Wall) { vertices.AddRange(GeometryCreator.GenerateQuad(QuadOrientation.UnitX, new Vector3(x + 1, 0.5f, 0.5f + z))); } if (z == BombGame.GameLevelHeight - 1 || _levelData.Data[(z + 1) * BombGame.GameLevelWidth + x].Type != BlockType.Wall) { vertices.AddRange(GeometryCreator.GenerateQuad(QuadOrientation.UnitZ, new Vector3(x + 0.5f, 0.5f, 1.0f + z))); } if (z == 0 || _levelData.Data[(z - 1) * BombGame.GameLevelWidth + x].Type != BlockType.Wall) { vertices.AddRange(GeometryCreator.GenerateQuad(QuadOrientation.InvUnitZ, new Vector3(x + 0.5f, 0.5f, z))); } } } } _vertexCount = vertices.Count; _primitiveCount = _vertexCount / 2; _vertexBuffer = new VertexBuffer(_device, VertexPositionNormalTexture.VertexDeclaration, _vertexCount, BufferUsage.WriteOnly); _vertexBuffer.SetData(vertices.ToArray()); short[] indices = new short[_primitiveCount * 3]; for (short i = 0; i < _primitiveCount / 2; i++) { indices[i * 6 + 0] = (short)(i * 4 + 0); indices[i * 6 + 1] = (short)(i * 4 + 1); indices[i * 6 + 2] = (short)(i * 4 + 2); indices[i * 6 + 3] = (short)(i * 4 + 1); indices[i * 6 + 4] = (short)(i * 4 + 3); indices[i * 6 + 5] = (short)(i * 4 + 2); } _indexBuffer = new IndexBuffer(_device, IndexElementSize.SixteenBits, indices.Length, BufferUsage.WriteOnly); _indexBuffer.SetData(indices); }
public void Update() { _LabelBinding = new LabelBinding(this); _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this)); }
public void Update() { _PathBinding = _BindingCreator.Create(GeometryCreator.Create(Reference)); }