public void Update() { if (!_waveStarted || WaveComplete) { return; } _spawnDelay.Update(); if (_spawnDelay.Delayed || _spawnLocations == null || _spawnLocations.Count == 0 || _currentEnemyOffset >= _waveEnemyTypes.Length) { return; } var roundRobin = (int)(_spawnCount % _spawnLocations.Count); var spawnLocation = _spawnLocations[roundRobin]; var enemy = EnemyFactory.MakeEnemy(spawnLocation, _waveEnemyTypes[_currentEnemyOffset]); Enemies.Add(enemy); enemy.Spawn(); _currentEnemyOffset++; _spawnCount++; }
internal override Model ReadEntry(BinaryReaderEx br) { ModelType type = br.GetEnum32 <ModelType>(br.Position + 4); var model = new Model(br); if (type == ModelType.MapPiece) { MapPieces.Add(model); } else if (type == ModelType.Object) { Objects.Add(model); } else if (type == ModelType.Enemy) { Enemies.Add(model); } else if (type == ModelType.Player) { Players.Add(model); } else if (type == ModelType.Collision) { Collisions.Add(model); } else if (type == ModelType.Navmesh) { Navmeshes.Add(model); } else { throw new NotImplementedException($"Unimplemented model type: {type}"); } return(model); }
/// <summary> /// Adds a part to the appropriate list for its type; returns the part. /// </summary> public Part Add(Part part) { switch (part) { case Part.MapPiece p: MapPieces.Add(p); break; case Part.Object p: Objects.Add(p); break; case Part.Enemy p: Enemies.Add(p); break; case Part.Player p: Players.Add(p); break; case Part.Collision p: Collisions.Add(p); break; case Part.Protoboss p: Protobosses.Add(p); break; case Part.Navmesh p: Navmeshes.Add(p); break; case Part.DummyObject p: DummyObjects.Add(p); break; case Part.DummyEnemy p: DummyEnemies.Add(p); break; case Part.ConnectCollision p: ConnectCollisions.Add(p); break; default: throw new ArgumentException($"Unrecognized type {part.GetType()}.", nameof(part)); } return(part); }
public Boss() { MainCharacter = Character.SpawnCharacter(mainCharacterHP, new Point(30, Program.MainWindow.Size.Y - 300), CharacterMovesAnimation.StandMainCharTexture); TimeToAirDrop = 20; timeNowAirDrop = DateTime.Now; timeOnPause = 0; Inventory.Clear(); Inventory.AddGun(new Pistol()); Inventory.AddGun(new Smg()); Inventory.AddGun(new ShotGun()); MainCharacter.gunNow = Inventory.Guns[0]; levelMusic = Musics.Boss; numLevel = 4; Color mainColor = new Color(146, 191, 229); platformTexture.Color = mainColor; platformTextureRev.Color = mainColor; platform2Texture.Color = mainColor; platform2TextureRev.Color = mainColor; Boss = Character.SpawnCharacter(1000, new Point(Program.MainWindow.Size.X - 30, Program.MainWindow.Size.Y - 300), CharacterMovesAnimation.StandEnemyTexture, new Smg()); Enemies.Add(Boss); }
protected override void InitEnemies() { var rndGen = GameManager.Instance.RandomNumGen; //Initialize the Enemies. int minX = PlayField.Center.X - 100; int maxX = PlayField.Right - Butterfly.kWidth; //Makes the enemies came from bottom of screen. int minY = PlayField.Bottom; int maxY = 3 * PlayField.Bottom; for (int i = 0; i < kMaxButterfliesCount; ++i) { var x = rndGen.Next(minX, maxX); var y = rndGen.Next(minY, maxY); var butterfly = new Butterfly(new Vector2(x, y)); butterfly.OnStateChangeDead += OnEnemyStateChangeDead; butterfly.OnStateChangeDying += OnEnemyStateChangeDying; Enemies.Add(butterfly); } AliveEnemies = kMaxButterfliesCount; }
private static void WriteLobbyConstants(string teamMate1Username, int teamMate1Id, string teamMate2Username, int teamMate2Id, string teamMate3Username, int teamMate3Id, string enemy1Username, int enemy1Id, string enemy2Username, int enemy2Id, string enemy3Username, int enemy3Id) { Debug.Log("WriteLobbyConstants"); if (teamMate1Username == Username) { TeamMates.Add(teamMate2Id, teamMate2Username); TeamMates.Add(teamMate3Id, teamMate3Username); } else if (teamMate2Username == Username) { TeamMates.Add(teamMate1Id, teamMate1Username); TeamMates.Add(teamMate3Id, teamMate3Username); } else { TeamMates.Add(teamMate1Id, teamMate1Username); TeamMates.Add(teamMate2Id, teamMate2Username); } Enemies.Add(enemy1Id, enemy1Username); Enemies.Add(enemy2Id, enemy2Username); Enemies.Add(enemy3Id, enemy3Username); UIObjects.Instance.inGameUi.GetComponentInChildren <Canvas>().enabled = false; SceneManager.LoadScene(2); }
protected override void InitEnemies() { var rndGen = GameManager.Instance.RandomNumGen; //Initialize the Enemies. int minY = PlayField.Top + Slime.kHeight; int maxY = PlayField.Bottom - Slime.kHeight; //Makes the enemies came from right of screen. int minX = PlayField.Right; int maxX = 3 * PlayField.Right; for (int i = 0; i < kMaxSlimesCount; ++i) { var x = rndGen.Next(minX, maxX); var y = rndGen.Next(minY, maxY); var slime = new Slime(new Vector2(x, y)); slime.OnStateChangeDead += OnEnemyStateChangeDead; slime.OnStateChangeDying += OnEnemyStateChangeDying; Enemies.Add(slime); } AliveEnemies = kMaxSlimesCount; }
public void EditActor(Actor oldActor, Actor newActor) { if (oldActor is PlayerActor) { var foundCharacter = Characters.Where(character => character == oldActor).FirstOrDefault(); if (foundCharacter != null) { Characters.Remove(oldActor as PlayerActor); Characters.Add(newActor as PlayerActor); Modified = true; } } else if (oldActor is Creature) { var foundEnemy = Enemies.Where(enemy => enemy == oldActor).FirstOrDefault(); if (foundEnemy != null) { Enemies.Remove(oldActor as Creature); Enemies.Add(newActor as Creature); Modified = true; } } }
public void AddAttacker(IAttackCard attacker) { if (Enemies.Count >= Combat.MaxCountAttackers) { return; // Уже атакует максимум врагов } Action <int> Final = (x) => attacker.View.Frame(false).SetSortingOrder(x); if (Enemies.Count > 0) { if (Enemies[0].Combat.Initiative > attacker.Combat.Initiative) { // Поменять атакующие карты местами attacker.Moving.SetPosition(new Vector3(View.Position.x + x1, View.Position.y - y1, 0)).Run(0.3f, () => Final(1)); Enemies[0].Moving.SetPosition(new Vector3(View.Position.x + x2, View.Position.y - y2, 0)).Run(0.3f, () => Enemies[0].View.SetSortingOrder(2)); } else { // Назначить второй атакующей attacker.Moving.SetPosition(new Vector3(View.Position.x + x2, View.Position.y - y2, 0)).Run(0.3f, () => Final(2)); } } else { // Назначить первой атакующей attacker.Moving.SetPosition(new Vector3(View.Position.x + x1, View.Position.y - y1, 0)).Run(0.3f, () => Final(1)); } Enemies.Add(attacker.Warrior); attacker.Warrior.AttackTargetID = Id; }
private void SpawnEnemies(double bonusChance = 0.0) // спавн бомжей { if (SpawnsRemain == 0) { return; } for (int i = 0; i < Options.MaxSpawnPerTurn; i++) { var roll = Random.NextDouble(); if (roll < Options.SpawnChance + bonusChance) { Vector2Int pos; do { pos = GetRandomPos(); // генерируем рандомную позицию для бомжа } while (Map.GetTileType(pos) != TileType.Empty); var enemy = new Enemy(SpawnsRemain + 1, pos); Enemies.Add(enemy); // ставим бомжа в найденную клетку Map[pos] = enemy.Id; SpawnsRemain--; if (SpawnsRemain == 0) { return; } } } }
protected override void InitEnemies() { var rndGen = GameManager.Instance.RandomNumGen; //Initialize the Enemies. int minWindY = PlayField.Top - Wind.kHeight; int maxWindY = PlayField.Bottom - Wind.kHeight; //Makes the enemies came from right of screen. int minWindX = PlayField.Right; int maxWindX = 3 * PlayField.Right; for (int i = 0; i < kMaxWindsCount; ++i) { var x = rndGen.Next(minWindX, maxWindX); var y = rndGen.Next(minWindY, maxWindY); var wind = new Wind(new Vector2(x, y)); wind.OnStateChangeDead += OnEnemyStateChangeDead; wind.OnStateChangeDying += OnEnemyStateChangeDying; Enemies.Add(wind); } AliveEnemies = kMaxWindsCount; }
/// <summary> /// Adds a model to the appropriate list for its type; returns the model. /// </summary> public Model Add(Model model) { switch (model) { case Model.MapPiece m: MapPieces.Add(m); break; case Model.Object m: Objects.Add(m); break; case Model.Enemy m: Enemies.Add(m); break; case Model.Item m: Items.Add(m); break; case Model.Player m: Players.Add(m); break; case Model.Collision m: Collisions.Add(m); break; case Model.Navmesh m: Navmeshes.Add(m); break; case Model.Other m: Others.Add(m); break; default: throw new ArgumentException($"Unrecognized type {model.GetType()}.", nameof(model)); } return(model); }
internal override Model ReadEntry(BinaryReaderEx br) { ModelType type = br.GetEnum32 <ModelType>(br.Position + 8); switch (type) { case ModelType.MapPiece: var mapPiece = new Model.MapPiece(br); MapPieces.Add(mapPiece); return(mapPiece); case ModelType.Object: var obj = new Model.Object(br); Objects.Add(obj); return(obj); case ModelType.Enemy: var enemy = new Model.Enemy(br); Enemies.Add(enemy); return(enemy); case ModelType.Player: var player = new Model.Player(br); Players.Add(player); return(player); case ModelType.Collision: var collision = new Model.Collision(br); Collisions.Add(collision); return(collision); default: throw new NotImplementedException($"Unimplemented model type: {type}"); } }
protected override void InitEnemies() { var rndGen = GameManager.Instance.RandomNumGen; //Initialize the Enemies. int minFireballY = PlayField.Top - Fireball.kHeight; int maxFireballY = PlayField.Bottom - Fireball.kHeight; //Makes the enemies came from right of screen. int minFireballX = PlayField.Right; int maxFireballX = 2 * PlayField.Right; for (int i = 0; i < kMaxFireballsCount; ++i) { var x = rndGen.Next(minFireballX, maxFireballX); var y = rndGen.Next(minFireballY, maxFireballY); var fireball = new Fireball(new Vector2(x, y)); fireball.OnStateChangeDead += OnEnemyStateChangeDead; fireball.OnStateChangeDying += OnEnemyStateChangeDying; Enemies.Add(fireball); } AliveEnemies = kMaxFireballsCount; }
public void AddEnemy(Vector2 enemyPosition) { if (!Enemies.Contains(enemyPosition)) { Enemies.Add(enemyPosition); } }
public void AddPartyEnemy(CreatureObject PartyEnemy) { if (PartyEnemy == null) { throw new ApplicationException("Trying to add party enemy, but that creature does not exist."); } if (!Enemies.Contains(PartyEnemy)) { Enemies.Add(PartyEnemy); } if (CanPartySee(PartyEnemy)) { int EnemyArmorRank = PartyEnemy.Script.GetArmorRank(PartyEnemy.Script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CARMOUR, PartyEnemy.ObjectId)); if ((EnemyArmorRank == CLRScriptBase.ARMOR_RANK_HEAVY || EnemyArmorRank == CLRScriptBase.ARMOR_RANK_MEDIUM) && !EnemyHardTargets.Contains(PartyEnemy)) { EnemyHardTargets.Add(PartyEnemy); } if (EnemyArmorRank == CLRScriptBase.ARMOR_RANK_LIGHT || EnemyArmorRank == CLRScriptBase.ARMOR_RANK_NONE) { EnemySoftTargets.Add(PartyEnemy); } if (_LooksLikeSpellcaster(PartyEnemy)) { EnemySpellcasters.Add(PartyEnemy); } } else { EnemiesLost.Add(PartyEnemy); } }
public static void GenerateEnemy(int x, int y) { WaveEnemiesCount++; switch (enemyTypeCounter) { case 0: Enemies.Add(new Skeleton(x, y)); break; case 1: Enemies.Add(new Goblin(x, y)); break; case 2: Enemies.Add(new Zombie(x, y)); break; case 3: Enemies.Add(new GrimReaper(x, y)); break; default: enemyTypeCounter = 0; Enemies.Add(new Skeleton(x, y)); break; } }
public GameObject CreateHornet(Vector2 position) { GameObject enemy = (GameObject)Instantiate(hornet, position, Quaternion.identity); Enemies.Add(enemy); return(enemy); }
/// <summary> /// Add edited enemy. /// </summary> public async void Insert(string enemyType) { await _data.Set(_mapper.Map <EnemyProtModel>(_editedEnemy)); Enemies.Add(new EnemyProtDisplay(_editedEnemy)); SelectedEnemy = null; }
private void GameLoop(object sender, EventArgs e) { HighScore += ScoreForTick; if (Enemies.Any(enemy => CollisionDetector.AreCollided(Batwing, enemy))) { timer.Stop(); renderer.ShowEndGameScreen(HighScore); return; } renderer.Clear(); renderer.Draw(Batwing); if (rand.Next(100) < SpawnEnemyChange) { var enemy = enemiesFactory.Get(renderer.ScreenWidth, rand.Next(renderer.ScreenHeight)); Enemies.Add(enemy); GameObjects.Add(enemy); } KillEnemiesIfColliding(); HighScore += Enemies.Count(enemy => !enemy.IsAlive) * ScoreForKill; RemoveNotAliveGameObjects(); UpdateObjectsPositions(); DrawGameObjects(); }
public void AddEnemy(Vector3 enemyPosition) { Enemy enemy = new Enemy(); enemy.SetPosition(enemyPosition); Enemies.Add(enemy); }
public override void AddEnemies() { ImpEnemy imp1 = new ImpEnemy(); ImpEnemy imp2 = new ImpEnemy(); Enemies.Add(imp1); Enemies.Add(imp2); }
public void AddEnemy(Guild g) { if (!Enemies.Contains(g)) { Enemies.Add(g); g.AddEnemy(this); } }
private static void SpawnEnemy() { if (EnemyStopwatch.ElapsedMilliseconds > 500) { Enemies.Add(new Enemy()); EnemyStopwatch.Reset(); EnemyStopwatch.Start(); } }
private void Awake() { MyEnemyDatabase = this; foreach (Enemy enemy in GetComponents <Enemy>()) { Enemies.Add(enemy); } }
public void AddToken(Token token) { Type listType; listType = Heroes.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { AllTokens.Add(token); Heroes.Add((Hero)token); return; } listType = Enemies.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { AllTokens.Add(token); Enemies.Add((Enemy)token); return; } listType = Farmers.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { AllTokens.Add(token); Farmers.Add((Farmer)token); return; } if (token is Fog) { AllTokens.Add(token); return; } if (token is Well) { AllTokens.Add(token); Well = (Well)token; return; } if (token is Witch) { AllTokens.Add(token); return; } if (token is Thorald) { AllTokens.Add(token); return; } // if none of these options means its an item AddItem(token); }
void SpawnFast(Barrels barrel) { // create the enemy Skeleton temp = new Skeleton(Sprites.Fast, Sprites.FastSchedule); // set the position and velocity Fire(temp, barrel, SPEED_HOR_FAST); // add it to the list Enemies.Add(temp); }
void SpawnSword2(Barrels barrel) { // create the enemy Skeleton temp = new Skeleton(Sprites.Sword2, Sprites.Sword2Schedule); // set the position and velocity Fire(temp, barrel, SPEED_HOR_SLOWER); // add it to the list Enemies.Add(temp); }
private void Awake() { Instance = this; foreach (Enemy enemy in GetComponents <Enemy>()) { Debug.Log("Found enemy!"); Enemies.Add(enemy); } }
public void addEnemy() { addMeteor(); if (NumOfEnemies < 20) { Enemies.Add(new Enemy(this.Width, this.Height)); NumOfEnemies++; } NextLevel(); }
/// <summary> /// �K�v�ȃR���e���c�̓ǂݍ��݂�s���܂� /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Content.RootDirectory = @"Content\gameContent"; Model model1 = this.Content.Load<Model> ("untitled"); CharactorPalameter playerPara = new CharactorPalameter(); playerPara.pos = new Vector3(0); playerPara.Dir = new Vector3(0, 0, 1); playerPara.MaxSpeed = 1; player = new Player(this.Content.Load<Model>("untitled"), playerPara); enemies = new Enemies(); CharactorPalameter planePara = new CharactorPalameter(); planePara.pos = new Vector3(0,0,10); planePara.Dir = new Vector3(1,0,0); PlaneEnemy plane = new PlaneEnemy(this.Content.Load<Model>("untitled"), planePara); enemies.Add(plane); mainCamera = new PlayerCamera(player, MathHelper.ToRadians(45.0f), (float)this.GraphicsDevice.Viewport.Width / (float)this.GraphicsDevice.Viewport.Height); base.LoadContent(); }