Beispiel #1
0
        public Cell(int x, int y, DisplayObject parent, CellType type)
        {
            Type          = type;
            Sprite        = new Sprite("tiles.png", false, TileSet.GetCellTile(Type));
            Sprite.ScaleX = Sprite.ScaleY = TileSet.Scale;

            Position = (x, y);
            parent.AddChild(Sprite);
        }
        public void UpdateReticle()
        {
            if (Circle != null)
            {
                Reticle.RemoveChild(Circle);
                Reticle.RemoveChild(CircleLine);
            }

            Circle                  = new CircleShape(SourceObject.Weapon.ExplosionRadius, 40);
            Circle.FillColor        = new Color(0, 0, 0, 0);
            Circle.OutlineColor     = Colour;
            Circle.OutlineThickness = Thickness;
            Circle.Origin           = new Vector2f(Circle.Radius, Circle.Radius);
            Reticle.AddChild(Circle);

            CircleLine           = new RectangleShape(new Vector2f(Circle.Radius * 2, Thickness));
            CircleLine.FillColor = Colour;
            CircleLine.Origin    = new Vector2f(0, Thickness / 2);
            CircleLine.Position  = new Vector2f(-Circle.Radius, 0);
            Reticle.AddChild(CircleLine);
        }
Beispiel #3
0
        /// <summary>
        /// Adds the specified sprite object to the specified container, using the sprite's metadata from the specified piece art.
        /// </summary>
        /// <param name="girl">The <see cref="Girl"/> instance the sprite object will be added to (only used for alt. girl checking).</param>
        /// <param name="sprite">The sprite object to add.</param>
        /// <param name="pieceArt">The piece art with metadata for the sprite object.</param>
        /// <param name="container">The container to which to add the sprite object to.</param>
        /// <param name="removeChildren">Whether to remove and destroy all existing children in the container.</param>
        /// <remarks>
        /// An alternative way to add sprites to any container, making it possible to manually manage the <see cref="tk2dBaseSprite.Collection"/>
        /// and the option to keep any existing children in the container.
        /// </remarks>
        public static void AddSpriteObjectToContainer(this Girl girl, SpriteObject sprite, GirlPieceArt pieceArt, DisplayObject container, bool removeChildren = true)
        {
            if (sprite != null && pieceArt != null && container != null && !pieceArt.spriteName.IsNullOrWhiteSpace())
            {
                if (removeChildren && container.GetChildren().Length > 0)
                {
                    container.RemoveAllChildren(true);
                }

                container.AddChild(sprite);
                sprite.sprite.FlipX = girl.flip;
                var offsetX = girl.flip ? GameCamera.SCREEN_DEFAULT_WIDTH : 0;
                sprite.SetLocalPosition(Mathf.Abs(offsetX - pieceArt.x), -pieceArt.y);
            }
        }
Beispiel #4
0
    void CreateAlbumGroup()
    {
        AlbumGroup group;

        for (int i = 0; i < 10; i++)
        {
            group      = Create <AlbumGroup>();
            group.name = "albumGroup" + i;
            group.idx  = i;
            container.AddChild(group);

            group.transform.localPosition = new Vector3(i * DISTANCE_X, 0, 0);

            group.CreateGroup(i);

            albumGroups.Add(group);
        }

        // mask = CreateObject("Music/ClippingPlane");
        // AddChild(mask);
        // mask.transform.localPosition = new Vector3(0, -0.01f, 0);
    }