//führt die Logik aus wie beispielsweise die Steuerung oder das Abspielen der Animationen public void Update(GameTime gameTime) { if (firstStart) { MediaPlayer.Play(song); InitializeData(); firstStart = false; foreach (PartyMember member in FightCadre) { battleEvaluation.OldCharacterExp.Add(member.Exp); battleEvaluation.OldCharacterLevel.Add(member.Level); } } if (!enemy1.isAnimated && enemy1.Life == 0) { enemy1.DeathAnimation.Done = true; } if (fightCadre.All(member => member.Life == 0) && FightCadre.All(member => member.DeathAnimation.Done) && haveToLoose) { this.isOver = true; firstStart = true; foreach(PartyMember member in FightCadre) { member.SetFightAttributes(); } } else if (fightCadre.All(member => member.Life == 0) && FightCadre.All(member => member.DeathAnimation.Done) && !haveToLoose) { GameOver.Update(); firstStart = true; foreach (PartyMember member in FightCadre) { member.SetFightAttributes(); } } else if(Enemies.All(enemy => enemy.Life == 0) && Enemies.All(enemy => enemy.DeathAnimation.Done)) { foreach (PartyMember member in FightCadre) { member.SetFightAttributes(); } BattleEvaluation.UpdateFightCadre(this.fightCadre); if (Evaluate) { EvaluationHelperClass.EvaluateExp(this.FightCadre, this.Enemies); Evaluate = false; } battleEvaluation.Update(); isOver = battleEvaluation.EndBattle; } else { BattleControls(); Background.Update(); CharacterStatBox.Update(); skillBox.Update(); AttackHintBox.Update(); UpdateIcons(); if (partyMember1 != null) { ActivePartymember1Arrow.Update(); } if (partyMember2 != null) { ActivePartymember2Arrow.Update(); } if (partyMember3 != null) { ActivePartymember3Arrow.Update(); } if (partyMember4 != null) { ActivePartymember4Arrow.Update(); } if (enemy1 != null) { ActiveEnemy1Arrow.Update(); } if (enemy2 != null) { ActiveEnemy2Arrow.Update(); } if (enemy3 != null) { ActiveEnemy3Arrow.Update(); } if (enemy4 != null) { ActiveEnemy4Arrow.Update(); } isOver = BattleEvaluation.EndBattle; controls.Update(); Heal1.Update(gameTime); Hit1.Update(gameTime); Heal2.Update(gameTime); Hit2.Update(gameTime); Heal3.Update(gameTime); Hit3.Update(gameTime); Heal4.Update(gameTime); Hit4.Update(gameTime); UpdateAnimatedSkills(); //Die KI wird ausgeführt wenn es sich bei dem Aktiven Character um einen Gegner handelt if (activeChar.GetType() == typeof(Enemy)) { if (fightCadre.Any(member => member.Life != 0)) { if (!enemyHitDone) { Hit1.LoadContent(hitAnimationStandard, new Vector2(-60, 0)); Heal1.LoadContent(healAnimationStandard, new Vector2(-60, 0)); ((Enemy)this.activeChar).PerformAI(this.fightCadre.Cast<Character>().ToList(), this.Enemies.Cast<Character>().ToList()); activeSkill = ((Enemy)activeChar).SkillToPerform; activeTarget = ((Enemy)activeChar).Targets.ElementAt(0); LoadAnimatedSkillsFromEnemies(((Enemy)activeChar).Targets, ((Enemy)activeChar).TargetName); if (((Enemy)activeChar).isAnimated) { if (enemy1Name != null) { if (activeChar.Name == enemy1Name.SkillName) { activeChar.LoadContent(enemy1.AttackAnimation, enemy1.Position); enemy1.AttackAnimation.active = true; } } if (enemy2Name != null) { if (activeChar.Name == enemy2Name.SkillName) { activeChar.LoadContent(enemy2.AttackAnimation, enemy2.Position); enemy2.AttackAnimation.active = true; } } if (enemy3Name != null) { if (activeChar.Name == enemy3Name.SkillName) { activeChar.LoadContent(enemy3.AttackAnimation, enemy3.Position); enemy3.AttackAnimation.active = true; } } if (enemy4Name != null) { if (activeChar.Name == enemy4Name.SkillName) { activeChar.LoadContent(enemy4.AttackAnimation, enemy4.Position); enemy4.AttackAnimation.active = true; } } } else { Punch.Play(); if (activeTarget.GetType() == typeof(Enemy)) { healAnimationStandard.active = true; } else if (activeTarget.GetType() == typeof(PartyMember) || activeTarget.GetType() == typeof(Player)) { hitAnimationStandard.active = true; } AllowDeathAnimation = true; } } enemyHitDone = true; ((Enemy)activeChar).Targets.Clear(); } } //führt ein Update der Animationen und Texte aus wenn es sich bei dem aktiven Character um ein Gruppenmitglied handelt else { if (fightCadre.Any(member => member.Life != 0)) { if (!skillClicked && !activeChar.AttackAnimation.active && !healAnimationStandard.Done && !healAnimationStandard.active && !hitAnimationStandard.Done) { for (countFightCadre = 0; countFightCadre < this.fightCadre.Count - 1; countFightCadre++) { if (this.fightCadre.ElementAt(countFightCadre) == this.activeChar) break; } if (countFightCadre == 0) { if (!this.skillClicked) { if (character1skill1 != null) { this.character1skill1.Update(); } if (character1skill2 != null) { this.character1skill2.Update(); } if (character1skill3 != null) { this.character1skill3.Update(); } if (character1skill4 != null) { this.character1skill4.Update(); } } countFightCadre = 0; } if (countFightCadre == 1) { if (!this.skillClicked) { if (character2skill1 != null) { this.character2skill1.Update(); } if (character2skill2 != null) { this.character2skill2.Update(); } if (character2skill3 != null) { this.character2skill3.Update(); } if (character2skill4 != null) { this.character2skill4.Update(); } } countFightCadre = 0; } if (countFightCadre == 2) { if (!this.skillClicked) { if (character3skill1 != null) { this.character3skill1.Update(); } if (character3skill2 != null) { this.character3skill2.Update(); } if (character3skill3 != null) { this.character3skill3.Update(); } if (character3skill4 != null) { this.character3skill4.Update(); } } countFightCadre = 0; } if (countFightCadre == 3) { if (!this.skillClicked) { if (character4skill1 != null) { this.character4skill1.Update(); } if (character4skill2 != null) { this.character4skill2.Update(); } if (character4skill3 != null) { this.character4skill3.Update(); } if (character4skill4 != null) { this.character4skill4.Update(); } } countFightCadre = 0; } this.attackSkill.Update(); this.restSkill.Update(); } } if (!targetClicked) { Back.Update(); if (singleTargetParty) { if (Character1Name != null) { if (partyMember1.Life != 0) { this.Character1Name.Update(); } } if (Character2Name != null) { if (partyMember2.Life != 0) { this.Character2Name.Update(); } } if (Character3Name != null) { if (partyMember3.Life != 0) { this.Character3Name.Update(); } } if (Character4Name != null) { if (partyMember4.Life != 0); { this.Character4Name.Update(); } } } else if (singleTargetEnemies) { if (enemy1Name != null) { if (enemy1.Life != 0) { this.enemy1Name.Update(); } } if (enemy2Name != null) { if (enemy2.Life != 0) { this.enemy2Name.Update(); } } if (enemy3Name != null) { if (enemy3.Life != 0) { this.enemy3Name.Update(); } } if (enemy4Name != null) { if (enemy4.Life != 0) { this.enemy4Name.Update(); } } } } } } //Wechselt die Frames der befreundeten Animationen foreach (Character chars in this.fightCadre) { chars.Update(gameTime); } //Wechselt die Frames der Gegnerischen Animation foreach (Character chars in this.Enemies) { chars.Update(gameTime); } foreach (GUIElement staticEnemy in StaticEnemies) { staticEnemy.Update(); } UpdateDeathAnimations(); }