Ejemplo n.º 1
0
    public void SpawnSiegeMinion(Team team, HeroLocation lane)
    {
        switch (lane)
        {
        case HeroLocation.BOT_Lane:
            SetupMinion(Instantiate(siegeMinion, redPortal.LeftSpawn[Random.Range(0, 5)].
                                    position, faceUp), Path.SOUTH_PATH, Team.RED_TEAM);
            break;

        case HeroLocation.TOP_Lane:
            SetupMinion(Instantiate(siegeMinion, redPortal.RightSpawn[Random.Range(0, 5)].
                                    position, faceDown), Path.NORTH_PATH, Team.RED_TEAM);
            break;

        default:
            SetupMinion(Instantiate(siegeMinion, redPortal.MidSpawn[Random.Range(0, 5)].
                                    position, faceLeft), Path.CENTER_PATH, Team.RED_TEAM);
            return;
        }
    }
Ejemplo n.º 2
0
    private void Update()
    {
#if DEBUG
        m_spawnSiegeMinion = spawnSiegeMinion;
        m_reinforcements   = reinforcements;
        m_towerMovement    = towerMovement;
        m_selfRecover      = selfRecover;
        m_huntHero         = huntHero;
        m_upgradeSiege     = upgradeSiege;
        m_extraSiegeMinion = extraSiegeMinion;
        m_lastResort       = lastResort;
#endif
        if (!Hero.activeSelf)
        {
            lazer.autofire = false;
        }
        remainingHealth = redPortal.HP;
        dangerTreshold  = 90.0f - GameManager.Instance.Timer * 0.044444444f - redPortal.HP *
                          redPortal.InvMAXHP * 50.0f + (5 - towersRemaining) * 9.0f;
        lazer.SiegeProjectileDamage = portalInfo.Damage * towersRemaining;
        if (!LastResortActive)
        {
            switch (GetTriggered)
            {
            case DangerLevel.EXTREME:
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = towerMovement =
                    reinforcements = spawnSiegeMinion = selfRecover = true;
                siegeTime          = reinforcementsTime = 10.0f;
                selfRecoveryBase   = 30.0f;
                break;

            case DangerLevel.CRITICAL:
                extraSiegeMinion     = upgradeSiege = huntHero = towerMovement = reinforcements =
                    spawnSiegeMinion = selfRecover = true;
                lastResort           = false;
                reinforcementsTime   = 20.0f;
                siegeTime            = 15.0f;
                selfRecoveryBase     = 20.0f;
                break;

            case DangerLevel.HIGH:
                towerMovement      = reinforcements = spawnSiegeMinion = selfRecover = true;
                huntHero           = false;
                extraSiegeMinion   = upgradeSiege = true;
                lastResort         = false;
                reinforcementsTime = 40.0f;
                siegeTime          = 25.0f;
                selfRecoveryBase   = 15.0f;
                break;

            case DangerLevel.MODERATE:
                towerMovement      = reinforcements = spawnSiegeMinion = selfRecover = true;
                huntHero           = false;
                upgradeSiege       = true;
                lastResort         = extraSiegeMinion = false;
                reinforcementsTime = 60.0f;
                siegeTime          = 40.0f;
                selfRecoveryBase   = 10.0f;
                break;

            case DangerLevel.MEDIUM:
                selfRecover        = false;
                towerMovement      = reinforcements = spawnSiegeMinion = true;
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = false;
                reinforcementsTime = 80.0f;
                siegeTime          = 60.0f;
                break;

            case DangerLevel.LOW:
                selfRecover        = false;
                spawnSiegeMinion   = true;
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = towerMovement =
                    reinforcements = false;
                siegeTime          = reinforcementsTime = 80.0f;
                break;

            case DangerLevel.MINIMAL:
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = towerMovement =
                    reinforcements = spawnSiegeMinion = selfRecover = false;
                siegeTime          = reinforcementsTime = 80.0f;
                break;

            default:
                break;
            }
        }
        if (spawnSiegeMinion)
        {
            siegeTimer -= Time.deltaTime;
        }
        if (reinforcements)
        {
            reinforcementsTimer -= Time.deltaTime;
        }
        if (lastResort && lastResortTimer >= 15.0f)
        {
            LastResortActive = true;
        }
        if (redPortal.Alive && selfRecover)
        {
            redPortal.HP = remainingHealth + CalcSelfRecovery * Time.deltaTime;
            if (LastResortActive)
            {
                lrpPs.Play();
                lastResortTimer  -= Time.deltaTime;
                selfRecoveryBase *= 3.0f;
                redPortal.HP      = remainingHealth + CalcSelfRecovery * Time.deltaTime;
                if (lastResortTimer <= 0.0f)
                {
                    LastResortActive = false;
                }
            }
            else
            {
                lrpPs.Stop();
                lrpPs.Clear();
                lastResortTimer = System.Math.Min(20.0f, lastResortTimer + 0.6f * Time.deltaTime);
            }
        }
        if (spawnSiegeMinion && siegeTimer <= 0.0f)
        {
            SpawnSiegeMinion(Team.RED_TEAM, heroPresence);
            if (extraSiegeMinion)
            {
                SpawnSiegeMinion(Team.RED_TEAM, heroPresence);
            }
            siegeTimer = siegeTime;
        }
        if (reinforcements && reinforcementsTimer <= 0.0f)
        {
            SetupMinion(Instantiate(redCaster, redPortal.LeftSpawn[0].position, faceDown), Path
                        .SOUTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redStriker, redPortal.LeftSpawn[3].position, faceDown),
                        Path.SOUTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redTank, redPortal.LeftSpawn[1].position, faceDown), Path.
                        SOUTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redCaster, redPortal.MidSpawn[0].position, faceLeft), Path.
                        CENTER_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redStriker, redPortal.MidSpawn[4].position, faceLeft), Path
                        .CENTER_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redTank, redPortal.MidSpawn[2].position, faceLeft), Path.
                        CENTER_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redCaster, redPortal.RightSpawn[0].position, faceUp), Path.
                        NORTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redStriker, redPortal.RightSpawn[4].position, faceUp), Path
                        .NORTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redTank, redPortal.RightSpawn[2].position, faceUp), Path.
                        NORTH_PATH, Team.RED_TEAM);
            reinforcementsTimer = reinforcementsTime;
        }
        if (Vector3.Distance(Hero.transform.position, redPortal.transform.position) <= 210.0f)
        {
            heroPresence = HeroLocation.Close;
        }
        else if (Hero.transform.position.z > UpperSplit.transform.position.z)
        {
            heroPresence = HeroLocation.TOP_Lane;
        }
        else if (Hero.transform.position.z < LowerSplit.transform.position.z)
        {
            heroPresence = HeroLocation.BOT_Lane;
        }
        else
        {
            heroPresence = HeroLocation.MID_Lane;
        }
        redPortal.DmgDamp = 10.0f * towersRemaining;
    }