Exemple #1
0
        public virtual void AddGameObject(GameObject gobj)
        {
            if (SceneObjList == null)
                SceneObjList = new List<GameObject>();

            SceneObjList.Add(gobj);
        }
        public override void CollisionWith(GameObject gobj)
        {
            if (gobj.TAG == "Enemy")
            {
                int x = ((Box)gobj).pos.X;
                int y = ((Box)gobj).pos.Y;
                float w = (float)((Box)gobj).box.Width / 2;
                float h = (float)((Box)gobj).box.Height / 2;

                if (AABB.IsOverlap(this.pos.Y, (double)this.box.Height / 2, y, h))
                {
                    if (this.pos.X < x + 2 * w && this.pos.X >= x + w)
                        this.pos.X = Convert.ToInt32(x + 2 * w) + 1;

                    if (this.pos.X + this.box.Width > x && this.pos.X + this.box.Width <= x + w)
                        this.pos.X = x - this.box.Width - 1;
                }

                if (AABB.IsOverlap(this.pos.X, (double)this.box.Width / 2, x, w))
                {
                    if (this.pos.Y < y + 2 * h && this.pos.Y >= y + h)
                        this.pos.Y = Convert.ToInt32(y + 2 * h) + 1;

                    if (this.pos.Y + this.box.Height > y && this.pos.Y + this.box.Height <= y + h)
                        this.pos.Y = y - this.box.Height - 1;
                }

            }
            else if (gobj.TAG == "EN_WeaponP")
            {
                this.Life -= ((Bullet)gobj).damage;
                this.IsDamaged = true;
                gobj.Distroy = true;
            }
            else if (gobj.TAG == "EN_WeaponP_Trace")
            {
                this.Life -= ((Bullet)gobj).damage;
                this.IsDamaged = true;
                gobj.Distroy = true;
            }
            else if (gobj.TAG == "EN_Danmu_Child")
            {
                this.Life -= ((Bullet)gobj).damage;
                this.IsDamaged = true;
                gobj.Distroy = true;
            }
        }
 public override void CollisionWith(GameObject gobj)
 {
     if (gobj.TAG == "EN_WeaponP" || gobj.TAG == "EN_WeaponP_Trace" || gobj.TAG == "EN_Danmu_Child")
        {
        gobj.Distroy = true;
        }
 }
 public EN_WeaponD_Trigger(Point _pos , GameObject gobj)
     : base(_pos , 90)
 {
     tmpobj = gobj;
 }
 public EN_WeaponCiculiar(Point _pos , GameObject gobj , int _type , int _D , int _W , int _duration)
     : base(_pos , _duration)
 {
     tmpobj = gobj;
     this.type = _type;
     this.D = _D;
     this.W = _W;
 }
        public override void CollisionWith(GameObject gobj)
        {
            if (gobj.TAG == "PC_WeaponN")
            {
                if(this.DamageCoolDown == 0)
                    this.Life -= ((Bullet)gobj).damage;

                this.DamageCoolDown = 1;
                this.IsDamaged = true;
                gobj.Distroy = true;
            }
            else if (gobj.TAG == "PC_WeaponL")
            {
                if (this.DamageCoolDown == 0)
                {
                    this.Life -= ((Bullet)gobj).damage;
                    this.DamageCoolDown = 5;
                }

                this.IsDamaged = true;
                gobj.Distroy = true;
            }
            else if (gobj.TAG == "PC_WeaponW")
            {
                if (this.DamageCoolDown == 0)
                {
                    this.Life -= ((Bullet)gobj).damage;
                    this.DamageCoolDown = 1;
                }
                this.IsDamaged = true;
            }
        }
Exemple #7
0
 public virtual void CollisionWith(GameObject gobj)
 {
 }