Пример #1
0
        public Bullet(Canvas canvas, gObject owner, int level)
            : base(canvas, 16, 16)
        {
            this.m_canvas = canvas;
            this.m_owner = owner;
            this.m_level = level;

            if (owner != null)
            {
                this.m_face = owner.Face;

                int cursorX = 0;
                switch (owner.Face)
                {
                    case FaceDirection.Up:
                        {
                            this.m_x = (owner.X + (owner.Width / 2)) - 8;
                            this.m_y = owner.Y - 4;
                            cursorX = 112;
                        }
                        break;
                    case FaceDirection.Down:
                        {
                            this.m_x = (owner.X + (owner.Width / 2)) - 8;
                            this.m_y = (owner.Y + owner.Height) - 4;
                            cursorX = 128;
                        }
                        break;
                    case FaceDirection.Left:
                        {
                            this.m_x = owner.X - 4;
                            this.m_y = (owner.Y + (owner.Height / 2)) - 8;
                            cursorX = 144;
                        }
                        break;
                    case FaceDirection.Right:
                        {
                            this.m_x = (owner.X + owner.Width) - 4;
                            this.m_y = (owner.Y + (owner.Height / 2)) - 8;
                            cursorX = 160;
                        }
                        break;
                }

                this.LoadImage(cursorX, 18, 16, 16);
                this.m_effect = new Effect();
                this.m_effect.End += new EventHandler(this.effect_End);

                this.m_processThread = new Thread(new ThreadStart(this.DoProcess));
                this.m_processThread.Start();
            }
        }
Пример #2
0
        public void Start(Canvas canvas, bool secondPlayer, int level)
        {
            this.Dispose();

            this.m_canvas = canvas;
            this.SetOwner(canvas);

            this.m_secondPlayer = secondPlayer;

            this.Initialize(secondPlayer, level);

            if (secondPlayer)
            {
                this.m_x = canvas.X + 256;
                this.m_y = canvas.Y + 384;
            }
            else
            {
                this.m_x = canvas.X + 128;
                this.m_y = canvas.Y + 384;
            }

            TRACE("Player Started!");
            this.m_face = FaceDirection.Up;
            this.m_life = 0;
            this.m_pause = false;
            this.m_portal = c_portalLife;
            this.m_armor = c_armorLife;
            this.m_bulletLoad = 0;

            this.m_effect = new Effect();
            this.m_effect.End += new EventHandler(this.effect_End);
            this.m_effect.Start(this, EffectTypes.portal, 5, true);

            this.m_processThread = new Thread(new ThreadStart(this.DoProcess));
            this.m_processThread.Start();
        }
Пример #3
0
 public void SetArmor()
 {
     this.m_armor = c_armorLife;
     if (this.m_effect == null)
     {
         this.m_effect = new Effect();
     }
     this.m_effect.Start(this, EffectTypes.armor, 5, true);
 }
Пример #4
0
        protected override void OnLifeChange(gLifeChangeEventArgs e)
        {
            base.OnLifeChange(e);

            if (e.Value == 0)
            {
                if (this.m_effect == null)
                {
                    this.m_effect = new Effect();
                    this.m_effect.End += new EventHandler(this.effect_End);
                }

                this.m_effect.Start(this, EffectTypes.explosive, 20, false);
            }
            else if ((e.Value < 0) && (this.m_canvas != null))
            {
                this.m_canvas.OnEnemyDead(this);
            }
        }
Пример #5
0
        public Enemies(Canvas canvas, int level, int type, bool withBonus, int spwanLoc)
            : base(canvas, 32, 32)
        {
            this.m_canvas = canvas;
            this.m_life = 0;
            this.Initialize(level, type, withBonus);

            this.m_x = canvas.X;
            this.m_y = canvas.Y;
            if (spwanLoc == 1)
                this.m_x += 192;
            else if (spwanLoc == 2)
                this.m_x += 384;

            this.m_face = FaceDirection.Down;

            this.m_random = new Random();

            this.m_effect = new Effect();
            this.m_effect.End += new EventHandler(this.effect_End);
            this.m_effect.Start(this, EffectTypes.portal, 5, true);

            this.m_processThread = new Thread(new ThreadStart(this.DoProcess));
            this.m_processThread.Start();
        }
Пример #6
0
        protected override void OnLifeChange(gLifeChangeEventArgs e)
        {
            base.OnLifeChange(e);

            if (e.Value == 0)
            {
                if (this.m_effect == null)
                {
                    this.m_effect = new Effect();
                    this.m_effect.End += new EventHandler(this.effect_End);
                }

                this.m_effect.Start(this, EffectTypes.explosive, 5, false);
            }

            if (e.Value < 1)
            {
                if ((this.m_processThread != null) && ((this.m_processThread.ThreadState & ThreadState.Running) == ThreadState.Running))
                {
                    this.m_processThread.Abort();
                    this.m_processThread.Join();
                }
            }
        }
Пример #7
0
        protected override void OnLifeChange(gLifeChangeEventArgs e)
        {
            base.OnLifeChange(e);

            //if (this.m_level != (e.Value - 1))
            //{
            //    this.Level = e.Value - 1;
            //    return;
            //}

            if (e.Value == 0)
            {
                if (this.m_effect == null)
                {
                    this.m_effect = new Effect();
                    this.m_effect.End += new EventHandler(this.effect_End);
                }

                this.m_effect.Start(this, EffectTypes.explosive, 20, false);
            }

            if ((e.Value < 0) && (this.m_canvas != null))
            {
                this.m_canvas.OnPlayerDead(this);
            }

            if (e.Value < 1)
            {
                if ((this.m_processThread != null) && ((this.m_processThread.ThreadState & ThreadState.Running) == ThreadState.Running))
                {
                    this.m_processThread.Abort();
                    this.m_processThread.Join();
                }
            }
        }