Exemple #1
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        Hex pos = GameplayContext.Player.Position;

        //TODO: replace this with a line of sight check maybe?
        List <Entity> targets =
            GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range);

        //don't let the player shoot themselves
        targets.Remove(GameplayContext.Player);

        SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets);

        yield return(new WaitUntil(target.IsReadyOrCancelled));

        if (!target.WasCancelled())
        {
            Entity victim = target.GetResult();
            GameplayContext.Player.DealDamageTo(victim, baseDamage);
            GameplayContext.Player.TriggerAttackEvent(victim);

            FXHelper.FireTracerBetween(GameplayContext.Player, victim);
            FXHelper.PlaySound("rifleShot");
            FXHelper.PlaySound(victim.rangedHitSoundName, 0.1f);

            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #2
0
    public void Do(Entity with)
    {
        with.DealDamageTo(GameplayContext.Player, baseDamage);
        with.TriggerAttackEvent(GameplayContext.Player);

        FXHelper.FireTracerBetween(with, GameplayContext.Player);
        FXHelper.PlaySound(attackSound);
        FXHelper.PlaySound(GameplayContext.Player.rangedHitSoundName, 0.1f);

        //LeanTween.moveLocal(with.gameObject, GameplayContext.Player.transform.position, 0.1f)
        //.setEaseInCubic().setLoopPingPong(1);

        LeanTween.delayedCall(0.2f, () =>
        {
            OnActionFinish?.Invoke();
            OnActionFinish = null;
        });
    }