Пример #1
0
 public Object(Objectdatabase objektdatenbank, Animationsmanager animationsmanager, ObjectClass typ, int variante , Vector2 position, float skalierung, int layer, Objektebene objektebene, bool statisch)
 {
     this.Statisch = statisch;
     this.MaxSpeed = new Vector2(6, 12);
     this.Typ = typ;
     this.PositionCurrent = position;
     this.Skalierung = skalierung;
     this.Layer = layer;
     this.Variante = variante;
     this.Objektvariante = objektdatenbank.Auslesen(Typ, Variante);
     if (this.Objektvariante == null) return;
     this.Objektebene = objektebene;
     this.BearbeitungsID = (int)PositionCurrent.Y + (int)Objektvariante.Bearbeitungsverschiebung.Y + (Layer * 1000);
     if (Objektvariante.Animiert == true)
     {
         Animation = new Animation(Objektvariante.Textur, Objektvariante.Wiederholen, Objektvariante.Spalten, Objektvariante.Texturausschnitt, skalierung, Objektvariante.Geschwindigkeit);
         animationsmanager.AddAnimation(Animation);
     }
 }
Пример #2
0
 //Konstruktor Editor
 //public Lever() { }  //Konstruktor Ladevorgang
 public Lever(Vector2 maße, Texture2D texture)
 {
     Maße = maße;
     Animation = new Animation(texture, false, 5, new Rectangle(0, 0, (int)maße.X, (int)maße.Y), 1, 7);
     Mittelpunkt = new Vector2(maße.X / 2, maße.Y / 2);
 }
Пример #3
0
        public Player(Mathe mathe, Contents contents, World world, DebugFlag flag)
        {
            this.Mathe = mathe;
            debugFlag = flag;
            this.stringBuilder = new StringBuilder();
            this.Contents = contents;

            PositionCurrent = new Vector2(0, 715);
            Texturen[0] = contents.Player1;
            Texturen[1] = contents.Player2;
            Texturen[2] = contents.Player3;
            Texturen[3] = contents.Player4;
            Texturen[4] = contents.Player5;
            Texturen[5] = contents.Player6;
            Animation = new Animation(Texturen[0], true, 1, new Rectangle(0, 0, 200, 200), 1, 6);
            Blickrichtung = Richtung.Rechts;
            Playerstate = Playerstates.Idle;
            MaxSpeed = new Vector2(6, 12);
            Beschleunigung = new Vector2(0.25f, 0.60f);
            Initialgeschwindigkeit = new Vector2(2.0f, 5.5f);
            Reibung = 0.35f;
            Gravitation = 0.40f;
            jumpCounter = 0;
            jumpCounterMax = 11;
            jumpCooldown = 0;
            jumpCooldownBase = 20;
            Ground = 715;
            Groundcollision = true;

            body = BodyFactory.CreateRectangle(world, 50, 50, 1.0f, PositionCurrent);
        }
Пример #4
0
 public void RemoveAnimation(Animation animation)
 {
     Animation.Remove(animation);    //Animation löschen
 }
Пример #5
0
 public void AddAnimation(Animation animation)
 {
     Animation.Add(animation);  //Neue Animation erstellen
 }
Пример #6
0
 public Enemy(Objectmanager objectmanager, ContentManager contentManager, Mathe mathe, Enemydatabase enemydatabase, Enemytype typ, Vector2 position, Richtung blickrichtung, float skalierung)
 {
     Gravitation = 0.40f;
     MaxSpeed = new Vector2(6, 15);
     this.Objectmanager = objectmanager;
     this.Mathe = mathe;
     this.State = Enemystate.Idle;
     this.Blickrichtung = blickrichtung;
     this.Skalierung = skalierung;
     this.PositionCurrent = position;
     this.Typ = typ;
     Enemy Tempenemy = enemydatabase.Read(typ);
     Texturmaße = new Vector2(Tempenemy.Texturmaße.X, Tempenemy.Texturmaße.Y);
     AniGeschwindigkeit = Tempenemy.AniGeschwindigkeit;
     Spalten = Tempenemy.Spalten;
     Texturname = Tempenemy.Texturname;
     Wiederholen = Tempenemy.Wiederholen;
     Textur = Tempenemy.Textur;
     Kollision = new Rectangle((int)(Texturmaße.X / 2) - 5, (int)Texturmaße.Y - 20, 10, 10);
     for (int i = 0; i < Textur.Count(); i++)
     {
         if (Texturname[i] == "Idle")
         {
             Animation = new Animation(Textur[i], true, Spalten[i], new Rectangle(0, 0, (int)Texturmaße.X, (int)Texturmaße.Y), skalierung, AniGeschwindigkeit[i]); break;
         }
     }
 }