public static void UpateLocation(IBoss boss, IBlock block, Direction direction) { switch (direction) { case Direction.Top: boss.Location = new Vector2(boss.Location.X, block.Location.Y - boss.Rectangle.Height); boss.BossPhysics.BossMove(); boss.BossPhysics.Accerlation = new Vector2(Util.Instance.Vector_initial_i, Util.Instance.Vector_initial_j); boss.BossPhysics.Velocity = new Vector2(boss.BossPhysics.Velocity.X, Util.Instance.Vector_initial_j); break; case Direction.Right: if (!boss.IsControlled) { boss.BossPhysics.IsFacingLeft = false; boss.BossPhysics.BossMove(); boss.State = new BowserMoveState(boss.BossPhysics.IsFacingLeft); } break; case Direction.Left: if (!boss.IsControlled) { boss.BossPhysics.IsFacingLeft = true; boss.BossPhysics.BossMove(); boss.State = new BowserMoveState(boss.BossPhysics.IsFacingLeft); } break; } }
public static void Update(IProjectile fireball, IBoss BossPr, Collision.CollisionType collisionType) { switch (collisionType) { case Collision.CollisionType.Above: fireball.Attack(BossPr); return; case Collision.CollisionType.Below: fireball.Attack(BossPr); return; case Collision.CollisionType.Left: fireball.Attack(BossPr); return; case Collision.CollisionType.Right: fireball.Attack(BossPr); return; default: return; } }
public HomeController(IPegawai pegawai, IConfiguration config, IBoss boss) { _pegawai = pegawai; _config = config; _boss = boss; }
public void CollisionWithBoss(IBoss boss, Direction direction) { BossBlockHandler.UpateLocation(boss, this, direction); if (direction == Direction.Top) { boss.TakeDamage(); } }
public BossPhysicalProperty(IBoss boss) { bossSpeed = 32f; IsFacingLeft = true; this.boss = boss; IsAlive = true; BossMove(); }
public static void HandleCollision(IPlayer mario, IEnemy enemy, IBoss boss) { boss.CollidedWithShell(enemy); if (boss.Life == 0) { mario.ScoreObjects.Add(new Score.ScoreObject(Util.Instance.BossScore, enemy.Location, true)); mario.Scores += 3000; } SoundFactory.Instance.PlayKickEnemySound(); }
public static void HandleCollision(IPlayer mario, IBoss boss, Direction direction) { if (direction == Direction.Top) { mario.MarioPhysics.VerticalCalmDown(); mario.MarioPhysics.ResetJump(); } if (!(mario.CurrentAnimationState is MarioDeadState)) { boss.CollidedWithMario(mario, direction); } }
private void Start() { player = FindObjectOfType <Player>(); shaker = player.GetComponent <CameraShake>(); canvasRectT = canvas.GetComponent <RectTransform>(); sr = BossNebula.GetComponent <SpriteRenderer>(); rectTranform = gameObject.GetComponent <RectTransform>(); // Берем у объекта босса компонент с поведение при спавне и т.п. boss = BossObject.GetComponent <IBoss>(); leftAnim = LeftAltarStatue.GetComponent <Animator>(); rightAnim = RightAltarStatue.GetComponent <Animator>(); }
public BossPrincessWithJusticeSkill(IBoss princess) { decoratedBoss = princess; myGame = princess.myGame; mySprite = princess.mySprite; rectangle = princess.rectangle; acc = new Vector2(0.0f, 0.2f); velocity = new Vector2(0.0f, -11.0f); decoratedBoss.velocity = velocity; health = princess.health; Sound.Instance.Justice(); Sound.Instance.Justice(); Sound.Instance.Justice(); }
public BossPrincessWithFrozenFish(IBoss princess) { decoratedBoss = princess; myGame = princess.myGame; mySprite = princess.mySprite; rectangle = princess.rectangle; acc = new Vector2(0.0f, 0.2f); velocity = new Vector2(0.0f, -7.0f); decoratedBoss.velocity = velocity; health = princess.health; Sound.Instance.Freeze(); Sound.Instance.Freeze(); Sound.Instance.Freeze(); }
public void CheckBossBlockCollisionLoop(IList <IBlock> BlocksAround, IBoss boss) { foreach (IBlock block in BlocksAround) { if (block != null) { Rectangle blockBox = block.Rectangle; Rectangle intersectionBox = Rectangle.Intersect(blockBox, boss.Rectangle); if (!intersectionBox.IsEmpty) { Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, boss.Rectangle, blockBox); BossBlockHandler.HandleCollision(boss, block, direction); } } } }
private void CheckBrickCount() { if (CountBricks() <= 0) { //Debug.Log("All bricks gone, loading next screen"); IBoss boss = FindObjectOfType <Boss>() as IBoss; if (boss != null) { boss.StartEncounter(); } else { NextLevel(); } } }
private void CheckBrickCount() { if (CountBricks() <= 0 && sceneLoader.isCurrentSceneLevel()) { //Debug.Log("All bricks gone, loading next screen"); IBoss boss = FindObjectOfType <Boss>() as IBoss; if (boss != null) { isBossSessionInProgress = true; boss.StartEncounter(); options.HighestLevel = intconstants.MRBRICKWORM; } else { NextLevel(); } } }
public static int Update(IBoss princess, IBlock block, Collision.CollisionType collisionType) { switch (collisionType) { case Collision.CollisionType.Above: return((int)Enum.DisableMovementType.Down); case Collision.CollisionType.Below: return((int)Enum.DisableMovementType.Up); case Collision.CollisionType.Left: return((int)Enum.DisableMovementType.Right); case Collision.CollisionType.Right: return((int)Enum.DisableMovementType.Left); default: return((int)Enum.DisableMovementType.None); } }
public static void PrintStats(IPlayer player1, IPlayer player2 = null, IBoss boss = null) { Console.ForegroundColor = ConsoleColor.White; Console.SetCursorPosition(0, 0); Console.WriteLine($"$:{player1.Score} H:{new string('+', player1.Health)}"); if (player2 != null) { Console.ForegroundColor = ConsoleColor.White; Console.SetCursorPosition(Console.WindowWidth / 2 + 20, 0); Console.WriteLine($"$:{player2.Score} H:{new string('+', player2.Health)}"); } if (boss != null) { Console.ForegroundColor = ConsoleColor.White; Console.SetCursorPosition(Console.WindowWidth / 2 + 20, 0); Console.WriteLine($"BOSS H:{new string('+', boss.Health)}"); } }
/// <summary> /// Преобразует IBoss в масив ресуров /// </summary> /// <param name="boss">Объект босса</param> /// <returns>Массив русурсов</returns> public static ListResourse ToResource(IBoss boss) { ResourceItem resourse = null; using (MemoryStream ms = new MemoryStream()) { using (var data = new BinaryWriter(ms, Encoding.UTF8, true)) { data.Write(boss.Name); //Поле Name data.Write(boss.TranslationIdentifier); //Идентификатор перевода data.Write(boss.Health); data.Write(boss.Damage); } resourse = CreateItem(boss.ID, StringNameBossData + boss.Name, FileTypes.Boss, ms); } return(new ListResourse { resourse }); }
public Level1_4(SuperMario game, ILevel level, string fileName) { this.Mygame = game; ProjectileQueue = new Queue <IProjectile>(); ItemList = new List <IItem>(); EnemyList = new List <IEnemy>(); BlockList = new List <IBlock>(); FireList = new List <IFire>(); BackgroundList = new List <IBackground>(); bool ifGoodEnd = game.World.clue1Note && game.World.clue2Flower; BossPr = new PrincessInDialog(game, new Vector2(4900, 254), ifGoodEnd); this.loader = new LevelLoader(this, game); myFileName = fileName; ifSkip = false; Mygame.camera.SetPositionZero(); Load(); Sound.Instance.StopTheme(); Sound.Instance.StartTheme(); }
static void Main(string[] args) { IBoss king = SetUpKing(); string command = ""; while ((command = Console.ReadLine()) != "End") { string[] data = command.Split(); string commandType = data[0]; if (commandType == "Attack") { king.Attack(); } else if (commandType == "Kill") { string name = data[1]; IMortal subordinate = king.Subordinates.FirstOrDefault(s => s.Name == name); subordinate.TakeDamage(); } } }
public SubordinateList(IBoss owner) { Owner = owner; }
public void Attack(IBoss boss) { boss.TakeDamage(); }
public static void HandleCollision(IBoss boss, IBlock block, Direction direction) { block.CollisionWithBoss(boss, direction); }
public string bossLabel(IBoss b) { if (b == null) return "./Resource/interface/icons/dead.png"; else return "./Resource/interface/icons/alive.png"; }
public void CollisionWithBoss(IBoss boss, Direction direction) { BossBlockHandler.UpateLocation(boss, this, direction); }
public static void HandleCollision(Fireball fireball, IBoss boss) { fireball.Explode(); boss.CollideWithFireball(fireball); SoundFactory.Instance.PlayKickEnemySound(); }
public void Attack(IBoss boss) { }
public void PlayOffline(IPlayer offlinePlayer) { PlaySound("../../Core/Resources/music/singlePlayer.wav"); List <IEnemy> enemies = new List <IEnemy>(); IBoss boss = null; Random rnd = new Random(); int randX = 0; int counter = 0; while (true) { Console.Clear(); Console.CursorVisible = false; offlinePlayer.ShootedBullets.RemoveAll(b => b.ObjectPosition.Y == 0); offlinePlayer.ShootedBullets.ForEach(Screen.PrintObject); offlinePlayer.ShootedBullets.ForEach(b => b.Move()); randX = rnd.Next(0, Console.WindowWidth - 2); if (counter == 1000) { Instance.GameSpeed = 20; boss = InvadersFactory.Instance.CreateBoss(null, 10, null, ConsoleColor.Red, randX); boss.ObjectPosition.Y = 1; PlaySound("../../Core/Resources/music/bossMusic.wav"); } else if (counter < 1000 && counter % 10 == 0) { enemies.Add(InvadersFactory.Instance.CreateEnemy(null, 1, null, ConsoleColor.Green, randX)); Instance.GameSpeed++; } enemies.Remove(enemies.Find(i => i.ObjectPosition.Y == Console.WindowHeight)); Screen.PrintObject(offlinePlayer); Screen.PrintStats(offlinePlayer); if (boss != null) { if (counter % 5 == 0) { boss.Move(); } boss.ShootedBullets.RemoveAll(bull => bull.ObjectPosition.Y == Console.WindowHeight); boss.ShootedBullets.ForEach(b => { Screen.PrintObject(b); b.ObjectPosition.Y++; }); Screen.PrintObject(boss); HitCheck(offlinePlayer, null, null, boss); Screen.PrintStats(offlinePlayer, null, boss); if (boss.Health == 0) { Console.Clear(); GameStory.printGameComplete(); break; } } enemies.ForEach(Screen.PrintObject); enemies.ForEach(p => p.Move()); offlinePlayer.Move(); Instance.HitCheck(offlinePlayer, enemies); // Game end ----------- if (offlinePlayer.Health == 0) { Console.Clear(); GameStory.printGameOver(); break; } counter++; Thread.Sleep(100 - Instance.GameSpeed); } }
public void HitCheck(IPlayer player, List <IEnemy> enemies, IPlayer opponent = null, IBoss boss = null) { if (enemies != null) { enemies.ForEach(enemy => { if (player.ShootedBullets.Any(bullet => bullet.ObjectPosition.X >= enemy.ObjectPosition.X && bullet.ObjectPosition.X <= enemy.ObjectPosition.X + enemy.ToString().Length - 1 && enemy.ObjectPosition.Y == bullet.ObjectPosition.Y)) { player.Score++; enemy.Health--; } else if (((enemy.ObjectPosition.X >= player.ObjectPosition.X && enemy.ObjectPosition.X <= player.ObjectPosition.X + player.ToString().Length - 1) || (enemy.ObjectPosition.X + enemy.ToString().Length - 1 <= player.ObjectPosition.X + player.ToString().Length - 1 && enemy.ObjectPosition.X + enemy.ToString().Length - 1 >= player.ObjectPosition.X)) && enemy.ObjectPosition.Y == player.ObjectPosition.Y) { player.Health--; } }); enemies.RemoveAll(e => e.Health == 0); } if (opponent != null) { if (player.ShootedBullets.Any(b => b.ObjectPosition.X >= opponent.ObjectPosition.X && b.ObjectPosition.X <= opponent.ObjectPosition.X + opponent.ToString().Length - 1 && opponent.ObjectPosition.Y == Console.WindowHeight - b.ObjectPosition.Y)) { player.Score++; opponent.Health--; } } if (boss != null) { if (player.ShootedBullets.Any(b => b.ObjectPosition.X >= boss.ObjectPosition.X && b.ObjectPosition.X <= boss.ObjectPosition.X + boss.ToString().Length - 1 && boss.ObjectPosition.Y == b.ObjectPosition.Y)) { player.Score++; boss.Health--; } if (boss.ShootedBullets.Any(b => b.ObjectPosition.X >= player.ObjectPosition.X && b.ObjectPosition.X <= player.ObjectPosition.X + player.ToString().Length - 1 && player.ObjectPosition.Y == Console.WindowHeight - b.ObjectPosition.Y)) { player.Health--; } } }
/// <summary> /// Преобразование ресурса в объект типа уровень /// </summary> /// <param name="obj">Преобразуемый ресурс</param> /// <param name="lr">список всех ресурсов</param> /// <param name="bosses">Боссы</param> /// <param name="questions">Вопросы</param> /// <param name="levels">Уровни</param> /// <returns></returns> public static Tuple <ILevel, ListResourse> ResourceToLevel(ResourceItem obj, ListResourse lr) { obj.Data.Position = 0; Level result = new Level(); // SerializableInventoryItem s = new SerializableInventoryItem(obj.Data); using (var data = new BinaryReader(obj.Data, Encoding.UTF8, true)) { result.Name = data.ReadString(); result.ID = obj.Identifier; result.TranslationIdentifier = data.ReadString(); { //Обработка босса уровня var Isboss = data.ReadBoolean(); if (Isboss) { var bossid = data.ReadUInt64(); IBoss bosslevel = BossCashe.Find((item) => item.ID == bossid); if (bosslevel != null) { result.Boss = bosslevel; } else { result.Boss = new Boss { ID = bossid }; if (!bosslevelcashe.ContainsKey(bossid)) { bosslevelcashe[bossid] = new List <ILevel>(); } bosslevelcashe[bossid].Add(result); } } } { //Обработка вопросов уровня var questioncount = data.ReadInt32(); result.QuestionsLevel = new DataList <IQuestion>(); for (int j = 0; j < questioncount; j++) { var questionid = data.ReadUInt64(); IQuestion qestionlevel = QuestionCashe.Find((item) => item.ID == questionid); if (qestionlevel != null) { result.QuestionsLevel.Add(qestionlevel); } else { result.QuestionsLevel.Add(new QuestionSelectOne { ID = questionid }); if (!questionlevelcashe.ContainsKey(questionid)) { questionlevelcashe[questionid] = new List <ILevel>(); } questionlevelcashe[questionid].Add(result); } } } result.Price = new Money(data.ReadUInt32(), data.ReadUInt32()); result.Remuneration = new Money(data.ReadUInt32(), data.ReadUInt32()); { //Обработка родителей уровня 1 result.Parents = new DataList <ILevel>(); var parentcount = data.ReadInt32(); for (int j = 0; j < parentcount; j++) { var parentid = data.ReadUInt64(); ILevel levellevel = LevelCashe.Find((item) => item.ID == parentid); if (levellevel != null) { result.Parents.Add(levellevel); } else { result.Parents.Add(new Level { ID = parentid }); if (!levellevelcashe.ContainsKey(parentid)) { levellevelcashe[parentid] = new List <ILevel>(); } levellevelcashe[parentid].Add(result); } } } { //Обработка родителей уровня 2 if (levellevelcashe.ContainsKey(result.ID)) { for (int j = 0; j < levellevelcashe[result.ID].Count; j++) { levellevelcashe[result.ID][j].Parents.Add(result); } } } { //Обработка эр if (levelagecashe.ContainsKey(result.ID)) { for (int j = 0; j < levellevelcashe[result.ID].Count; j++) { levelagecashe[result.ID][j].Levels.Add(result); } } } } LevelCashe.Add(result); return(new Tuple <ILevel, ListResourse>(result, new ListResourse { obj })); }