public void ReturnNull_GivenNoItems() { var survivor = new Survivor(); InventoryItem result = survivor.SellItem(0); result.Should().BeNull(); }
public void IsFalseForFewerThan2Wounds(int wounds) { Survivor survivor = new Survivor(); survivor.Wounds = wounds; Assert.False(survivor.IsDead); }
public void IsTrueAt2OrMoreWounds(int wounds) { Survivor survivor = new Survivor(); survivor.Wounds = wounds; Assert.True(survivor.IsDead); }
public void Start(Survivor survivor) { Owner = survivor; IsActive = true; Thread thread = new Thread(new ThreadStart(DoHeartbeats)); thread.Start(); }
// Start is called before the first frame update void Start() { col = gameObject.transform.GetComponent <BoxCollider>(); isOccupied = false; occupant = null; controlling_player = gameObject.transform.parent.GetComponentInParent <Player>(); setColor(new Color(0.78f, 0.66f, 0.46f, 0.2f)); }
public void SetGameNotifierOnSurvivor_WhenAddingNewSurvivor() { var game = new Game(); var bill = new Survivor("Bill"); var successfullyAddedSurvivor = game.AddSurvivorToGame(bill); Assert.IsNotNull(game.Survivors.FirstOrDefault(s => s.Name.Equals("Bill"))); Assert.IsNotNull(game.Survivors.First(s => s.Name.Equals("Bill")).Notifier); }
public void AddNewSurvivor_GivenNoCurrentSurvivors() { var game = new Game(); var bill = new Survivor("Bill"); var successfullyAddedSurvivor = game.AddSurvivorToGame(bill); Assert.IsTrue(successfullyAddedSurvivor); Assert.AreEqual(1, game.Survivors.Count()); }
public void AddOneSurvivorToGame() { var survivor = new Survivor("Sam"); game.AddSurvivor(survivor); game.Players.Count.ShouldBe(1); game.Players.First().Name.ShouldBe("Sam"); }
IEnumerator _ActivateSurvivor(Survivor survivor) { yield return(new WaitForSeconds(1f)); survivor.action.ResetActions(); HUD.instance.HideSurvivorCards(); HUD.instance.ShowSurvivorCard(survivor); Cam.instance.LookAt(survivor.transform); }
void SpawnSurvivorCard(Survivor survivor) { GameObject cardClone = Instantiate(survivorCardPrefab, survivorCardParent, false); survivor.card = cardClone.GetComponent <SurvivorCard>(); survivor.card.SetUp(survivor); survivor.card.nameText.text = survivor._name; survivor.card.characterImage.sprite = survivor.characterImage; }
// =================================================== survivor function // create a survivor private Survivor CreateSurvivor(string name, GameObject image) { Survivor stmp = new Survivor(); stmp.Init(_gameWorld, name); stmp.Name = name; stmp.image = image; return(stmp); }
private static Func <GameState, Phase> IncorporateSurvivorFn(Survivor survivor, IEnumerable <Survivor> survivors, Phase next) => gs => { gs.Group.AddSurvivor(survivor); var remainingSurvivors = survivors.Where(s => s != survivor); return(remainingSurvivors.Any() ? Create(remainingSurvivors, next) : next); };
public void SetSupportTarget(Button choice) { Survivor[] survivors = GameManager.gm.GetSurvivors(); int i = Array.IndexOf(supportButtons, choice); supportTarget = survivors[i]; KeepHighlight(choice); }
// Update is called once per frame void Update() { //for testing to ensure survivors are added to list if (Input.GetKeyDown(KeyCode.K)) { foreach (GameObject go in listOfSurvivors) { Debug.Log(go.name); } } //MouseClick For selecting Survivor if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { if (hit.collider.tag == "Survivor") { selectedSurvivor = hit.transform.gameObject; // gets the hit Gameobject and sets as selected selectedMotor = selectedSurvivor.GetComponent <SurvivorMovement>(); SurvivorDetails = selectedSurvivor.GetComponent <Survivor>(); selectedSurvivor.GetComponent <SurvivorMovement>().isSelected = true; Debug.Log("select"); UpdateUIInfo(); } } } if (selectedSurvivor != null) { selectedMotor.movementDirection = Input.GetAxis("Horizontal") * screenMovementRight + Input.GetAxis("Vertical") * screenMovementForward; minimapCamera.transform.position = new Vector3(selectedSurvivor.transform.position.x, 100, selectedSurvivor.transform.position.z); //if (Input.GetAxis(Axis_X) != 0 || Input.GetAxis(Axis_Y) != 0) //{ // anim.SetBool("IsWalking", true); //} //else //{ // anim.SetBool("IsWalking", false); //} } }
public void IsDeadSurvivorTest() { Survivor survivor = new Survivor(); Monster monster = new Monster(); monster.Attack(survivor); monster.Attack(survivor); Assert.IsTrue(survivor.IsDead); }
public void TakeOneWoundAndNotDie_GivenAtFullHeath() { var survivor = new Survivor("Bill"); survivor.SustainInjury(1); Assert.AreEqual(1, survivor.Wounds); Assert.IsTrue(survivor.IsAlive); }
public static void AddSurvivor(Survivor s) { if (instance.survivors == null) { instance.survivors = new List <Survivor> (); } instance.survivors.Add(s); }
private Vector3 Seek(Survivor s, Vector3 target) { Vector3 dir = target - s.transform.position; dir.Normalize(); dir *= dir.magnitude; return(dir); }
public void SetComponents(Survivor survivor, string[] msg) { nameText.text = survivor.charName; portrait.sprite = survivor.portrait; textStrings = msg; caller = survivor; StartScrolling(); }
public void OneItemPickedUpGoesInHand() { var survivor = new Survivor("John"); var knife = EquipmentFactory.GetEquipment(EquipmentType.Knife); var isPickedUp = survivor.PickUpItem(knife); Assert.IsTrue(survivor.Inventory.Contains(knife)); Assert.IsTrue(knife.InHand); }
public void AddOneEquipmentToInventory() { var survivor = new Survivor("John"); var knife = EquipmentFactory.GetEquipment(EquipmentType.Knife); var isPickedUp = survivor.PickUpItem(knife); Assert.IsTrue(survivor.Inventory.Contains(knife)); Assert.IsTrue(isPickedUp); }
public void CreateRandom() { Survivor survivor = new Survivor(); survivor.gender = SetGender(); survivor.firstName = AddFirstName(survivor.gender); survivor.lastName = AddLastName(); }
int CheckMoveDistance(Survivor survivor) { List <Spot> path = PathFinding.instance.FindPath(survivor.currentSpot, this); if (path != null) { return(PathFinding.instance.GetPathDistance(path)); } return(int.MaxValue); }
public void TakeTwoWoundsAndDie_GivenAtFullHeath() { var survivor = new Survivor("Bill"); survivor.SustainInjury(1); survivor.SustainInjury(1); Assert.AreEqual(2, survivor.Wounds); Assert.IsFalse(survivor.IsAlive); }
public void DieIfTwoWoundsReceived() { var survivor = new Survivor("John"); survivor.ReceiveWound(1); survivor.ReceiveWound(1); Assert.AreEqual(2, survivor.Wounds); Assert.IsFalse(survivor.IsAlive); }
void Start() { livingEntity = GetComponent <LivingEntity> (); gunController = GetComponent <GunController> (); unit = GetComponent <Unit> (); database = GameObject.Find("SpecialisationDatabase").GetComponent <SpecialisationDatabase> (); survivor = GetComponent <Survivor> (); waveManager = GameObject.Find("GameManager").GetComponent <WaveManager> (); waveManager.waveEndEvent += OnWaveEnd; }
void OnTriggerEnter(Collider other) { if (other.gameObject.layer == LayerMask.NameToLayer("Survivor")) { Survivor s = other.gameObject.GetComponent <Survivor> (); s.AddHealth(this); GameManager.RemoveItem(this); Destroy(gameObject); } }
public void EquipmentIsAddedToInventory_GivenSufficientCapacity() { var survivor = new Survivor("Bill"); var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat); var isPickedUp = survivor.PickUpItem(baseballBat); Assert.IsTrue(survivor.Inventory.Contains(baseballBat)); Assert.IsTrue(isPickedUp); }
public void FirstItemPickedUpIsInHand_GivenNoItemsInInventory() { var survivor = new Survivor("Bill"); var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat); var isPickedUp = survivor.PickUpItem(baseballBat); Assert.IsTrue(survivor.Inventory.Contains(baseballBat)); Assert.IsTrue(baseballBat.InHand); }
public bool Enter(Survivor survivor) { if (SurvivorInside != null) { return(false); } SurvivorInside = survivor; survivor.InLocker = true; return(true); }
// Create object in room upon user click private void MakeSpaceObject(string texName, Image tex, DrawPoint mp) { texName = texName.Replace(".png", ""); int numberOfFrames = SpaceObject.GetNumberOfFrames(texName); //Much repeated code to account for each possible object if (rb_WallStatic.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); WallStatic wall = new WallStatic( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); wall.TextureName = texName; currentlySelectedRoom.AddObject(wall); } else if (rb_WallDynamic.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); WallDynamic wall = new WallDynamic( Conversion.DrawPointToVector2(mp), new Vector2(0, 0), currdir + "\\" + texName + ".tri"); wall.TextureName = texName; currentlySelectedRoom.AddObject(wall); } else if (rb_HazardStatic.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); HazardStatic hazard = new HazardStatic( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); hazard.TextureName = texName; currentlySelectedRoom.AddObject(hazard); } else if (rb_HazardDynamic.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); HazardDynamic hazard = new HazardDynamic( Conversion.DrawPointToVector2(mp), new Vector2(0, 0), currdir + "\\" + texName + ".tri"); hazard.TextureName = texName; currentlySelectedRoom.AddObject(hazard); } else if (rb_Parts.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); Part part = new Part( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); part.TextureName = texName; currentlySelectedRoom.AddObject(part); } else if (rb_Survivors.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); Survivor survivor = new Survivor( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); survivor.TextureName = texName; //sets up the survivor color as appropriate switch (survivor.TextureName) { case "Art\\Survivors\\SurvivorBlue": survivor.SColor = Survivor.survivorColor.BLUE; break; case "Art\\Survivors\\SurvivorRed": survivor.SColor = Survivor.survivorColor.RED; break; case "Art\\Survivors\\SurvivorYellow": survivor.SColor = Survivor.survivorColor.YELLOW; break; case "Art\\Survivors\\SurvivorPurple": survivor.SColor = Survivor.survivorColor.PURPLE; break; case "Art\\Survivors\\SurvivorOrange": survivor.SColor = Survivor.survivorColor.ORANGE; break; case "Art\\Survivors\\Survivor": survivor.SColor = Survivor.survivorColor.GREEN; break; default: break; } currentlySelectedRoom.AddObject(survivor); } else if (rb_Vanish_Walls.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); VanishWall vanish = new VanishWall( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); vanish.TextureName = texName; currentlySelectedRoom.AddObject(vanish); } else if (rb_Handlebars.Checked) { mp.X -= (texture.Width / 2); mp.Y -= (texture.Height / 2); Handlebar hdlbar = new Handlebar( Conversion.DrawPointToVector2(mp), new Vector2(0, 0), currdir + "\\" + texName + ".tri"); hdlbar.TextureName = texName; currentlySelectedRoom.AddObject(hdlbar); } else if (rb_VictoryTest.Checked) { mp.X -= (texture.Width / 2); mp.Y -= (texture.Height / 2); VictoryTest victest = new VictoryTest( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); victest.TextureName = texName; currentlySelectedRoom.AddObject(victest); } else if (rb_SavePoint.Checked) { mp.X -= (texture.Width / (numberOfFrames * 2)); mp.Y -= (texture.Height / 2); SavePoint savePoint = new SavePoint( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri"); savePoint.TextureName = texName; currentlySelectedRoom.AddObject(savePoint); } else if (rb_Player.Checked) { mp.X -= (int)((texture.Width * Constants.PLAYER_SCALE) / 2); mp.Y -= (int)((texture.Height * Constants.PLAYER_SCALE) / 2); world.player = new Player( Conversion.DrawPointToVector2(mp), currdir + "\\" + texName + ".tri" ); world.CurrentRoom = currentlySelectedRoom; world.player.TextureName = texName; } }