示例#1
0
    internal void Initialize(Projectile projectile)
    {
        Element[] projectileElements = projectile.elements.ToArray();
        damage              = ElementUtility.ProjectileDamage(projectileElements);
        bouncesLeft         = ElementUtility.Bounces(projectileElements);
        chainLength         = ElementUtility.ChainLength(projectileElements);
        speed               = ElementUtility.ProjectileSpeed(projectileElements);
        AOEDamageDealer     = new AOEDamageDealer(ElementUtility.AoE(projectileElements) * projectile.areaOfEffectMultiplier, transform, projectile.elements);
        primaryMovementType = ElementUtility.Movement(projectile.elements.Peek());
        this.projectile     = projectile;
        switch (primaryMovementType)
        {
        case ProjectileMovementType.BounceOnGround:
            Parabola[] parabolas = ParabolaCalculator.CalculateFullTrajectory(transform.position, projectile.target.position,
                                                                              ElementUtility.ProjectileSpeed(projectileElements), transform.position.y, 0, bouncesLeft);
            projectileMover = new ProjectileMover(transform, parabolas, ElementUtility.ProjectileSpeed(projectile.elements.ToArray()) * projectile.speedMultiplier);
            break;

        case ProjectileMovementType.StraightChain:
            projectileMover = new ProjectileMover(transform, projectile.target, ElementUtility.ProjectileSpeed(projectile.elements.ToArray()) * projectile.speedMultiplier);
            break;

        case ProjectileMovementType.AOEAtTower:
            projectileMover = new ProjectileMover(projectile.speedMultiplier * speed, 0, transform);
            OnAOEAtTowerActivation();
            break;
        }
    }
示例#2
0
 private void SetupTexts()
 {
     mainElement.text    = tower.elements.Peek().ToString();
     fireRate.text       = string.Format("{0}/s", ElementUtility.FireRate(elementsArray).ToString());
     fireRange.text      = ElementUtility.TowerRange(elementsArray).ToString();
     bounces.text        = ElementUtility.Bounces(elementsArray).ToString();
     chain.text          = ElementUtility.ChainLength(elementsArray).ToString();
     slow.text           = ElementUtility.Slow(elementsArray).ToString();
     aoe.text            = ElementUtility.AoE(elementsArray).ToString();
     damage.text         = ElementUtility.ProjectileDamage(elementsArray).ToString();
     sellButtonText.text = string.Format("Sell for: {0}", ElementUtility.SaleValue(elementsArray).ToString());
     ClearUpgradeTexts();
 }