public void Create() { IZombie z = ZombieFactory.Make(ZombieFactory.Catagory.Crazy, ZombieFactory.IsRange.Range, ZombieColor.White); Generator(z); }
private MobSpawner <ZombieFactory> CreateMobSpawner(ILogger logger, UnityTimeProvider timeProvider, EntitiesSpawner entitiesSpawner, TypeTargetLocator tankMobTargetLocator, StateMachineFactory stateMachineFactory, DefaultRandom random) { var zombieFactories = new List <ZombieFactory>(); foreach (var zombiePrefab in Zombies) { var pool = new SimplePool <Zombie>(logger, 15, 10, p => { var zombie = Instantiate(zombiePrefab); return(zombie); }); var zombieFactory = new ZombieFactory(timeProvider, entitiesSpawner, tankMobTargetLocator, stateMachineFactory, _deps.Doors, pool); zombieFactories.Add(zombieFactory); } var zombieSpawnPoints = GetZombieSpawnPoints(_deps.ZombieSpawnPoints); var mobSpawner = new MobSpawner <ZombieFactory>(random, entitiesSpawner, new MobSpawnerSettings(AliveZombieCount, zombieSpawnPoints), zombieFactories); return(mobSpawner); }
public override void Hit(int damage, RaycastHit hit, bool hitPresent) { health -= damage; if (health <= 0) { if (EEGGameManager.IsInitialized()) { EEGGameManager.Instance.RemoveOutlineObject(GetComponent <OutlineObject> ()); } animator.SetTrigger("Die"); AudioSrc.PlayOneShot(deathClip); if (hitPresent) { deadEffect.transform.position = hit.point; deadEffect.Play(); } Agent.enabled = false; Invoke("DisableAudioSrc", deathClip.length); SetCollidersEnabled(false); if (ZombieFactory.IsInitialized()) { StartCoroutine(ReturnDelayed(10)); SpO2GameManager.Instance.ZombieDied(); } else { enabled = false; } } else { Agent.Move(-hit.normal * 0.4f); } }
public void TestRandomZombieGenerator() { ZombieFactory factory = new ZombieFactory(SmartContractState, 20); factory.CreateRandomZombie("drew"); factory.CreateRandomZombie("verity"); Assert.AreEqual((uint)2, factory.Zombies.Count); }
public static IZombie Make(Catagory catagory, IsRange isRange, ZombieColor color) { ZombieFactory factory = null; if (catagory == Catagory.Crazy) { factory = new CrazyZombieFactory(); } else if (catagory == Catagory.Normal) { factory = new NormalZombieFactory(); } return(factory.Build(isRange, color)); }
public ZombieManager(ZombieDiedSignal zombieDiedSignal, ZombiePool zombiePool, ZombieFactory goFactory, GameConfig gameConfig, StartNewWaveSignal startNewWave, WaveStartedSignal waveStarted, UpdateZombiesCountSignal onUpdateZombiesCountSignal, NightManager nightManager, WindowsManager windowsManager, ZombieConfig zombieConfig, TutorialManager tutorialManager, AnalyticsManager analyticsManager) : base("zombies.json") { _onZombieDiedSignal = zombieDiedSignal; _onStartNewWaveSignal = startNewWave; _onWaveStartedSignal = waveStarted; _onUpdateZombiesCountSignal = onUpdateZombiesCountSignal; _windowsManager = windowsManager; _tutorialManager = tutorialManager; _tutorialManager.ZombieManager = this; _analyticsManager = analyticsManager; _zombiePool = zombiePool; _GOfactory = goFactory; _gameConfig = gameConfig; _nightManager = nightManager; _zombieConfig = zombieConfig; _zombies = new List <Zombie>(); _zombieCountBeforeBoss = _gameConfig.waveSettings.startZombieCount; _currentZombieCount = _zombieCountBeforeBoss; _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount; WaveNumber = _gameConfig.waveSettings.startWave; _currentMainZombieType = ZombieType.Basic; _otherMainTypes = new List <ZombieType>(); _otherMainTypes.Add(ZombieType.Acid); _otherMainTypes.Add(ZombieType.Fire); _otherMainTypes.Add(ZombieType.Armor); _otherMainTypes.Add(ZombieType.Electro); _otherAddTypes = new List <ZombieType>(); _hpPerZombie = new InfInt(); _currentDecadeStartHP = new InfInt(_gameConfig.waveSettings.firstWaveHP); _currentWaveHP = new InfInt(_currentDecadeStartHP); _tempBigNumber = new InfInt(); _tmpBigNumber = new InfInt(); _autoStartNewWave = false; _waveStarted = false; _timeTravelStartLock = false; _lastBossAlive = false; }
public void TestZombieLists() { const string zombNameKey = "ZombieNames"; const string zombDnaKey = "ZombieDNAs"; const string zombNameValue = "ferdeen"; var contract = new ZombieFactory(smartContractState); Assert.AreEqual(0uL, smartContractState.PersistentState.GetList <string>(zombNameKey).Count); Assert.AreEqual(0uL, smartContractState.PersistentState.GetList <uint>(zombDnaKey).Count); uint id = contract.CreateRandomZombie(zombNameValue); Assert.AreEqual(1uL, smartContractState.PersistentState.GetList <string>(zombNameKey).Count); Assert.AreEqual(zombNameValue, smartContractState.PersistentState.GetList <string>(zombNameKey).Get(0)); Assert.AreEqual(1uL, smartContractState.PersistentState.GetList <uint>(zombDnaKey).Count); Assert.AreEqual(id, smartContractState.PersistentState.GetList <uint>(zombDnaKey).Get(0)); }
void Awake() { _instance = this; //Terrain = GetComponent<GameObject>(); }
// Start is called before the first frame update void Start() { Timer = 0; Factory = ZombieFactory.Instance; Factory.CreateZombie(); }
public void CreateNewZombie(string type) { ZombieClass zombie = ZombieFactory.CreateZombie(type, this); this.enemies.Add(zombie); }
// Use this for initialization void Awake() { zombief = this; zombieFac = transform.GetComponentsInChildren <Transform>(); }
void Awake() { _Instance = this; zombies = new List <Zombie>(); }
//Awake and ZombieFactory create a singleton void Awake() { _instance = this; }
public void TestExponent() { ZombieFactory factory = new ZombieFactory(SmartContractState, 20); Assert.AreEqual((ulong)10000000000000000, factory.DnaModulus); }
//Creates our zombie factory and starts by spawning one zombie instantly void Start() { Factory = ZombieFactory.Instance; Factory.CreateZombieRandom(); Timer = 0.0f; }
public override void Update(Zombicide game) { int mapSpeed = 10; game.ActiveCharacter.Update(game); bool moving = Zombie.CheckMoving() || game.ActiveCharacter.moving; //Update UI components life.Text = ("Life: " + (game.ActiveCharacter.DeathThreshold - game.ActiveCharacter.GetDamageTaken()).ToString()); moves.Text = ("Moves Left: " + (game.ActiveCharacter.movesLeft).ToString()); level.Text = ("Level: " + (game.ActiveCharacter.Level).ToString()); experience.Text = ("Experience: " + (game.ActiveCharacter.Experience).ToString()); if ((Weapon)game.ActiveCharacter.MainHandSlot != null) { var mainWeap = (Weapon)game.ActiveCharacter.MainHandSlot; MainHand.Texture = mainWeap.Texture; MainHand.ToolTipText = "Damage: " + mainWeap.Damage + "\nDice: " + mainWeap.Dice + "\nHit Value: " + mainWeap.DiceThreshold + "\nRange: " + mainWeap.MinRange + "-" + mainWeap.MaxRange; MainHand.OutlineColor = (mainWeap.Active) ? Color.Red : Color.White; } else { MainHand.Texture = Character.EmptyHand; MainHand.ToolTipText = null; MainHand.OutlineColor = Color.White; } if ((Weapon)game.ActiveCharacter.OffHandSlot != null) { var offWeap = (Weapon)game.ActiveCharacter.OffHandSlot; OffHand.Texture = offWeap.Texture; OffHand.ToolTipText = "Damage: " + offWeap.Damage + "\nDice: " + offWeap.Dice + "\nHit Value: " + offWeap.DiceThreshold + "\nRange: " + offWeap.MinRange + "-" + offWeap.MaxRange; OffHand.OutlineColor = (offWeap.Active) ? Color.Red : Color.White; } else { OffHand.Texture = Character.EmptyHand; OffHand.ToolTipText = null; OffHand.OutlineColor = Color.White; } BackPackTab.panel.ClearChildren(); game.ActiveCharacter.Backpack.Remove(null); foreach (Item I in game.ActiveCharacter.Backpack) { if (I != null) { Image img = new Image(I.Texture, new Vector2(I.Size.X, I.Size.Y), anchor: Anchor.AutoInline); BackPackTab.panel.AddChild(img); img.OnClick = (Entity i) => { moveItemPopup(img); }; } } //Check endgame conditions if (EndGameFlag == false) { if (game.ActiveCharacter.IsAlive == false) { EndGamePopup(false); } else if (Objective.ObjectiveList.Exists(x => x.flipped == true && x.UndersideColor == "blue")) { EndGamePopup(true); } } if (PopupFlag == false && LastPopupFlag == false && moving == false) { if (game.PreviousMouseState.LeftButton == ButtonState.Pressed && game.MouseState.LeftButton == ButtonState.Released) { MouseClicked(game, 1); } if (game.PreviousMouseState.RightButton == ButtonState.Pressed && game.MouseState.RightButton == ButtonState.Released) { MouseClicked(game, 2); } if (Keyboard.GetState().IsKeyDown(Keys.Space) && whosTurn == MoveState.PlayerTurn) { SearchPopup(); } } LastPopupFlag = PopupFlag; int mapCenterX = mapX + (mapWidth / 2); int mapCenterY = mapY + (mapHeight / 2); if (Keyboard.GetState().IsKeyDown(Keys.Up) && mapCenterY > 0) { mapY -= mapSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Left) && mapCenterX > 400) { mapX -= mapSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Right) && mapCenterX < game.GraphicsDevice.Viewport.Width - 400) { mapX += mapSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Down) && mapCenterY < game.GraphicsDevice.Viewport.Height) { mapY += mapSpeed; } tileHeight = mapHeight / tilesHigh; tileWidth = mapWidth / tilesWide; foreach (Zombie Z in Zombie.zombieList) { Z.Update(game); } if (whosTurn == MoveState.PlayerTurn && moving == false) { applyMoveTiles(game); if (game.ActiveCharacter.movesLeft <= 0) { whosTurn = MoveState.ZombieTurn; } } if (whosTurn == MoveState.ZombieTurn) { //Give zombies their move foreach (Zombie Z in Zombie.zombieList) { if (game.ActiveCharacter.PlayerTile.row == Z.ZombieTile[0] && game.ActiveCharacter.PlayerTile.column == Z.ZombieTile[1]) { Z.attackPlayer(); } else { Z.Move(tileData, game.ActiveCharacter); } } //Spawn new Zombies foreach (var ST in Zombie.SpawnTiles) { if (RNG.Next(0, 2) == 1) { ZombieFactory.Spawn(game.ActiveCharacter.Level, ST[0], ST[1]); } } whosTurn = MoveState.PlayerTurn; game.ActiveCharacter.ResetMoves(moves); } }
void BreakDoor(Zombicide game, Tile T, string side) { bool success = false; if (game.ActiveCharacter.ActiveWeapon.DoorStatus == DoorOpener.True) { //Roll Dice success = true; } else if (game.ActiveCharacter.ActiveWeapon.DoorStatus == DoorOpener.Auto) { //Roll Dice success = true; } else { PopupFlag = true; GeonBit.UI.Utils.MessageBox.ShowMsgBox("Item Cannot Open Doors", "Please Equip An Item That Can Open Doors.", new GeonBit.UI.Utils.MessageBox.MsgBoxOption[] { new GeonBit.UI.Utils.MessageBox.MsgBoxOption("OK", () => { return(true); }) }); PopupFlag = false; } if (success) { if (side == "left") { T.LeftSide = RoomSide.opendoor; var neighborTile = tileData.Find(x => x.row == T.row && x.column == T.column - 1); neighborTile.RighSide = RoomSide.opendoor; } else if (side == "top") { T.TopSide = RoomSide.opendoor; var neighborTile = tileData.Find(x => x.row == T.row - 1 && x.column == T.column); neighborTile.BottomSide = RoomSide.opendoor; } if (side == "right") { T.RighSide = RoomSide.opendoor; var neighborTile = tileData.Find(x => x.row == T.row && x.column == T.column + 1); neighborTile.LeftSide = RoomSide.opendoor; } else if (side == "bottom") { T.BottomSide = RoomSide.opendoor; var neighborTile = tileData.Find(x => x.row == T.row + 1 && x.column == T.column); neighborTile.TopSide = RoomSide.opendoor; } applyMoveTiles(game); game.ActiveCharacter.movesLeft--; //Make function that finds all connnected tiles in a room, this will help with spawning zombies too... //if (findallconnectingtiles.where(x => x.topside==open ||left||right||bottom).count <=1) to check if this is the first time youve opened the room ZombieFactory.SpawnInRooms(T, side, game.ActiveCharacter.Level); if (game.ActiveCharacter.movesLeft == 0) { whosTurn = MoveState.ZombieTurn; } } }
public ZombieWorld() { zFactory = new ZombieFactory(); }