private void OnUnitAttacked(object sender, AttackEventArgs e) { if (!(CellGrid.CurrentPlayer is HumanPlayer)) return; OnUnitDehighlighted(sender, new EventArgs()); if ((sender as Unit).HitPoints <= 0) return; OnUnitHighlighted(sender, e); }
private void Actor_Hurt(object sender, AttackEventArgs attackArgs) { Actor victim = (Actor) sender; if (behaviorLists.ContainsKey(victim)) { ActionList victimBehaviorList = behaviorLists[victim]; Aggravated aggravated = new Aggravated(victimBehaviorList, victim, attackArgs.damageInfo.attacker); Stunned stunned = new Stunned(victimBehaviorList, victim); if (!victimBehaviorList.has(aggravated) && !victimBehaviorList.has(stunned)) victimBehaviorList.pushFront(aggravated); if (!victimBehaviorList.has(stunned)) victimBehaviorList.pushFront(stunned); } }
private void ActorUnitDestroyed(object sender, AttackEventArgs e) { if (HasItem) { ThrowItem(); } if (HitPoints > 0) { var gameManager = FindObjectOfType<GameManager>(); gameManager.SpawnTeleport(Cell.transform.position); gameManager.PlaySound(gameManager.teleportSoundEffect); } else { Instantiate(tombStone, transform.position, Quaternion.identity); PlayerPrefs.SetInt("Killed_Players", PlayerPrefs.GetInt("Killed_Players") + 1); } }
protected virtual bool OnHitEntities(IReadOnlyList <IEntity> entities, AttackEventArgs eventArgs) { return(true); }
public void AttackSelect(object sender, AttackPlanFrom attacker) { var e = new AttackEventArgs(attacker.Plan, attacker); AttackSelect(sender, e); }
private void EnemyUnitAttacked(object sender, AttackEventArgs e) { PlayerPrefs.SetInt("Damage_Dealt", PlayerPrefs.GetInt("Damage_Dealt") + e.Damage); }
private IEnumerator ClarkeController_BaseAttackEvent(object sender, AttackEventArgs e) { isCoolDown = true; if (!isAttacking) { Debug.Log("Attacking"); actionMovementLockout = true; isAttacking = true; anim.SetBool("IsAttacking", true); var attackPoint = transform.position; var hitBox = new Vector3(); switch (Facing) { case Direction.Up: { hitBox.y = 0.5f; hitBox.x = 1.5f; attackPoint.y += 1; break; } case Direction.Right: { hitBox.y = 1.5f; hitBox.x = 0.5f; attackPoint.x += 1; break; } case Direction.Down: { hitBox.y = 0.5f; hitBox.x = 1.5f; attackPoint.y -= 1; break; } case Direction.Left: { hitBox.y = 1.5f; hitBox.x = 0.5f; attackPoint.x -= 1; break; } } foreach (var item in nearEnemy) { Debug.Log("Enemy"); Vector3 vec = item.transform.position; Vector3 direction = vec - attackPoint; var dot = Vector3.Dot(direction, hitBox); if (dot < 0.7) { var itemStats = item.gameObject.GetComponent<Stats>(); itemStats.Health -= 10; } } yield return new WaitForSeconds(.2f); anim.SetBool("IsAttacking", false); isAttacking = false; actionMovementLockout = false; } yield return new WaitForSeconds(.6f); if (!isAttacking) { isCoolDown = false; } }
private void OnUnitDestroyed(object sender, AttackEventArgs e) { InfoPanel.SetActive(false); }
public void UseMana(AttackEventArgs attackEventArgs) { runtimeStats.Mana.Current = 0; }
private void Actor_Attack(object sender, AttackEventArgs e) { handleActorAttack(e.damageInfo); }
IEnumerator EndAbility(AttackEventArgs attackEventArgs) { yield return(new WaitForSeconds(baseStats.AbilityWindup + baseStats.AbilityWinddown)); AbilityEndWinddownEvent?.Invoke(attackEventArgs); }
IEnumerator DelayAbility(AttackEventArgs attackEventArgs) { yield return(new WaitForSeconds(baseStats.AbilityWindup)); AbilityOrder(attackEventArgs); }
// Ability // Kicks off coroutines for times off when Ability should hit and attack should end public void StartAbility(AttackEventArgs attackEventArgs) { StartCoroutine(DelayAbility(attackEventArgs)); StartCoroutine(EndAbility(attackEventArgs)); }
// Calls PreAttack, Attack, and PostAttack events so they go in order public void AttackOrder(AttackEventArgs attackEventArgs) { PreAttackEvent?.Invoke(attackEventArgs); AttackEvent?.Invoke(attackEventArgs); PostAttackEvent?.Invoke(attackEventArgs); }
IEnumerator DelayAttack(AttackEventArgs attackEventArgs) { yield return(new WaitForSeconds(baseStats.AttackWindup)); AttackOrder(attackEventArgs); }
// Kicks off coroutines for times off when attacks should hit and attack should end public void StartAttack(AttackEventArgs attackEventArgs) { StartCoroutine(DelayAttack(attackEventArgs)); StartCoroutine(EndAttack(attackEventArgs)); }
// Lowers the Character's health bu the amount in attackEventArgs public void TakeDamage(AttackEventArgs attackEventArgs) { runtimeStats.Health.Current -= attackEventArgs.Damage; //Debug.Log("Damage done to \"" + ID + "\": attackEventArgs.Damage"); }
protected IEnumerator BaseAttack(AttackEventArgs e) { return AttackEvent(this, new AttackEventArgs()); }
private void OnUnitDestroyed(object sender, AttackEventArgs e) { Units.Remove(sender as Unit); var totalPlayersAlive = Units.Select(u => u.PlayerNumber).Distinct().ToList(); //Checking if the game is over if (totalPlayersAlive.Count == 1) { if(GameEnded != null) { GameEnded.Invoke(this, new EventArgs()); } } }
// For Testing // Changes color of character for end of attack public void EndAbilityAnimation(AttackEventArgs attackEventArgs) { spriteAttributeChanger.FlashColor(Color.cyan, character.baseStats.AbilityWinddown); }
// Calls PreAbility, Ability, and PostAbility events so they go in order public void AbilityOrder(AttackEventArgs attackEventArgs) { PreAbilityEvent?.Invoke(attackEventArgs); AbilityEvent?.Invoke(attackEventArgs); PostAbilityEvent?.Invoke(attackEventArgs); }
private void OnUnitDestroyed(object sender, AttackEventArgs e) { if ((sender as shinsaUnit).UnitName == "Archflamen") { if(GameEnded != null) GameEnded.Invoke(sender, new EventArgs()); } }
// Does the stuff for an animation of the attack public void AbilityAnimation(AttackEventArgs attackEventArgs) { //animator.SetTrigger("Attack"); spriteAttributeChanger.FlashColor(Color.yellow, character.baseStats.AbilityWindup); }
// This is bandaid work around for Events that will through an exception when nothing is subscribed to them public void StopException(AttackEventArgs attackEventArgs) { }
public virtual void CastAbility(AttackEventArgs attackEventArgs) { }
public void RaiseHitEvent(AttackEventArgs attackEventArgs) { HitEvent(attackEventArgs); }
void OnAttack(Creature c, AttackEventArgs e) { setBuff(ref creature.statistics.critical, 0); }
public void PeePeePooPoo(AttackEventArgs eh) { //Debug.Log("HEEHE"); }
private void EnemyUnitDestroyed(object sender, AttackEventArgs e) { PlayerPrefs.SetInt("Enemies_Killed", PlayerPrefs.GetInt("Enemies_Killed") + 1); }
public void PrintStartAttackWindupEvent(AttackEventArgs attackEventArgs) { //Debug.Log("Start Attack Wind Up Event"); }
public void AttackSelect(object sender, AttackPlan plan) { var e = new AttackEventArgs(plan, null); AttackSelect(sender, e); }
public void PrintEndAttackWindupEvent(AttackEventArgs attackEventArgs) { //Debug.Log("End Attack Wind Up Event"); }
bool IAttack.ClickAttack(AttackEventArgs eventArgs) { if (eventArgs.WideAttack) { return(false); } var curTime = _gameTiming.CurTime; if (curTime < _cooldownEnd || !eventArgs.Target.IsValid()) { return(true); } var target = eventArgs.TargetEntity; var location = eventArgs.User.Transform.Coordinates; var angle = new Angle(eventArgs.ClickLocation.ToMapPos(Owner.EntityManager) - location.ToMapPos(Owner.EntityManager)); var audioSystem = EntitySystem.Get <AudioSystem>(); if (target != null) { audioSystem.PlayFromEntity(_hitSound, target); } else { audioSystem.PlayFromEntity(_missSound, eventArgs.User); return(false); } if (target.TryGetComponent(out IDamageableComponent damageComponent)) { damageComponent.ChangeDamage(DamageType, Damage, false, Owner); } SendMessage(new MeleeHitMessage(new List <IEntity> { target })); var targets = new[] { target }; if (!OnHitEntities(targets, eventArgs)) { return(false); } if (ClickArc != null) { var sys = EntitySystem.Get <MeleeWeaponSystem>(); sys.SendAnimation(ClickArc, angle, eventArgs.User, Owner, targets, ClickAttackEffect, false); } _lastAttackTime = curTime; _cooldownEnd = _lastAttackTime + TimeSpan.FromSeconds(CooldownTime); if (Owner.TryGetComponent(out ItemCooldownComponent cooldown)) { cooldown.CooldownStart = _lastAttackTime; cooldown.CooldownEnd = _cooldownEnd; } return(true); }
public void PrintAttackEvent(AttackEventArgs attackEventArgs) { //Debug.Log("Attack Event"); }
bool IAttack.WideAttack(AttackEventArgs eventArgs) { if (!eventArgs.WideAttack) { return(true); } var curTime = _gameTiming.CurTime; if (curTime < _cooldownEnd) { return(true); } var location = eventArgs.User.Transform.Coordinates; var angle = new Angle(eventArgs.ClickLocation.ToMapPos(Owner.EntityManager) - location.ToMapPos(Owner.EntityManager)); // This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes. var entities = ArcRayCast(eventArgs.User.Transform.WorldPosition, angle, eventArgs.User); var audioSystem = EntitySystem.Get <AudioSystem>(); if (entities.Count != 0) { audioSystem.PlayFromEntity(_hitSound, entities.First()); } else { audioSystem.PlayFromEntity(_missSound, eventArgs.User); } var hitEntities = new List <IEntity>(); foreach (var entity in entities) { if (!entity.Transform.IsMapTransform || entity == eventArgs.User) { continue; } if (entity.TryGetComponent(out IDamageableComponent damageComponent)) { damageComponent.ChangeDamage(DamageType, Damage, false, Owner); hitEntities.Add(entity); } } SendMessage(new MeleeHitMessage(hitEntities)); if (!OnHitEntities(hitEntities, eventArgs)) { return(false); } if (Arc != null) { var sys = EntitySystem.Get <MeleeWeaponSystem>(); sys.SendAnimation(Arc, angle, eventArgs.User, Owner, hitEntities); } _lastAttackTime = curTime; _cooldownEnd = _lastAttackTime + TimeSpan.FromSeconds(ArcCooldownTime); if (Owner.TryGetComponent(out ItemCooldownComponent cooldown)) { cooldown.CooldownStart = _lastAttackTime; cooldown.CooldownEnd = _cooldownEnd; } return(true); }
public void PrintEndAttackWinddownEvent(AttackEventArgs attackEventArgs) { //Debug.Log("End Attack Wind Down Event"); }
private void OnUnitDestroyed(object sender, AttackEventArgs e) { Destroy(_infoPanel); }
// Enables charging of attack public void EnableCharge(AttackEventArgs attackEventArgs) { canCharge = true; }
private void OnUnitDestroyed(object sender, AttackEventArgs e) { Destroy(_infoPanel); }
// Disables charging of attack public void DisableCharge(AttackEventArgs attackEventArgs) { canCharge = false; }
public void HitAnimation(AttackEventArgs attackEventArgs) { //spriteAttributeChanger.SquashSprite(.5f); ShowFloatingText(attackEventArgs); }
// For Testing // Changes color of character for end of attack public void EndAttackAnimation(AttackEventArgs attackEventArgs) { spriteAttributeChanger.FlashColor(Color.green, character.baseStats.AttackWinddown); }
void OnAttack(Creature c, AttackEventArgs e) { if (creature.modifyMana(-8)) e.target.buffs.Add(new Frost(e.target, level)); }
private void ActorUnitAttacked(object sender, AttackEventArgs e) { PlayerPrefs.SetInt("Damage_Taken", PlayerPrefs.GetInt("Damage_Taken") + e.Damage); }