コード例 #1
0
        public void Initialize()
        {
            rootCanvas.Children.Clear();

            if (oPlayer == null)
            {
                oPlayer = new Player();
            }
            oPlayer.Initialize();

            rootCanvas.Children.Add(oPlayer.GetObject());

            if (oMissile == null)
            {
                oMissile = new List <Object>();
            }
            else
            {
                oMissile.Clear();
            }

            for (int i = 0; i < 50; i++)
            {
                NormalMissile missile = new NormalMissile();
                missile.Initialize();
                rootCanvas.Children.Add(missile.GetObject());
                oMissile.Add(missile);
            }
            misiilleCount = 50;
        }
コード例 #2
0
        public void AddMissile(object sender, EventArgs e)
        {
            Object missile;

            misiilleCount++;
            if (misiilleCount % 5 == 0)
            {
                missile = new GuidedMissile();
                ((GuidedMissile)missile).SetTarget(oPlayer);
            }
            else
            {
                missile = new NormalMissile();
            }

            if (misiilleCount % 10 == 0)
            {
                missile = new Bomb();
            }

            missile.Initialize();
            missile.Render();

            oMissile.Add(missile);
            rootCanvas.Children.Add(missile.GetObject());
        }