Exemplo n.º 1
0
    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));
        }
Exemplo n.º 3
0
    private void CutNote(Transform playerTransform)
    {
        Mesh newMesh = GeometryCreator.CutGeometryAtPosition(NoteMeshFilter.mesh, this.transform.InverseTransformPoint(playerTransform.position));

        NoteMeshFilter.mesh = newMesh;

        Debug.Break();
    }
Exemplo n.º 4
0
        public void Move(Point point)
        {
            Center = point;

            _LabelBinding = new LabelBinding(this);

            _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this));
        }
Exemplo n.º 5
0
        public void UnFocus()
        {
            if (_BindingCreator.Type != PathType.Solid)
            {
                _BindingCreator.Type = PathType.Solid;

                _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this));
            }
        }
Exemplo n.º 6
0
        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));
 }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
        /// <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);
            }
        }
Exemplo n.º 10
0
        /// <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);
            }
        }
Exemplo n.º 11
0
        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();
        }
Exemplo n.º 12
0
        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));
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        public void Update()
        {
            _LabelBinding = new LabelBinding(this);

            _PathBinding = _BindingCreator.Create(GeometryCreator.Create(this));
        }
 public void Update()
 {
     _PathBinding = _BindingCreator.Create(GeometryCreator.Create(Reference));
 }