Esempio n. 1
0
 public ControlPoint(Texture2D[] textures, Point position)
 {
     this.textures = textures;
     this.position = new Rectangle(position.X, position.Y, radius * 2, radius * 2);
     this.Hitbox   = new KreisHitBox(this.position.Center.ToVector2(), radius);
     sizebg        = 0;
 }
Esempio n. 2
0
        public bool ColidesWithBasic(BasicHitBox other)
        {
            //Berechnung mithilfe des umkreises der anderen Hitbox,
            //da vorherige überprüfung den sonderfall dass beide direkt nebeneinander sind und sich nicht berühren ausgeschlossen hat
            double distance = Vector2.Distance(this.center, other.BoundingBox.Center.ToVector2());
            double addRadi  = this.radius + Utilities.Pytagoras(other.BoundingBox.Height, other.BoundingBox.Width) / 2;

            return(distance < addRadi);
        }
Esempio n. 3
0
 public virtual byte Hitdetection(BasicHitBox OtherHitBox)
 {
     if (OtherHitBox.Colides(GetHitdetectionData()))
     {
         Alive = false;
         return(damage);
     }
     return(0);
 }
Esempio n. 4
0
        public int GetBoxMatchesNumber(BasicHitBox hitbox)
        {
            int result = 0;

            for (int i = 0; i < storage.Length; i++)
            {
                result += storage[i].GetBoxMatchesNumber(hitbox);
            }
            return(result);
        }
Esempio n. 5
0
        public int Hitdetection(BasicHitBox unitHitBox)
        {
            //gesammtschaden
            int result = 0;

            for (int i = 0; i < pool.Length; i++)
            {
                result += pool[i].Hitdetection(unitHitBox);
            }
            return(result);
        }
Esempio n. 6
0
 public override byte Hitdetection(BasicHitBox OtherHitBox)
 {
     if (Hitbox.Colides(OtherHitBox))
     {
         //getroffen und explodieren
         if (this.exploding == 0)
         {
             exploding = 1;
         }
         return(base.damage);
     }
     return(0);
 }
Esempio n. 7
0
        public int Hitdetection(BasicHitBox HitBox)
        {
            int counter = 0;

            for (int i = 0; i < storage.Count; i++)
            {
                //Hitdetection lässt gegebenfalls die Rakete Explodieren
                if (storage[i].IsInUse() && storage[i].Hitdetection(HitBox))
                {
                    counter++;
                }
            }
            return(counter * projectileDamage);
        }
Esempio n. 8
0
        public int Hitdetection(BasicHitBox HitBox)
        {
            int TotalDamage = 0;

            for (int i = 0; i < storage.Count; i++)
            {
                if (storage[i].IsInUse())
                {
                    //fall treffer wird schaden dazuadiert und das Projektil gelöscht/ausgelöst
                    TotalDamage += storage[i].Hitdetection(HitBox);
                }
            }
            return(TotalDamage);
        }
Esempio n. 9
0
 public override byte Hitdetection(BasicHitBox OtherHitBox)
 {
     if (Hitbox == null)
     {
         Hitbox = GetHitdetectionData();
     }
     if (Hitbox.Colides(OtherHitBox))
     {
         //getroffen und projectil "löschen"
         Alive = false;
         return(base.damage);
     }
     return(0);
 }
Esempio n. 10
0
 public virtual int SetFromBytes(byte[] data, int offset, int taktRuckstand = 0)
 {
     Set(
         Convert.ToBoolean(data[0 + offset]),
         data[1 + offset],
         data[2 + offset],
         (ProjectileType)data[3 + offset],
         BitConverter.ToInt32(data, 4 + offset),
         BitConverter.ToInt32(data, 8 + offset),
         BitConverter.ToInt32(data, 12 + offset),
         BitConverter.ToInt32(data, 16 + offset),
         data[20 + offset]
         );
     hitbox = getHitboxfromPosition();
     return(offset + 21);
 }
Esempio n. 11
0
        public int GetBoxMatchesNumber(BasicHitBox other)
        {
            int result = 0;

            for (int i = 0; i < storage.Count; i++)
            {
                if (storage[i].isAlive())
                {
                    if (storage[i].GetHitdetectionData().Colides(other))
                    {
                        result++;
                    }
                }
            }
            return(result);
        }
Esempio n. 12
0
        public virtual void Update()
        {
            if (!Alive || Position.Center == Target)
            {
                return;
            }
            Vector2 distance = (Target - Position.Center).ToVector2();

            if (distance.LengthSquared() < Math.Pow(movementSpeed, 2))
            {
                Position.Offset(Target - Position.Center);
                return;
            }
            Position.Offset(Vector2.Normalize(distance) * movementSpeed);
            Hitbox = GetHitBoxFromPosition();
        }
Esempio n. 13
0
        public virtual bool Colides(BasicHitBox other)
        {
            if (!this.BoundingBox.Intersects(other.BoundingBox))
            {
                return(false);
            }
            switch (other.type)
            {
            case HitBoxType.Basic:
                return(true);

            case HitBoxType.Kreis:
                return(((KreisHitBox)other).ColidesWithBasic(this));

            default:
                return(true);
            }
        }
Esempio n. 14
0
        public override bool Colides(BasicHitBox other)
        {
            //Falls sie die Bounding Hitboxen nicht schneiden kann abgebrochen werden
            if (!this.BoundingBox.Intersects(other.BoundingBox))
            {
                return(false);
            }
            switch (other.GetHitBoxType())
            {
            case HitBoxType.Basic:
                return(ColidesWithBasic((BasicHitBox)other));

            case HitBoxType.Kreis:
                return(ColidesWithCircle((KreisHitBox)other));

            default:
                return(true);
            }
        }
Esempio n. 15
0
 public virtual void Update()
 {
     if (alive == 1)
     {
         alive = 0;
         return;
     }
     if (Health <= 0)
     {
         alive = 1;
         return;
     }
     if (reattackTime > 0)
     {
         reattackTime--;
     }
     if (!isReady())
     {
         spawning--;
     }
     else
     {
         if (Position.Center != target)
         {
             Vector2 distance = (target - Position.Center).ToVector2();
             if (distance.LengthSquared() < Math.Pow(movementSpeed, 2))
             {
                 Position.Offset(target - Position.Center);
             }
             else
             {
                 Position.Offset(Vector2.Normalize((target - Position.Center).ToVector2()) * movementSpeed);
             }
         }
     }
     hitbox = getHitboxfromPosition();
 }
Esempio n. 16
0
        public virtual int Hitdetection(ProjectileManager projectileManager)
        {
            BasicHitBox hitbox = GetHitdetectionData();

            return(projectileManager.Hitdetection(hitbox));
        }