Example #1
0
 public void AddAttack(float time, AttackType type, AttackArgs args)
 {
     _attacks.Add(new TimelineAttack()
     {
         Time = time,
         Type = type,
         Args = args
     });
 }
Example #2
0
        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);
        }
Example #3
0
    private void HandleAttack(AttackArgs args)
    {
        var source = args.source;

        if (!source.hasEnergy)
        {
            source.AddEnergy(0);
        }

        source.ReplaceEnergy(source.stats.attackSpeed + source.energy.energyCost);
    }
Example #4
0
    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);
    }
Example #5
0
    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();
    }
Example #6
0
    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();
    }
Example #7
0
    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));
    }
Example #8
0
    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);
        }
    }
Example #9
0
    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);
    }
Example #10
0
    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);
    }
Example #11
0
 public override void OnNotify(AttackArgs param)
 {
     // TODO: Change hard coded number
     damageable.TakeDamage(Mathf.RoundToInt(param.damage * 0.5f));
     controller.SwitchState <NotDefendingCharacterState>();
 }
Example #12
0
 public AttackedArgs(AttackType type, AttackArgs args)
 {
     Type = type;
     Args = args;
 }
 public override void OnNotify(AttackArgs param)
 {
     damageable.TakeDamage(param.damage);
 }
Example #14
0
 public virtual void Execute(AttackArgs args, bool isEcho)
 {
 }