예제 #1
0
        public override void IsOver()
        {
            if (this.Life <= 0)
            {
                SingleObject.GetSingle().RemoveGameObject(this);
                SingleObject.GetSingle().AddGameObject(new EnemyBoom(this.x, this.y, this.EnemyType));
                switch (this.EnemyType)
                {
                case 0:
                    if (Forms.Form1.lost == false)
                    {
                        SingleObject.GetSingle().Score += 10;
                    }
                    break;

                case 1:
                    if (Forms.Form1.lost == false)
                    {
                        SingleObject.GetSingle().Score += 20;
                    }
                    break;

                case 2:
                    if (Forms.Form1.lost == false)
                    {
                        SingleObject.GetSingle().Score += 30;
                    }
                    break;
                }
            }
        }
예제 #2
0
        public override void Draw(Graphics g)
        {
            switch (this.Type)
            {
            case 0:
                for (int i = 0; i < imgs1.Length; i++)
                {
                    g.DrawImage(imgs1[i], this.x, this.y);
                }
                break;

            case 1:
                for (int i = 0; i < imgs2.Length; i++)
                {
                    g.DrawImage(imgs2[i], this.x, this.y);
                }
                break;

            case 2:
                for (int i = 0; i < imgs3.Length; i++)
                {
                    g.DrawImage(imgs3[i], this.x, this.y);
                }
                break;
            }
            SingleObject.GetSingle().RemoveGameObject(this);
        }
예제 #3
0
 public void Fire()
 {
     if (Forms.Form1.shoottimer > 7)
     {
         SingleObject.GetSingle().AddGameObject(new HeroBullet(this, 10, 1));
         Forms.Form1.shoottimer = 0;
     }
 }
예제 #4
0
 public static SingleObject GetSingle()
 {
     if (_single == null)
     {
         _single = new SingleObject();
     }
     return(_single);
 }
예제 #5
0
 public override void Draw(Graphics g)
 {
     for (int i = 0; i < imgs.Length; i++)
     {
         g.DrawImage(imgs[i], this.x, this.y, imgs[i].Width / 2, imgs[i].Height / 2);
     }
     SingleObject.GetSingle().RemoveGameObject(this);
 }
예제 #6
0
        public override void Move()
        {
            switch (this.Dir)
            {
            case Direction.up:
                this.y -= this.Speed;
                break;

            case Direction.down:
                this.y += this.Speed;
                break;

            case Direction.left:
                this.x -= this.Speed;
                break;

            case Direction.right:
                this.x += this.Speed;
                break;
            }
            if (this.y <= 0)
            {
                invulnerable = true;
            }
            else
            {
                invulnerable = false;
            }

            if (this.x <= 0)
            {
                this.x = 0;
            }
            if (this.x > 280)
            {
                this.x = 280;
            }
            if (this.y >= 780)
            {
                this.y = 1400;
                SingleObject.GetSingle().RemoveGameObject(this);
            }
            if (r.Next(0, 100) > 95)
            {
                Fire();
            }
        }
예제 #7
0
 public override void IsOver()
 {
     SingleObject.GetSingle().AddGameObject(new HeroBoom(this.x, this.y));
     this.y           = 1000;
     Forms.Form1.lost = true;
 }
예제 #8
0
 public void Fire()
 {
     SingleObject.GetSingle().AddGameObject(new EnemyBullet(this, 20, 1));
 }