Exemplo n.º 1
0
    public override void Apply(TowerProperties p, ShotProperties s)
    {
        PawnProperties props = p as PawnProperties;

        Debug.Log("Tower Properties: " + p.GetType() + " " + (props == null) + " " + this.name + " ShotProperties: " + s.GetType());
        effect(p as PawnProperties, s);
    }
Exemplo n.º 2
0
    protected override bool Attack()
    {
        PawnProperties p = (PawnProperties)TowerProperties;

        Retarget(TowerProperties.Range);
        if (!TargetSet)
        {
            return(false);
        }

        CurrentCooldown = TowerProperties.Cooldown;
        // Magic to make the gaining of attack speed to work.
        CurrentCooldown = p.IncreasingSpeedPerShot ? CurrentCooldown * (1f - p.AttackSpeedBonusMax * (0.01f * p.AttackSpeedBonusPercentOfMax)) : CurrentCooldown;

        float randomNumber     = UnityEngine.Random.Range(0, 1f);
        float doubleShotChance = p.DoubleShotChance;

        if (randomNumber < doubleShotChance)
        {
            DoubleShoot();
        }
        else
        {
            Shoot();
        }

        return(true);
    }
Exemplo n.º 3
0
    private void increaseAttackSpeedWithShot()
    {
        PawnProperties p = (PawnProperties)TowerProperties;

        if (p.IncreasingSpeedPerShot && p.AttackSpeedBonusPercentOfMax < 100)
        {
            p.AttackSpeedBonusPercentOfMax += 2;
        }
    }
Exemplo n.º 4
0
    public void RoundReset()
    {
        PawnProperties p = (PawnProperties)TowerProperties;

        p.AttackSpeedBonusPercentOfMax = 0;
    }