Beispiel #1
0
    // Use this for initialization
    public void init(int dir, Tile start, MarbleManager m)
    {
        manager = m;
        speed   = 1;
        curTile = start;

        GameObject modelObject;

        modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
        model       = modelObject.AddComponent <BombModel>();
        model.init(this);
        direction  = dir;
        targetTile = start;
    }
Beispiel #2
0
        private void Bombs(float timer)
        {
            space += timer;

            foreach (BombView bomb in bombs)
            {
                m_BombModel.Update();

                if (m_View.playerRectangle().Intersects(bomb.BombRectangle()))
                {
                    m_BombEffect.Play();
                    isHit = true;
                    model.getPlayerDefaultPosition();
                    model.GhostDefaultPosition();
                    model.loseALife();
                }
            }

            if (isHit)
            {
                bombs.Clear();
                isHit = false;
            }


            // the space between the boms is larger or equals 5 , make it zero.
            if (space >= 5)
            {
                space = 0;

                // add bombs position
                m_BombModel = new BombModel(new Vector2(GraphicsDevice.Viewport.Width / 1.5f, GraphicsDevice.Viewport.Height / 6), CurrentLevel);
                bombs.Add(new BombView(Content, m_BombModel));


                // Remove the bomb if it is not visible any more.
                for (int i = 0; i < bombs.Count; i++)
                {
                    if (m_BombModel.isHidden)
                    {
                        bombs.RemoveAt(i);
                        i -= 1;
                    }
                }
            }
        }
 public BombView(Microsoft.Xna.Framework.Content.ContentManager Content, BombModel BombModel)
 {
     this.m_BombModel = BombModel;
     this.Content     = Content;
     bombTexture      = Content.Load <Texture2D>("bomb");
 }