Beispiel #1
0
        public BrickActor(AnimationStore store, Point location, Color color, BrickSize size)
        {
            Animation      = new AnimationServer(store);
            _BoundingBoxes = new List <Rectangle>().AsReadOnly();
            _Color         = color;
            _GridSize      = new Size((int)size, 1);
            Location       = location;
            _Size          = size;

            UpdateBrickAnim();
        }
Beispiel #2
0
        private GameObject GenerateBrick(Vector3 position, Color color, BrickSize size)
        {
            var brick = new GameObject("Brick");

            brick.transform.position   = position;
            brick.transform.parent     = bricksContainer;
            brick.transform.localScale = new Vector3(sizeValues[size], 1);
            var brickRenderer = brick.AddComponent <SpriteRenderer>();

            brickRenderer.sprite = brickSprite;
            brickRenderer.color  = color;
            var brickCollider = brick.AddComponent <BoxCollider2D>();

            brickCollider.sharedMaterial = material;
            brick.AddComponent <Brick>();
            return(brick);
        }
        private GameObject GenerateBrick(Vector3 position, Color color, BrickSize size)
        {
            var brick = new GameObject("Brick");
            brick.transform.position = position;
            brick.transform.parent = bricksContainer;
            brick.transform.localScale = new Vector3(sizeValues[size], brickHeight);

            var brickRenderer = brick.AddComponent<SpriteRenderer>();
            brickRenderer.sprite = sprite;
            brickRenderer.color = color;

            var brickCollider = brick.AddComponent<BoxCollider2D>();
            brickCollider.sharedMaterial = bouncyMaterial;
            brick.AddComponent<Brick>();
            return brick;
        }