public void AddAttackEffect(string description, Action <Attack> effect) { if (description != null) { Descriptions.Add(description); } AttackEffects.Add(effect); }
public void OnBlockAttack(float damage, GameObject attacker, FacingDirections attackDirection, AttackEffects effect, float power, Vector2 effectDirection, float effectForce) { // if (effect == AttackEffects.HIT) { // this.controller.fsm.UpdateVariable(CharVars.DAMAGE_EFFECT.ToS(), effect); // this.controller.fsm.UpdateVariable(CharVars.NEW_FACING_DIRECTION.ToS(), attackDirection); // this.defenseController.SendSuccessMessage(attacker, effect); // } }
public void OnReceiveAttack(float damage, GameObject attacker, FacingDirections attackDirection, AttackEffects effect, float power, Vector2 effectDirection, float effectForce, bool blocked) { if (effect == AttackEffects.HIT) { this.controller.fsm.UpdateVariable(CharVars.NEW_FACING_DIRECTION.ToS(), attackDirection); this.controller.fsm.UpdateVariable(CharVars.DAMAGE_EFFECT.ToS(), effect); this.controller.fsm.UpdateVariable(CharVars.DAMAGE_EFFECT_DIRECTION.ToS(), effectDirection); this.controller.fsm.UpdateVariable(CharVars.DAMAGE_EFFECT_FORCE.ToS(), this.hitForce); if (blocked) { this.defenseController.SendBlockAttack(damage, attacker, attackDirection, effect, power, effectDirection, effectForce); } else { this.controller.fsm.UpdateVariable(CharVars.IS_BLOCKING.ToS(), false); this.defenseController.SendSuccessMessage(attacker, effect); } } }
protected void ApplyEffectsAroundPosition(Vector3 position) { var collidersInRadius = new List <Collider>(Physics.OverlapSphere(position, SplashRadius)); foreach (var col in collidersInRadius) { var target = col.transform.parent.GetComponent <Npc>(); if (target == null) { continue; } AttackEffects.ForEach(effect => effect.OnHit(Source, target)); } }
public override void Collide(Collider other, Vector3 pos) { var target = other.gameObject.GetComponentInParent <Npc>(); var tile = other.gameObject.GetComponent <Tile>(); if (target != null) { AttackEffects.ForEach(effect => effect.OnHit(Source, target)); tile = target.CurrentTile; } var offset = new Vector3(0, 0.2f + tile.GetTileHeight(), 0f); var axe = new ParticleEffectData("shred", tile.gameObject, offset, shreddingDuration); GameManager.Instance.SpecialEffectManager.PlayParticleEffect(axe); var dmg = Source.Attributes[AttributeName.AttackDamage].Value; var tileEffect = new DamageTileEffect(tile, dmg, Source); tile.SetTileEffect(tileEffect, shreddingDuration); Destroy(gameObject); }
public void SendSuccessMessage(GameObject attacker, AttackEffects effect) { attacker.BroadcastMessage("AttackSuccess", new System.Object[] { this.gameObject, (int)effect}); }
public void SendReceiveAttack(float damage, GameObject attacker, FacingDirections attackDirection, AttackEffects effect, float power, Vector2 effectDirection, float effectForce, bool blocked) { if (OnReceiveAttack != null) { this.OnReceiveAttack(damage, attacker, attackDirection, effect, power, effectDirection, effectForce, blocked); } }
public void AddEffect(IAttackEffect effect) => AttackEffects.Add(effect);