Пример #1
0
        public BackGround()
        {
            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.BackGroundStar2;
            AddComponent(spriteComponent);

            // 화면 내리는 효과를 주기 위한 컴포넌트
            ScrollingComponent scrolling = new ScrollingComponent(this);

            scrolling.ScrollY = true;
            scrolling.Speed   = 150;
            AddComponent(scrolling);

            // 애니메이션 컴포넌트
            AnimationSprite animationSprite = new AnimationSprite(this);

            animationSprite.ImageList.Add(Resources.BackGroundStar1);
            animationSprite.ImageList.Add(Resources.BackGroundStar2);
            animationSprite.ImageList.Add(Resources.BackGroundStar3);
            animationSprite.ImageChangeInterval = 0.2f;
            AddComponent(animationSprite);

            AddComponent(new BackGroundRePos(this));
        }
Пример #2
0
    public void WinHandler(int startrow, int startcol, int winner)
    {
        if (!win)
        {
            RemoveColor();
            win = true;
            if (winner == -1)
            {
                indicator[0].color = 0xffa0ffa0;
                wincells.Add(indicator[0]);
                indicator[1].color = 0xffa0ffa0;
                wincells.Add(indicator[1]);
            }
            else
            {
                indicator[2].color = 0xffa0ffa0;
                wincells.Add(indicator[2]);
                indicator[3].color = 0xffa0ffa0;
                wincells.Add(indicator[3]);
            }
        }
        AnimationSprite wincell = cell [startrow, startcol];

        wincell.color = 0xffa0ffa0;          // light green
        wincells.Add(wincell);
    }
Пример #3
0
        public UIInstructor(Vector2 headPosition, float[] headWidth, float[] headHeight, Vector2 scale, OriginType originType, List <AnimationFrame>[] frames, TimeSpan updateTime, ElementReference[] head, ElementReference[] body, Vector2[] speeds, bool isStan = false)
        {
            this.scale  = scale;
            this.frames = frames;
            this.speeds = speeds;

            this.headWidths  = headWidth;
            this.headHeights = headHeight;

            if (isStan)
            {
                offSet  = 10;
                xOffSet = 0;
            }
            else
            {
                offSet  = 12;
                xOffSet = 0;
            }

            for (int i = 0; i < frames.Length; i++)
            {
                Head[i] = new Sprite(headPosition, (int)headWidth[i], (int)headHeight[i], scale, Rectangle.Empty, originType)
                {
                    Element = head[i]
                };
                var currHead = Head[i];
                Body[i] = new AnimationSprite(new Vector2(currHead.Position.X + xOffSet, currHead.Position.Y + currHead.ScaledHeight / 2 + frames[i][0].SourceRectangle.Height * scale.Y / 2 - offSet), scale, updateTime, frames[i], originType)
                {
                    Element = body[i]
                };
            }

            runner.Start();
        }
Пример #4
0
    public OthelloView(OthelloBoard myboard, int centerx = 300, int centery = 300, int targetwidth = 480)
    {
        _myboard = myboard;

        // prepare graphics:
        cell = new AnimationSprite[myboard._height, myboard._width];
        for (int row = 0; row < _myboard._height; row++)
        {
            for (int col = 0; col < _myboard._width; col++)
            {
                AnimationSprite newcell = new AnimationSprite("../../assets/tileset.png", 3, 1);
                newcell.x = col * newcell.width;
                newcell.y = row * newcell.width;
                AddChild(newcell);
                newcell.SetFrame((_myboard[row, col] + 3) % 3);
                cell [row, col] = newcell;
            }
        }
        float realwidth = cell [0, 0].width * _myboard._width;

        scaleX = targetwidth / realwidth;
        scaleY = targetwidth / realwidth;
        x      = centerx - targetwidth / 2;
        y      = centery - targetwidth / 2;    // assuming that we have a square board

        // set callbacks:
        _myboard.OnCellChange += CellChangeHandler;
        _myboard.OnMark       += MarkHandler;

        //_myboard.OnWin += WinHandler;

        wincells = new List <AnimationSprite> ();
    }
Пример #5
0
    public void MarkHandler(int row, int col)
    {
        AnimationSprite Markedcell = cell [row, col];

        Markedcell.color = 0xffa0ffa0;          // light green
        MarkedList.Add(Markedcell);
    }
Пример #6
0
    public ConnectFourView(ConnectFourBoard myboard, int centerx = 300, int centery = 300, int targetwidth = 480)
    {
        _myboard = myboard;

        // prepare graphics:
        cell = new AnimationSprite[myboard._height, myboard._width];
        for (int row = 0; row < _myboard._height; row++)
        {
            for (int col = 0; col < _myboard._width; col++)
            {
                AnimationSprite newcell = new AnimationSprite("../../assets/tileset.png", 3, 1);
                newcell.x = col * newcell.width;
                newcell.y = row * newcell.width;
                AddChild(newcell);
                cell [row, col] = newcell;
            }
        }
        float realwidth = cell [0, 0].width * _myboard._width;

        scaleX = targetwidth / realwidth;
        scaleY = targetwidth / realwidth;
        x      = centerx - targetwidth / 2;
        y      = centery - targetwidth / 2;    // assuming #rows<=#columns

        // set callbacks:
        _myboard.OnCellChange += CellChangeHandler;

        _myboard.OnWin += WinHandler;

        wincells = new List <AnimationSprite> ();
    }
Пример #7
0
    void Update()
    {
        AnimationSprite aniPlay = transform.GetComponent <AnimationSprite>();

        if (Input.GetKey(KeyCode.D))
        {
            aniPlay.Animate(8, 2, 0, 0, 16, 12);
        }
    }
Пример #8
0
 public void WinHandler(int startrow, int startcol, int rowdir, int coldir, int length)
 {
     RemoveColor();
     for (int i = 0; i < length; i++)
     {
         AnimationSprite wincell = cell [startrow + rowdir * i, startcol + coldir * i];
         wincell.color = 0xffa0ffa0;              // light green
         wincells.Add(wincell);
     }
 }
Пример #9
0
        public Unit(string path, int cols, int rows, int frames = -1, bool keepInChache = false, bool addCollider = true) : base("playerHitBox.png")
        {
            alpha = 0.0f;


            SetOrigin(width / 2, height);
            SetXY(game.width / 2, game.height / 2);

            animationSprite = new AnimationSprite(path, cols, rows, -1, false, false);
            animationSprite.SetOrigin(animationSprite.width / 2, animationSprite.height);
            AddChild(animationSprite);
        }
Пример #10
0
    public HexView(HexBoard myboard, int centerx = 300, int centery = 300, int targetwidth = 480)
    {
        _myboard = myboard;

        // prepare graphics:
        cell = new AnimationSprite[myboard._height, myboard._width];
        for (int row = 0; row < _myboard._height; row++)
        {
            for (int col = 0; col < _myboard._width; col++)
            {
                AnimationSprite newcell = new AnimationSprite("../../assets/tileset.png", 3, 1);
                newcell.x = (col + 0.5f * row) * newcell.width;
                newcell.y = row * newcell.width;
                AddChild(newcell);
                cell [row, col] = newcell;
            }
        }
        float stdwidth = cell [0, 0].width;

        float realwidth = stdwidth * (_myboard._width) * 1.5f;

        scaleX = targetwidth / realwidth;
        scaleY = targetwidth / realwidth;
        x      = centerx - targetwidth / 2;
        y      = centery - targetwidth / 3;    // assuming that we have a square board

        indicator = new AnimationSprite[4];
        for (int i = 0; i < 4; i++)
        {
            indicator[i] = new AnimationSprite("../../assets/tileset.png", 3, 1);
            AddChild(indicator[i]);
        }
        indicator[0].x = 0;
        indicator[0].y = stdwidth * myboard._height / 2f;
        indicator[0].SetFrame(2);
        indicator[1].x = (myboard._width - 1) * stdwidth * 1.5f;
        indicator[1].y = stdwidth * (myboard._height - 2) / 2f;
        indicator[1].SetFrame(2);
        indicator[2].x = realwidth / 2 - 2.5f * stdwidth;
        indicator[2].y = -stdwidth * 1.5f;
        indicator[2].SetFrame(1);
        indicator[3].x = realwidth / 2 + stdwidth;
        indicator[3].y = realwidth * 2 / 3 + stdwidth * 0.5f;
        indicator[3].SetFrame(1);

        // set callbacks:
        _myboard.OnCellChange += CellChangeHandler;
        _myboard.OnHexWin     += WinHandler;

        wincells = new List <AnimationSprite> ();
    }
Пример #11
0
        public Enemy03()
        {
            Vec2D point = new Vec2D(-50, -50);

            transform.position = point;

            Tag = "Enemy";

            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.Enemy_03_01;
            AddComponent(spriteComponent);

            AnimationSprite animationSprite = new AnimationSprite(this);

            animationSprite.ImageList.Add(Resources.Enemy_03_01);
            animationSprite.ImageList.Add(Resources.Enemy_03_02);
            AddComponent(animationSprite);

            BoxCollider boxCollider = new BoxCollider(this);
            Size        boxSize     = spriteComponent.Image.Size;

            boxSize.Width   -= 5;
            boxSize.Height  -= 5;
            boxCollider.Size = boxSize;
            AddComponent(boxCollider);

            HealthSystem healthSystem = new HealthSystem(this);

            healthSystem.Health = 3;
            AddComponent(healthSystem);

            DamageSystem damageSystem = new DamageSystem(this);

            damageSystem.HitAbleTag = "Player";
            AddComponent(damageSystem);

            BezierCurveMove bezierCurveMove = new BezierCurveMove(this);

            AddComponent(bezierCurveMove);

            EnemyBulletShooter enemyBulletShooter = new EnemyBulletShooter(this);

            enemyBulletShooter.ShootMinRotation = 177;
            enemyBulletShooter.ShootMaxRotation = 183;
            enemyBulletShooter.FireRate         = 2f;
            enemyBulletShooter.FireProbability  = 50;
            AddComponent(enemyBulletShooter);
        }
Пример #12
0
        public Player()
        {
            Vec2D point = new Vec2D(100, 200);

            transform.position = point;

            Tag = "Player";

            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.player_1;
            AddComponent(spriteComponent);

            AnimationSprite animationSprite = new AnimationSprite(this);

            animationSprite.ImageList.Add(Resources.player_die_01);
            animationSprite.ImageList.Add(Resources.player_die_02);
            animationSprite.ImageList.Add(Resources.player_die_03);
            animationSprite.ImageList.Add(Resources.player_die_04);
            animationSprite.Enabled             = false;
            animationSprite.SpriteComponent     = spriteComponent;
            animationSprite.ImageChangeInterval = 0.1f;

            AddComponent(animationSprite);

            BoxCollider boxCollider = new BoxCollider(this);
            Size        boxSize     = spriteComponent.Image.Size;

            boxSize.Width   -= 5;
            boxSize.Height  -= 5;
            boxCollider.Size = boxSize;
            AddComponent(boxCollider);

            HealthSystem healthSystem = new HealthSystem(this);

            healthSystem.MaxHealth = 1;
            AddComponent(healthSystem);

            AddComponent(new InputComponent(this));


            AddComponent(new BulletShooter(this));

            TargetScrolling scrolling = new TargetScrolling(this);

            scrolling.Speed   = 100;
            scrolling.Enabled = false;
            AddComponent(scrolling);
        }
Пример #13
0
    internal void StopAnimSocial(AnimationSprite animationSprite)
    {
        AnimationSprite people = null;
        var dis = float.MaxValue;

        foreach (var item in ListPeopleRemoteAnim)
        {
            if (Vector3.Distance(item.transform.localPosition, animationSprite.transform.localPosition) < dis)
            {
                dis = Vector3.Distance(item.transform.localPosition, animationSprite.transform.localPosition);
                people = item;
            }
        }
        people.gameObject.SetActive(true);
        StartCoroutine(CloseSocial(people, animationSprite));
    }
Пример #14
0
    public TiledView(int pColumns, int pRows, int pTileSize, TileType pDefaultTileType)
    {
        Debug.Assert(pColumns > 0, "Invalid amount of columns passed in: " + pColumns);
        Debug.Assert(pRows > 0, "Invalid amount of rows passed in: " + pRows);
        Debug.Assert(pDefaultTileType != null, "Invalid default tile type passed in:" + pDefaultTileType);

        columns = pColumns;
        rows    = pRows;

        _defaultTileType = pDefaultTileType;

        //we use a single sprite to render the whole tileview
        _tileSet       = new AnimationSprite("../../assets/tileset.png", 3, 1);
        _tileSet.width = _tileSet.height = pTileSize;

        initializeTiles();
    }
    void Start()
    {
        playerLayerMask   = LayerMask.NameToLayer("Player");
        platformLayerMask = LayerMask.NameToLayer("Platforms");
        //groundLayerMask = LayerMask.NameToLayer("Ground");

        controller        = GetComponent <CharacterController>();
        controller.center = new Vector3(0, centerY, 0);

        graphics.transform.localScale = new Vector3(scaleX, scaleY, 0.1f);
        //transform.localScale = new Vector3(scaleX, scaleY, 0.1f);

        sprite = GetComponent <AnimationSprite>();
        sprite.AnimateSprite(4, 4, 0, 0, 14, 24);

        //playerSoundScript = GetComponent<PlayerSound>();
        playerProperties = GetComponent <PlayerProperties>();
    }
    void Start()
    {
        enableToShoot = true;
        progressiveColor = renderer.material.color;

        foreach (Transform item in transform)
        {
            gunTransform = item;
            gunTransform.localPosition = new Vector3(0, -0.75f, 0);
        }

        scriptAliensGroup = transform.parent.GetComponent<AliensGroup>();
        sprite = GetComponent<AnimationSprite>();

        prefabAmmo = (GameObject)Resources.Load("Ammo");
        prefabSparks = (GameObject)Resources.Load("Little Sparks");
        materialExplosion = (Material)Resources.Load("explosion");

        sideBar = GameObject.Find("Side Bar");
    }
    void Start()
    {
        enableToShoot    = true;
        progressiveColor = renderer.material.color;

        foreach (Transform item in transform)
        {
            gunTransform = item;
            gunTransform.localPosition = new Vector3(0, -0.75f, 0);
        }

        scriptAliensGroup = transform.parent.GetComponent <AliensGroup>();
        sprite            = GetComponent <AnimationSprite>();

        prefabAmmo        = (GameObject)Resources.Load("Ammo");
        prefabSparks      = (GameObject)Resources.Load("Little Sparks");
        materialExplosion = (Material)Resources.Load("explosion");

        sideBar = GameObject.Find("Side Bar");
    }
Пример #18
0
        void LoadTileLayer(int index)
        {
            if (map.Layers.Length <= index)
            {
                return;
            }
            uint[,] tiles = map.Layers[index].GetTileArrayRaw();
            for (int c = 0; c < tiles.GetLength(0); c++)
            {
                for (int r = 0; r < tiles.GetLength(1); r++)
                {
                    if (tiles[c, r] == 0)
                    {
                        continue;
                    }
                    uint    rawTileInfo = tiles[c, r];
                    int     frame       = TiledUtils.GetTileFrame(rawTileInfo);
                    TileSet tileSet     = map.GetTileSet(frame);
                    if (tileSet == null || tileSet.Image == null)
                    {
                        throw new Exception("The Tiled map contains unembedded tilesets (.tsx files) - please embed them in the map");
                    }

                    AnimationSprite Tile = new AnimationSprite(
                        Path.Combine(_foldername, tileSet.Image.FileName),
                        tileSet.Columns, tileSet.Rows,
                        -1, false, addColliders
                        );
                    Tile.SetFrame(frame - tileSet.FirstGId);
                    Tile.x = c * map.TileWidth;
                    // Adapting to Tiled's weird and inconsistent conventions again:
                    Tile.y = r * map.TileHeight - (Tile.height - map.TileHeight);
                    ChangeOrigin(Tile, 0.5f, 0.5f);
                    Tile.rotation = TiledUtils.GetRotation(rawTileInfo);
                    Tile.Mirror(TiledUtils.GetMirrorX(rawTileInfo), false);
                    ChangeOrigin(Tile, defaultOriginX, defaultOriginY, 0.5f, 0.5f);

                    rootObject.AddChild(Tile);
                }
            }
        }
Пример #19
0
        public Ball(int pRadius, AnimationSprite sprite, Vec2 position = null, Vec2 velocity = null, Vec2 acceleration = null)
            : base(pRadius * 2, pRadius * 2)
        {
            _spriteOverlay = sprite;
            _spriteOverlay.SetOrigin(_spriteOverlay.width / 2, _spriteOverlay.height / 2);
            AddChild(_spriteOverlay);
            radius       = pRadius;
            Position     = position;
            Velocity     = velocity;
            Acceleration = acceleration;

            _ballColor = Color.FromArgb(0x000000);

            Draw();
            if (Position != null)
            {
                x = Position.x;
                y = Position.y;
            }
            Step();
        }
Пример #20
0
        public Bomb(int i, int j, Rectangle rect, Rectangle leftLimit, Rectangle rightLimit, Rectangle topLimit, Rectangle bottomLimit, Point[] explosionLogicArea)
        {
            this.ExplosionArea = explosionLogicArea;
            this.i             = i;
            this.j             = j;
            canExplosionToTop  = canExplosionToBottom = canExplosionToLeft = canExplosionToRight = true;
            explosionArea      = new List <Rectangle>();
            var unit            = Global.Instance.GameUnit;
            var explosionOffset = unit / 2;

            explosionTexture           = ResManager.Instance.Explosion;
            explosionLevelIncreaseTime = 25;
            explosionLevel             = 1;
            countDownTime    = 3000;
            this.state       = BombState.CountDown;
            this.rect        = rect;
            this.leftLimit   = leftLimit;
            this.rightLimit  = rightLimit;
            this.topLimit    = topLimit;
            this.bottomLimit = bottomLimit;
            this.texture     = ResManager.Instance.Bomb;
            sprite           = new AnimationSprite();
            sprite.Load(this.texture, this.texture.Width / 8, this.texture.Height, 8, 0);
        }
Пример #21
0
    public Player(bool pInputEnabled = true) : base("player_base_sprite.png")
    {
        SetOriginToCenter();

        objectsToCheck = new GameObject[0];
        _inputEnabled  = pInputEnabled;

        _inputEnabled = pInputEnabled;
        alpha         = 0.0f;

        //Adjust a collider, based on a original image of 256x256
        _customColliderBounds = new Rectangle(-95 * 0.5f * _scale, (-95 * 0.5f * _scale), 95 * _scale,
                                              95 * _scale);

        _animation = new AnimationSprite("walking_animation.png", 8, 3, -1, false, false);
        AddChild(_animation);
        _animation.SetScaleXY(_scale, _scale);
        _animation.SetOriginToCenter();

        _fog1 = new Sprite("fog.png", true, false);
        AddChild(_fog1);
        _fog1.x = -_fog1.width / 2;
        _fog1.y = -_fog1.height / 2;

        _fog2 = new AnimationSprite("anim_fog.png", 2, 1, -1, true, false);

        _fog1.scale = 10;

        AddChild(_fog2);
        _fog2.x = x + 1000;

        _deceleration = 0.9f;
        _currentSpeed = _walkSpeed;
        _rand         = new Random();
        _frame        = 1;
    }
Пример #22
0
        private void AddExplosion(Vector2 position, ExplosionType type)
        {
            AnimationSprite temp;
            switch (type)
            {
                case ExplosionType.Big:
                    temp = new AnimationSprite(_explosionTextures[0],16);
                    break;
                case ExplosionType.Medium:
                    temp = new AnimationSprite(_explosionTextures[1], 16);
                    break;
                case ExplosionType.Bullet:
                    temp = new AnimationSprite(_explosionTextures[3], 16);
                    break;
                case ExplosionType.BulletUfo:
                    temp = new AnimationSprite(_explosionTextures[4], 16);
                    break;
                default:
                    temp = new AnimationSprite(_explosionTextures[2], 16);
                    break;
            }
            temp.Position = position;

            temp.Rotation = _random.Next(-6, 6);
            temp.Create();
            _explosions.Add(temp);
        }
Пример #23
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Set the sharing mode of the graphics device to turn on XNA rendering
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);

            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);

            // TODO: use this.content to load your game content here

            _barTex = _contentManager.Load<Texture2D>("Sprites/HealthBar2");
            _healthBar = new HealthBar(_barTex);
            _energyBar = new HealthBar(_barTex);
            _aidkitTexture = _contentManager.Load<Texture2D>("Sprites/aidkit");
            _ship = new AnimationSprite(_contentManager.Load<Texture2D>("Sprites/rocket"), 32)
                        {
                            Position = new Vector2(_screenWidth/2, _screenHeight/2)
                        };
            _ship.Life = LifeAmount;
            _ship.Energy = EnergyAmount;
            _ship.Create();
            _healthBar.Min = 0;
            _healthBar.Max = _ship.Life;
            _healthBar.Value = _ship.Life;
            _energyBar.Min = 0;
            _energyBar.Max = _ship.Energy;
            _energyBar.Value = _ship.Energy;

            _explosionTextures.Add(_contentManager.Load<Texture2D>("Sprites/explosionBig"));
            _explosionTextures.Add(_contentManager.Load<Texture2D>("Sprites/explosionMedium"));
            _explosionTextures.Add(_contentManager.Load<Texture2D>("Sprites/explosionSmall"));
            _explosionTextures.Add(_contentManager.Load<Texture2D>("Sprites/explosionBullet"));
            _explosionTextures.Add(_contentManager.Load<Texture2D>("Sprites/explosionBulletUfo"));

            _ufo = new AnimationSprite(_contentManager.Load<Texture2D>("Sprites/ufo"),10);
            _bullet = new Sprite(_contentManager.Load<Texture2D>("Sprites/bullet"));
            _ufobullet = new Sprite(_contentManager.Load<Texture2D>("Sprites/ufobullet"));
            _specialBulletTexture = _contentManager.Load<Texture2D>("Sprites/specialbullet");
            for (int i = 1; i < 4; i++)
                _asteroidTextures.Add(
                    _contentManager.Load<Texture2D>("Sprites/large" + i));

            for (int i = 1; i < 4; i++)
                _asteroidTextures.Add(
                    _contentManager.Load<Texture2D>("Sprites/medium" + i));

            for (int i = 1; i < 4; i++)
                _asteroidTextures.Add(
                    _contentManager.Load<Texture2D>("Sprites/small" + i));

            _myFont = _contentManager.Load<SpriteFont>("Sprites/font01");
            _myFont2 = _contentManager.Load<SpriteFont>("Sprites/font02");
            _control = _contentManager.Load<Texture2D>("Sprites/control");
            _backgroundTexture = _contentManager.Load<Texture2D>("Sprites/BG");
            // Start the timer
            _timer.Start();

            base.OnNavigatedTo(e);
        }
Пример #24
0
        //--------------------------------------------------------------------------------------------
        // REGION: private methods (for reading single layers from the Tiled file).
        //--------------------------------------------------------------------------------------------

        void LoadObjectGroup(int index, bool autoInstance = false)
        {
            if (map.ObjectGroups.Length <= index)
            {
                return;
            }
            ObjectGroup group = map.ObjectGroups[index];

            if (group.Objects == null)
            {
                return;
            }
            foreach (TiledObject obj in group.Objects)
            {
                obj.Initialize();
                Sprite newSprite = null;

                if (_manualObjects.Contains(obj.Type))
                {
                    // Don't create an object, just fire the event and let the user create something.
                    //Console.WriteLine("Skipping object because type is in manual list: "+obj);
                }
                else if (obj.ImageID >= 0)                   // Create an AnimationSprite
                {
                    TileSet tileSet = map.GetTileSet(obj.ImageID);
                    if (tileSet == null || tileSet.Image == null)
                    {
                        throw new Exception("The Tiled map contains unembedded tilesets (.tsx files) - please embed them in the map");
                    }

                    int frame = obj.ImageID - tileSet.FirstGId;
                    //Console.WriteLine("Creating image object: "+obj);

                    AnimationSprite anim = null;
                    if (autoInstance && obj.Type != null)
                    {
                        try {
                            anim = (AnimationSprite)Activator.CreateInstance(Type.GetType(obj.Type),
                                                                             new object[] { Path.Combine(_foldername, tileSet.Image.FileName), tileSet.Columns, tileSet.Rows, obj });
                        } catch (Exception error) {
                            Console.WriteLine("Couldn't automatically create an AnimationSprite object from the Tiled (image) object with ID {0} and type {1}.\n Error: {2}", obj.ID, obj.Type, error.Message);
                        }
                    }
                    if (anim == null)
                    {
                        anim = new AnimationSprite(Path.Combine(_foldername, tileSet.Image.FileName), tileSet.Columns, tileSet.Rows, -1, false, addColliders);
                    }
                    anim.Mirror(obj.MirrorX, obj.MirrorY);
                    anim.SetFrame(frame);
                    newSprite = anim;
                }
                else if (obj.textField != null)
                {
                    //Console.WriteLine("Creating text object: "+obj);

                    EasyDraw message = CreateTextField(obj, addColliders, highQualityText);

                    DrawText(message, obj.textField.text);

                    newSprite = message;
                }
                else
                {
                    //Console.WriteLine("Skipping non-graphical object: "+obj);
                    if (autoInstance && obj.Type != "")
                    {
                        try {
                            newSprite = (Sprite)Activator.CreateInstance(Type.GetType(obj.Type),
                                                                         new object[] { obj });
                        } catch (Exception error) {
                            Console.WriteLine("Couldn't automatically create a sprite object from the Tiled (shape) object with ID {0} and type {1}.\n Error: {2}", obj.ID, obj.Type, error.Message);
                        }
                    }
                }

                if (newSprite != null)
                {
                    SetPositionRotationScaleOrigin(newSprite, obj, defaultOriginX, defaultOriginY);
                    rootObject.AddChild(newSprite);
                }
                if (OnObjectCreated != null)
                {
                    OnObjectCreated(newSprite, obj);
                }
            }
        }
Пример #25
0
    public PentagoView(PentagoBoard myboard, int centerx = 300, int centery = 300, int targetwidth = 480)
    {
        _myboard = myboard;

        // prepare graphics:
        cell = new AnimationSprite[myboard._height, myboard._width];
        for (int row = 0; row < _myboard._height; row++)
        {
            for (int col = 0; col < _myboard._width; col++)
            {
                AnimationSprite newcell = new AnimationSprite("../../assets/tileset.png", 3, 1);
                newcell.x = col * newcell.width;
                newcell.y = row * newcell.width;
                AddChild(newcell);
                cell [row, col] = newcell;
            }
        }
        float stdwidth = cell[0, 0].width;

        arrow = new AnimationSprite[8];
        for (int i = 0; i < 8; i++)
        {
            arrow [i] = new AnimationSprite("../../assets/arrow-sprite.png", 2, 2);
            AddChild(arrow [i]);
            arrow [i].SetScaleXY(stdwidth / arrow[i].width, stdwidth / arrow[i].width);
            arrow [i].color = 0xff000000;
        }

        /*
         *              0	TL CW
         *              1   BL CW
         *              2   TR CW
         *              3	BR CW
         *              4	TL ACW
         *              5   BL ACW
         *              6   TR ACW
         *              7	BR ACW
         */
        arrow [0].x = stdwidth * 1;
        arrow [0].y = stdwidth * -1;
        arrow [0].SetFrame(1);
        arrow [1].x = stdwidth * -1;
        arrow [1].y = stdwidth * 4;
        arrow [1].SetFrame(2);
        arrow [2].x = stdwidth * 6;
        arrow [2].y = stdwidth * 1;
        arrow [2].SetFrame(3);
        arrow [3].x = stdwidth * 4;
        arrow [3].y = stdwidth * 6;
        arrow [3].SetFrame(0);

        arrow [4].x = stdwidth * -1;
        arrow [4].y = stdwidth * 1;
        arrow [4].SetFrame(3);
        arrow [5].x = stdwidth * 1;
        arrow [5].y = stdwidth * 6;
        arrow [5].SetFrame(1);
        arrow [6].x = stdwidth * 4;
        arrow [6].y = stdwidth * -1;
        arrow [6].SetFrame(0);
        arrow [7].x = stdwidth * 6;
        arrow [7].y = stdwidth * 4;
        arrow [7].SetFrame(2);


        float realwidth = stdwidth * 8;

        scaleX = targetwidth / realwidth;
        scaleY = targetwidth / realwidth;
        x      = centerx - targetwidth / 2 + scaleX * stdwidth;
        y      = centery - targetwidth / 2 + scaleX * stdwidth;

        // set callbacks:
        _myboard.OnCellChange += CellChangeHandler;

        _myboard.OnWin += WinHandler;

        wincells = new List <AnimationSprite> ();
    }
Пример #26
0
 public void animateState(AnimationSprite animator)
 {
     int[] variables = AnimationVars.variables[ID];
     animator.animateSprite(variables[0],variables[1],variables[2],variables[3],variables[4],variables[5]);
 }
Пример #27
0
 void Start()
 {
     sceneManager = GameObject.Find("SceneManager").GetComponent<SceneManager>();
     animation= GetComponent<AnimationSprite>();
     fsm = new PlayerFSM();
 }
Пример #28
0
    public BoardGame()  : base(800, 600, false, true)
    {
        AddChild(new Sprite("../../assets/wood.jpg"));

        Player [0] = new Human("Human");
        Player [1] = new RandomPlayer("Random");
        Player [2] = new RandomPlayer("Random+", true);
        Player [3] = new Greedy("Greedy");
        Player [4] = new MonteCarlo("Carlo20", 20, true);
        Player [5] = new MonteCarlo("Carlo200", 200, true);
        Player [6] = new MiniMax("MiMax3", 3, true);
        Player [7] = new MiniMax("MiMaxFull", -1, true);
        Player [8] = new MiniCarlo("MiniCarlo", 2, 200);
        Player [9] = new AgentMain.Alpha("Alpha");

        startingplayer = -1;

        state = GameState.Menu;

        gameChoiceButton = new OptionButton(190, 30, 600, 15, new string[] { "Tic Tac Toe", "Tic Tac 5", "Connect Four", "Pentago", "Gomoku 9x9", "Domineering 7x7", "Domineering 9x9", "Othello", "Hex 7x7", "Hex 10x10" });    // , "Gomoku 15x15"
        AddChild(gameChoiceButton);
        gameChoiceButton.OnButtonClick += RegisterBoardChoice;

        matchSize = new OptionButton(190, 30, 600, 55, new string[] { "Best of 1", "Best of 2", "Best of 3", "Best of 4", "Best of 5", "Best of 6" });
        AddChild(matchSize);
        gameLength = new OptionButton(190, 30, 600, 95, new string[] { "1 minute", "2 minutes", "5 minutes", "9 minutes", "No timer" });
        AddChild(gameLength);
        autoPlay = new OptionButton(190, 30, 600, 560, new string[] { "Autoplay off", "Autoplay on" });
        AddChild(autoPlay);
        compareAIButton = new OptionButton(190, 30, 600, 520, new string[] { "Normal Games", "Compare AI" });
        AddChild(compareAIButton);

        playerSelect    = new OptionButton[2];
        playerIndicator = new AnimationSprite[2];
        score           = new Button[2];
        clock           = new StopWatch[2];

        string[] playerNames = new string[Player.Length];
        for (int i = 0; i < Player.Length; i++)
        {
            playerNames [i] = Player [i].name;
        }

        for (int p = 0; p < 2; p++)
        {
            playerSelect [p] = new OptionButton(100, 30, 130 + 240 * p, 15, playerNames);
            AddChild(playerSelect [p]);

            playerIndicator [p] = new AnimationSprite("../../assets/tileset.png", 3, 1);
            playerIndicator [p].SetFrame(2 - p);
            playerIndicator [p].SetScaleXY(0.3f, 0.3f);
            playerIndicator [p].SetXY(245 + 75 * p, 10);          // assuming width=35?
            AddChild(playerIndicator [p]);

            score[p] = new Button(30, 30, 90 + 390 * p, 15, "0");
            AddChild(score [p]);

            clock[p]            = new StopWatch(60, 30, 20 + 500 * p, 15, 300000);
            clock[p].OnTimeOut += TimeOut;
            AddChild(clock [p]);
        }
        message = new Button(400, 30, 100, 560, "Choose game and press Start Match");
        AddChild(message);

        startButton = new OptionButton(190, 30, 600, 200, new string[] { "Start New Match", "End Match" });
        AddChild(startButton);
        startButton.OnButtonClick += StartButtonPress;
    }
Пример #29
0
    public Level(int numberOfLevel, float pSoundVolume) : base()
    {
        levelSound          = new Sound("level_music_v2.mp3", true, true);
        soundChannel        = levelSound.Play();
        soundChannel.Volume = pSoundVolume;

        _cursorIMG = new Sprite("HUD/cursor_PNG50.png");
        scoreBoard = new Sprite("HUD/score_board.png");

        fon      = new Sprite("Level background hazy.png");
        fonblack = new Sprite("blackpng.png");
        AddChild(fon);
        level     = numberOfLevel;
        thatlevel = this;
        magwf     = new Sprite("magnet.png");
        trampwf   = new Sprite("trampoline.png");
        shlfwf    = new Sprite("shelfBig.png");
        levelC    = new LevelChanger("bucket.png");

        _ball = new Ball(30, ballStartPos, thatlevel);

        crane = new AnimationSprite("spritesheet.png", 6, 1);

        magwf.SetXY(-500, -500);
        trampwf.SetXY(-500, -500);
        shlfwf.SetXY(-500, -500);
        levelC.SetXY(-500, -500);
        _lines            = new List <NLineSegment>();
        _tramps           = new List <Trampoline>();
        _magas            = new List <Magnit>();
        _shelves          = new List <Shelf>();
        _boxes            = new List <Sprite>();
        boardWothScore    = new TextBoard(220, 200);
        boardWothScore.x += game.width / 2 - 110;
        boardWothScore.y += game.height - 175;
        scoreBoard.SetXY(game.width / 2 - scoreBoard.width / 2, game.height - scoreBoard.height);

        menuButton = new Sprite("HUD/exit.png");
        menuButton.SetXY(game.width - menuButton.width * 1.5f, 15);



        _hud = new Constructor();



        oldBallDistance = 0;

        LoadScene(level);
        //LoadScene(4);


        AddChild(shlfwf);
        AddChild(magwf);
        AddChild(trampwf);

        AddChild(scoreBoard);
        AddChild(boardWothScore);
        AddChild(menuButton);

        AddChild(levelC);
        AddChild(crane);
        AddChild(_hud);
        //AddChild(fonblack);
        _clickSound = new Sound("1.mp3");
        crane.SetFrame(0);
        AddChild(_cursorIMG);
        //fonblack.alpha = 0.1f;
    }
Пример #30
0
 private void DeadSpriteCreator()
 {
     _deadSprite = new AnimationSprite(UtilStrings.SpritesPlayer + "spritesheet_hero_death.png", 4, 2);
     _deadSprite.SetOrigin(_deadSprite.width/2, 24);
     _deadSprite.visible = false;
 }
Пример #31
0
 public void CreateAnimLogo()
 {
     _animationLogo = new AnimationSprite("AnimationLogo.png", 23, 1);
     AddChild(_animationLogo);
     _animationLogo.SetXY(0, -50);
 }
Пример #32
0
        private bool CheckShipCollision(AnimationSprite obj, int tolerance)
        {
            Vector2 position1 = obj.Position;
            Vector2 position2 = _ship.Position;

            //obliczanie przyprostkatnych
            float cathetus1 = Math.Abs(position1.X - position2.X);
            float cathetus2 = Math.Abs(position1.Y - position2.Y);

            cathetus1 *= cathetus1;
            cathetus2 *= cathetus2;

            _distance = (float)Math.Sqrt(cathetus1 + cathetus2);

            if ((int)_distance < _ship.Width + tolerance )
                return true;

            return false;
        }
Пример #33
0
        private bool CheckUfoCollision(AnimationSprite ufo, Sprite bullet, int tolerance)
        {
            Vector2 position1 = ufo.Position;
            Vector2 position2 = bullet.Position;

            float cathetus1 = Math.Abs(position1.X - position2.X);
            float cathetus2 = Math.Abs(position1.Y - position2.Y);

            cathetus1 *= cathetus1;
            cathetus2 *= cathetus2;

            _distance = (float)Math.Sqrt(cathetus1 + cathetus2);

            return (int)_distance < ufo.Width + tolerance;
        }
    void Start()
    {
        playerLayerMask = LayerMask.NameToLayer("Player");
        platformLayerMask = LayerMask.NameToLayer("Platforms");
        //groundLayerMask = LayerMask.NameToLayer("Ground");

        controller = GetComponent<CharacterController>();
        controller.center = new Vector3(0, centerY, 0);

        graphics.transform.localScale = new Vector3(scaleX, scaleY, 0.1f);
        //transform.localScale = new Vector3(scaleX, scaleY, 0.1f);

        sprite = GetComponent<AnimationSprite>();
        sprite.AnimateSprite(4, 4, 0, 0, 14, 24);

        //playerSoundScript = GetComponent<PlayerSound>();
        playerProperties = GetComponent<PlayerProperties>();
    }
Пример #35
0
    void ResetBall(int sceneNumber)
    {
        _startSceneNumber = sceneNumber;
        _ball.LateDestroy();
        crane.LateDestroy();
        _hud.LateDestroy();
        switch (sceneNumber)
        {
        case 1:     // level one
            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(185, 30);
            ballStartPos = new Vec2(290, 240);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            _hud         = new Constructor();
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            break;

        case 2:     // level two
            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(785, 30);
            ballStartPos = new Vec2(890, 240);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            _hud         = new Constructor();
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            break;

        case 3:     // level tree
            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(565, 30);
            ballStartPos = new Vec2(670, 240);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            _hud         = new Constructor();
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            break;

        case 4:     // level 4
            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(1395, 60);
            ballStartPos = new Vec2(1500, 270);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            _hud         = new Constructor();
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            break;

        default:     //

            break;
        }
    }
Пример #36
0
 void Start()
 {
     animator = new AnimationSprite(10 /*tiles per row*/, 1 /*rowSize*/, 0 /*colFrameStart*/, 0 /*rowFrameStart*/, 10 /*total frames in all columns*/, 1 /*frames per second*/);
 }
Пример #37
0
 IEnumerator CloseSocial(AnimationSprite people, AnimationSprite social)
 {
     yield return new WaitForSeconds(5);
     people.gameObject.SetActive(false);
     social.gameObject.SetActive(false);
 }
Пример #38
0
 void Start()
 {
     animator = CreateAnimator();
 }
Пример #39
0
 private void SetBackground()
 {
     _background = new AnimationSprite(UtilStrings.SpritesBack + "background game.png", 7, 3);
     AddChild(_background);
 }
Пример #40
0
 private IEnumerator OffAnim(AnimationSprite anim)
 {
     yield return new WaitForSeconds(RandomLogic.GetRandom(5, 9));
     anim.gameObject.SetActive(false);
 }
Пример #41
0
    void LoadScene(int sceneNumber)
    {
        _startSceneNumber = sceneNumber;
        isGameStarted     = false;
        // remove previous scene:
        foreach (NLineSegment lineAng in _lines)
        {
            lineAng.Destroy();
        }
        _lines.Clear();

        foreach (Trampoline trampoline in _tramps)
        {
            trampoline.Destroy();
        }
        _tramps.Clear();

        foreach (Magnit maga in _magas)
        {
            maga.Destroy();
        }
        _magas.Clear();

        foreach (Shelf polka in _shelves)
        {
            polka.Destroy();
        }
        _shelves.Clear();

        foreach (Sprite korobka in _boxes)
        {
            korobka.Destroy();
        }
        _boxes.Clear();

        // boundary:


        AddTrampoline(new Vec2(213131, 12312312), new Vec2(12313123, 123131), 0);
        AddMagnete(new Vec2(12312, 123132), new Vec2(123123, 123123), 0);
        AddShelf(new Vec2(12312, 123132), new Vec2(123123, 123123), 0);
        levelC.LateDestroy();
        _ball.LateDestroy();
        _hud.LateDestroy();
        crane.LateDestroy();
        _cursorIMG.LateDestroy();
        //fonblack.LateDestroy();
        //scoreBoard.LateDestroy();
        //boardWothScore.LateDestroy();
        //menuButton.LateDestroy();
        switch (sceneNumber)
        {
        case 1:     // level two
            AddBox(new Vec2(-5, -5));
            AddBox(new Vec2(-5, 125));
            AddBox(new Vec2(-5, 255));
            AddBox(new Vec2(-5, 385));
            AddBox(new Vec2(-5, 515));
            AddBox(new Vec2(-5, 645));
            AddBox(new Vec2(-5, 775));
            AddBox(new Vec2(-5, 905));
            AddBox(new Vec2(-5, 1035));

            //AddBox(new Vec2(game.width - 125, -5));
            AddBox(new Vec2(1870, 125));
            AddBox(new Vec2(1870, 255));
            AddBox(new Vec2(1870, 385));
            AddBox(new Vec2(1870, 515));
            AddBox(new Vec2(1870, 645));
            AddBox(new Vec2(1870, 775));
            AddBox(new Vec2(1870, 905));
            //AddBox(new Vec2(game.width - 125, 1035));

            AddBox(new Vec2(120, -5));
            AddBox(new Vec2(245, -5));
            AddBox(new Vec2(370, -5));
            AddBox(new Vec2(495, -5));
            AddBox(new Vec2(620, -5));
            AddBox(new Vec2(745, -5));
            AddBox(new Vec2(870, -5));
            AddBox(new Vec2(995, -5));
            AddBox(new Vec2(1120, -5));
            AddBox(new Vec2(1245, -5));
            AddBox(new Vec2(1370, -5));
            AddBox(new Vec2(1495, -5));
            AddBox(new Vec2(1620, -5));
            AddBox(new Vec2(1745, -5));
            AddBox(new Vec2(1870, -5));

            AddBox(new Vec2(120, 905));
            AddBox(new Vec2(245, 905));
            AddBox(new Vec2(370, 905));
            AddBox(new Vec2(495, 905));
            AddBox(new Vec2(620, 905));
            AddBox(new Vec2(745, 905));
            AddBox(new Vec2(870, 905));
            AddBox(new Vec2(995, 905));
            AddBox(new Vec2(1120, 905));
            AddBox(new Vec2(1245, 905));
            AddBox(new Vec2(1370, 905));
            AddBox(new Vec2(1495, 905));
            AddBox(new Vec2(1620, 905));
            AddBox(new Vec2(1745, 905));
            AddBox(new Vec2(1870, 905));

            AddBox(new Vec2(120, 1035));
            AddBox(new Vec2(245, 1035));
            AddBox(new Vec2(370, 1035));
            AddBox(new Vec2(495, 1035));
            AddBox(new Vec2(620, 1035));
            AddBox(new Vec2(745, 1035));
            AddBox(new Vec2(870, 1035));
            AddBox(new Vec2(995, 1035));
            AddBox(new Vec2(1120, 1035));
            AddBox(new Vec2(1245, 1035));
            AddBox(new Vec2(1370, 1035));
            AddBox(new Vec2(1495, 1035));
            AddBox(new Vec2(1620, 1035));
            AddBox(new Vec2(1745, 1035));
            AddBox(new Vec2(1870, 1035));



            AddLine(new Vec2(game.width - 50, game.height - 175), new Vec2(129, game.height - 175));
            AddLine(new Vec2(129, game.height - 175), new Vec2(129, 134));
            AddLine(new Vec2(129, 134), new Vec2(game.width - 50, 134));
            AddLine(new Vec2(game.width - 50, 134), new Vec2(game.width - 50, game.height - 175));

            //AddLine(new Vec2(1179, game.height / 2 - 100), new Vec2(800, game.height / 2 - 100));
            //AddLine(new Vec2(800, game.height / 2 + 34), new Vec2(1179, game.height / 2 + 34));
            //AddLine(new Vec2(800, game.height / 2 - 100), new Vec2(800, game.height / 2 + 34));
            //AddLine(new Vec2(1179, game.height / 2 + 34), new Vec2(1179, game.height / 2 - 100));
            _hud   = new Constructor();
            levelC = new LevelChanger("bucket.png");
            levelC.SetXY(1750, 820);
            ballStartPos = new Vec2(290, 240);
            //crane = new AnimationSprite("spritesheet.png", 3, 2);
            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(185, 30);
            _ball = new Ball(30, ballStartPos, thatlevel);
            AddChild(levelC);
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            score = 1000;



            boardWothScore    = new TextBoard(220, 200);
            boardWothScore.x += game.width / 2 - 110;
            boardWothScore.y += game.height - 175;
            scoreBoard.SetXY(game.width / 2 - scoreBoard.width / 2, game.height - scoreBoard.height);

            menuButton = new Sprite("HUD/exit.png");
            menuButton.SetXY(game.width - menuButton.width * 1.5f, 15);
            AddChild(scoreBoard);
            AddChild(boardWothScore);
            AddChild(menuButton);

            _cursorIMG = new Sprite("HUD/cursor_PNG50.png");
            AddChild(_cursorIMG);

            break;

        case 2:     // level one

            AddBox(new Vec2(800, game.height / 2 - 100));
            AddBox(new Vec2(925, game.height / 2 - 100));
            AddBox(new Vec2(1050, game.height / 2 - 100));

            AddLine(new Vec2(1179, game.height / 2 - 100), new Vec2(800, game.height / 2 - 100));
            AddLine(new Vec2(800, game.height / 2 + 34), new Vec2(1179, game.height / 2 + 34));
            AddLine(new Vec2(800, game.height / 2 - 100), new Vec2(800, game.height / 2 + 34));
            AddLine(new Vec2(1179, game.height / 2 + 34), new Vec2(1179, game.height / 2 - 100));

            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(785, 30);
            _hud   = new Constructor();
            levelC = new LevelChanger("bucket.png");
            levelC.SetXY(960, 870);
            ballStartPos = new Vec2(890, 240);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            AddChild(levelC);
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            score = 100;



            _cursorIMG = new Sprite("HUD/cursor_PNG50.png");
            AddChild(_cursorIMG);
            break;

        case 3:     // level two
            AddBox(new Vec2(900, -5));
            AddBox(new Vec2(900, 125));
            AddBox(new Vec2(900, 255));



            AddLine(new Vec2(900, -5), new Vec2(900, 255 + 134));
            AddLine(new Vec2(1029, 255 + 134), new Vec2(1029, -5));
            AddLine(new Vec2(900, 255 + 134), new Vec2(1029, 255 + 134));
            AddLine(new Vec2(1029, -5), new Vec2(900, -5));


            levelC = new LevelChanger("bucket.png");
            AddBox(new Vec2(1735, 690));
            AddBox(new Vec2(1735, 820));
            AddBox(new Vec2(1735, 950));

            AddLine(new Vec2(1735 + 129, 690), new Vec2(1735, 690));
            AddLine(new Vec2(1735, 690), new Vec2(1735, 950 + 134));
            AddLine(new Vec2(1735 + 129, 950 + 134), new Vec2(1735 + 129, 690));

            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(565, 30);
            _hud = new Constructor();
            levelC.SetXY(1800, 620);
            ballStartPos = new Vec2(670, 240);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            AddChild(levelC);
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            score = 150;



            _cursorIMG = new Sprite("HUD/cursor_PNG50.png");
            AddChild(_cursorIMG);
            break;

        case 4:     // level one
            AddBox(new Vec2(900, -5));
            AddBox(new Vec2(900, 125));
            AddBox(new Vec2(900, 255));

            AddLine(new Vec2(900, -5), new Vec2(900, 255 + 134));
            AddLine(new Vec2(1029, 255 + 134), new Vec2(1029, -5));
            AddLine(new Vec2(900, 255 + 134), new Vec2(1029, 255 + 134));
            AddLine(new Vec2(1029, -5), new Vec2(900, -5));

            AddBox(new Vec2(1235, -5));
            AddBox(new Vec2(1235, 125));
            AddBox(new Vec2(1235, 255));

            AddLine(new Vec2(1235, -5), new Vec2(1235, 255 + 134));
            AddLine(new Vec2(1235 + 129, 255 + 134), new Vec2(1235 + 129, -5));
            AddLine(new Vec2(1235, 255 + 134), new Vec2(1235 + 129, 255 + 134));
            AddLine(new Vec2(1235 + 129, -5), new Vec2(1235, -5));

            AddBox(new Vec2(900, 810));

            AddLine(new Vec2(900, 810), new Vec2(900, 810 + 134));
            AddLine(new Vec2(1029, 810 + 134), new Vec2(1029, 810));
            AddLine(new Vec2(900, 810 + 134), new Vec2(1029, 810 + 134));
            AddLine(new Vec2(1029, 810), new Vec2(900, 810));

            levelC = new LevelChanger("bucket.png");
            AddBox(new Vec2(1235, 690));
            AddBox(new Vec2(1235, 820));
            AddBox(new Vec2(1235, 950));

            AddLine(new Vec2(1235 + 129, 690), new Vec2(1235, 690));
            AddLine(new Vec2(1235, 690), new Vec2(1235, 950 + 134));
            AddLine(new Vec2(1235 + 129, 950 + 134), new Vec2(1235 + 129, 690));

            crane = new AnimationSprite("spritesheet.png", 6, 1);
            crane.SetFrame(0);
            crane.SetXY(1395, 60);

            //levelC.SetXY(1800, 620);
            levelC.SetXY(750, 920);
            AddBox(new Vec2(685, 990));
            ballStartPos = new Vec2(1500, 270);
            _ball        = new Ball(30, ballStartPos, thatlevel);
            _hud         = new Constructor();
            AddChild(levelC);
            AddChild(_hud);
            AddChild(_ball);
            AddChild(crane);
            score = 150;



            _cursorIMG = new Sprite("HUD/cursor_PNG50.png");
            AddChild(_cursorIMG);
            break;

        default:     //

            break;
        }
    }
Пример #42
0
 void Start()
 {
     animator   = CreateAnimator();
     controller = GetComponent <CharacterController>();
 }