public void AddAttack(float time, AttackType type, AttackArgs args) { _attacks.Add(new TimelineAttack() { Time = time, Type = type, Args = args }); }
protected virtual void Attacked(AttackArgs.HitByAttack attackHit, Fighter target, int damage) { AttackArgs attackArgs = new AttackArgs() { AttackHit = attackHit, Target = target, Attacker = this, Damage = damage }; OnAttack?.Invoke(this, attackArgs); FighterEffectManager.GetDamageFromAttack(attackArgs); }
private void HandleAttack(AttackArgs args) { var source = args.source; if (!source.hasEnergy) { source.AddEnergy(0); } source.ReplaceEnergy(source.stats.attackSpeed + source.energy.energyCost); }
public static bool Execute(AttackType type, AttackArgs args, bool isEcho) { var attack = GetAttack(type); if (attack == null) { return(false); } attack.Execute(args, isEcho); return(true); }
public override void Execute(AttackArgs args, bool isEcho) { base.Execute(args, isEcho); var melee = Instantiate(args.IsPerfect ? Perfect : Regular, args.Position, args.Rotation); if (isEcho) { melee.GetComponent <AudioSource>().volume *= 0.25f; } Basecamp.Hit(); }
public override void Execute(AttackArgs args, bool isEcho) { base.Execute(args, isEcho); var projectile = Instantiate(args.IsPerfect ? Perfect : Regular, args.Position, args.Rotation); if (isEcho) { projectile.GetComponent <AudioSource>().volume *= 0.25f; } projectile.Speed *= args.Multiplier; Basecamp.Shoot(); }
public void Attack(float multiplier, bool isPerfect) { var target = Cameraer.Instance.GetTargetPosition(); transform.LookAt(new Vector3(target.x, transform.position.y, target.z)); var args = new AttackArgs() { Position = transform.position, Rotation = transform.rotation, Multiplier = multiplier, IsPerfect = isPerfect }; Attacks.Execute(AttackType, args, false); Attacked?.Invoke(this, new AttackedArgs(AttackType, args)); }
private void onTouchEnded(object sender, TouchEventArgs args) { var touch = args.Touch; var gridVector = this.Map.GlobalToGrid(touch.position); if (this.attackableLocations.Contains(gridVector)) { this.ParentController.ClearOverlay(); Futile.instance.SignalUpdate -= Update; var margs = new AttackArgs() { Actor = this.SelectedActor, TargetedLocation = gridVector, Map = this.Map }; this.AttackAbility.AbilityEnded += abilityEnded; this.AttackAbility.StartExecute(margs); } }
protected override void ExecuteImpl(object args) { this.attackArgs = this.ConvertArgs<AttackArgs>(args); var projectileEnd = AwayTeam.GridToGlobal(attackArgs.TargetedLocation); var projectileStart = AwayTeam.GridToGlobal(attackArgs.Actor.GridPosition); var actor = attackArgs.Actor; var weapon = attackArgs.Actor.EquippedItem as WeaponProperties; bool hits = false; var squareHit = this.GetSquareHit(attackArgs.Actor, attackArgs.TargetedLocation); if (attackArgs.Map.TryGetActor(attackArgs.TargetedLocation, out hitActor)) { var hitChance = GetChanceToHitActor(attackArgs.Actor, hitActor, weapon); var hitRoll = UnityEngine.Random.Range(0.0f, 1.0f); if (hitRoll <= hitChance) { hits = true; this.damage = this.GetDamageOnHit(attackArgs.Actor, hitActor, weapon); } } this.shootLaser(projectileStart, projectileEnd, hits, this.damage); }
protected override void ExecuteImpl(object args) { this.attackArgs = this.ConvertArgs <AttackArgs>(args); var projectileEnd = AwayTeam.GridToGlobal(attackArgs.TargetedLocation); var projectileStart = AwayTeam.GridToGlobal(attackArgs.Actor.GridPosition); var actor = attackArgs.Actor; var weapon = attackArgs.Actor.EquippedItem as WeaponProperties; bool hits = false; var squareHit = this.GetSquareHit(attackArgs.Actor, attackArgs.TargetedLocation); if (attackArgs.Map.TryGetActor(attackArgs.TargetedLocation, out hitActor)) { var hitChance = GetChanceToHitActor(attackArgs.Actor, hitActor, weapon); var hitRoll = UnityEngine.Random.Range(0.0f, 1.0f); if (hitRoll <= hitChance) { hits = true; this.damage = this.GetDamageOnHit(attackArgs.Actor, hitActor, weapon); } } this.shootLaser(projectileStart, projectileEnd, hits, this.damage); }
public override void OnNotify(AttackArgs param) { // TODO: Change hard coded number damageable.TakeDamage(Mathf.RoundToInt(param.damage * 0.5f)); controller.SwitchState <NotDefendingCharacterState>(); }
public AttackedArgs(AttackType type, AttackArgs args) { Type = type; Args = args; }
public override void OnNotify(AttackArgs param) { damageable.TakeDamage(param.damage); }
public virtual void Execute(AttackArgs args, bool isEcho) { }