void Awake() { rigidbodyPlayer = GetComponent <Rigidbody>(); mainCamera = FindObjectOfType <Camera>(); resurrection = FindObjectOfType <Resurrection>(); state = State.normal; }
public Resurrection(Resurrection other) { fMaxHealthModifier = other.fMaxHealthModifier; bZombify = other.bZombify; slotToRes = other.slotToRes; resPFX = other.resPFX; resSound = other.resSound; }
//KNOW IF PLAYERS AROUND TO RESS private void scanBleedingPlayers() { if (!bleedingOut) { Collider2D[] hits = Physics2D.OverlapCircleAll(gameObject.transform.position, _scanPlayersRadius, _playerMask); if (hits.Length <= 1) { if (hits[0].gameObject == gameObject) { Debug.Log("Jugador no encontrado. Soy (" + gameObject.name + ")"); _playerToRess = null; if (_pressToRessObject != null) { Destroy(_pressToRessObject); } return; } } foreach (var hit in hits) { if (hit.gameObject != gameObject) { Debug.Log("Jugador encontrado. Soy (" + gameObject.name + ") - Encontré (" + hit.gameObject + ")"); if (hit.gameObject.GetComponent <Resurrection>())//tiene el componente { Resurrection ressComp = hit.gameObject.GetComponent <Resurrection>(); if (ressComp.bleedingOut)//si ese jugador con el que hice hit esta herido { Debug.Log("Jugador encontrado esta herido"); if (_playerToRess != null) { if (hit.gameObject != _playerToRess)//si ya tengo un player al cual dal ress y encuentor uno diferente { _playerToRess = hit.gameObject; _pressToRessObject = Instantiate(_pressToRessPrefab, gameObject.transform); _pressToRessObject.transform.localPosition = Vector3.zero; } } else//si no tengo simplemente asignar { _playerToRess = hit.gameObject; _pressToRessObject = Instantiate(_pressToRessPrefab, gameObject.transform); _pressToRessObject.transform.localPosition = Vector3.zero; } return; } } } } } }
public void ApplyAfterDefending_ShouldThrowWithCorrectMessage_IfDefenderWithSpecialtyParamenterIsNull() { ICreaturesInBattle defenderWithSpecialty = null; var specialty = new Resurrection(); var exception = Assert.Throws <ArgumentNullException>(() => specialty.ApplyAfterDefending(defenderWithSpecialty)); StringAssert.Contains("defenderWithSpecialty", exception.Message); }
private void Awake() { anima = GetComponent <Animator>(); aiChController = GetComponent <CharacterController>(); navig = GetComponent <NavMeshAgent>(); live = true; res = Camera.main.GetComponent <Resurrection>(); navig.enabled = false; }
public void ReturnCorrectTotalHitPoints_WhenApplyAfterDefendingIsCalled() { var resurrection = new Resurrection(); var angel = new Angel(); var creaturesInBattle = new CreaturesInBattle(angel, 1); resurrection.ApplyAfterDefending(creaturesInBattle); Assert.AreEqual(200, creaturesInBattle.TotalHitPoints); }
public void ApplyAfterDefending_ShouldNotSetDefenderWithSpecialtyTotalHitPoints_WhenTotalHitPointsAreLessThanOrEqualToZero() { var defenderWithSpecialty = new Mock <ICreaturesInBattle>(); defenderWithSpecialty.SetupGet(mock => mock.TotalHitPoints).Returns(0); defenderWithSpecialty.SetupSet(mock => mock.TotalHitPoints = It.IsAny <int>()); var specialty = new Resurrection(); specialty.ApplyAfterDefending(defenderWithSpecialty.Object); defenderWithSpecialty.VerifySet(mock => mock.TotalHitPoints = It.IsAny <int>(), Times.Never()); }
public void AppleyAfterDefending_ShouldSetDefenderWithSpecialtyTotalHitPoiints_WhenTotalHitPointsIsLargerThanZero() { var stubCreature = new FakeCreature(); var defenderWithSpecialty = new Mock <ICreaturesInBattle>(); defenderWithSpecialty.SetupGet(mock => mock.Count).Returns(1); defenderWithSpecialty.SetupGet(mock => mock.Creature).Returns(stubCreature); defenderWithSpecialty.SetupGet(mock => mock.TotalHitPoints).Returns(10); defenderWithSpecialty.SetupSet(mock => mock.TotalHitPoints = It.IsAny <int>()); var specialty = new Resurrection(); specialty.ApplyAfterDefending(defenderWithSpecialty.Object); defenderWithSpecialty.VerifySet(mock => mock.TotalHitPoints = It.IsAny <int>(), Times.Once()); }
public void Setup(PlayerStatus playerStatus) { this.playerStatus = playerStatus; //アイテムのセットアップ items = new Dictionary <ItemType, ItemBase>(); ItemBase item; item = new Rest(); items.Add(item.Type, item); item = new LevelUp(); items.Add(item.Type, item); item = new Portion(); items.Add(item.Type, item); item = new InfinitePower(); items.Add(item.Type, item); item = new Resurrection(); items.Add(item.Type, item); }
public Undead() { this.Health = 100; resurrectionBehavior = new Resurrection(); base.TreatEstablished += this.IncreaseHealth; }
private void KillGroup(MinionSlotType slotType) { foreach (Actor_Player actor in Core.GetLevel().playerActors) { actor.minion.template.TriggerBuff(slotType == MinionSlotType.MELEE ? BuffTrigger.PLAYER_MELEE_DIED : BuffTrigger.PLAYER_RANGED_DIED, null); } List <Resurrection> resList = Core.GetLevel().singleUseResurrections; for (int i = 0; i < resList.Count; i++) { Resurrection res = resList [i]; if (res.slotToRes == slotType) { resList.RemoveAt(i); Core.GetAudioManager().PlayResSFX(res.resSound); // Do achievements Core.TriggerAchievement("BACK_FROM_THE_DEAD"); Core.IncrementStat("NUM_RESURRECTIONS", 2); if (bHasThreeResurrectsAvailable) { bool bLastResUsed = true; foreach (Resurrection check in resList) { if (check.slotToRes == slotType) { bLastResUsed = false; } } if (bLastResUsed) { Core.TriggerAchievement("AND_HERE_TO_STAY"); } } for (int j = 0; j < slotType.GetNumSlots(); j++) { MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + j); minions [(int)slot].fMaxHealthPreBuffs *= res.fMaxHealthModifier; minions [(int)slot].fMaxHealthPostBuffs *= res.fMaxHealthModifier; minions [(int)slot].isZombified = true; // Play PFX PFX_DebuffIcon pfx = Instantiate <PFX_DebuffIcon>(res.resPFX); pfx.transform.SetParent(Core.GetLevel().playerActors [(int)slot].transform); pfx.transform.localPosition = new Vector3(0.0f, 0.0f, -0.25f); pfx.Init(true); } RecalculateHealths(slotType); return; } } for (int i = 0; i < slotType.GetNumSlots(); i++) { MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + i); KillMinion(slot); } Core.GetLevel().PlayerLost(); }
public static bool Resurrect(this GameObject obj, ResurrectionType type, int casterLevel = 0) { return(Resurrection.Resurrect(obj, type)); }
public void ThrowArgumentNullException_WhenApplyAfterDefendingIsCalledWithNullDefender() { var resurrection = new Resurrection(); Assert.Throws <ArgumentNullException>(() => resurrection.ApplyAfterDefending(null)); }