Beispiel #1
0
        public WaveSimulatorDamageStats SimulateDamageToEnemies(
            EnemyDescription enemy,
            WaveSolution solution,
            float HandMissileFreqency,
            float HandMissileDamantPctAverage,
            int enemyCount,
            bool invincible)
        {
            DamageStats       = new WaveSimulatorDamageStats();
            InvincibleEnemies = invincible;

            float waveTime  = 0.0F;
            float timeDelta = 1.0F / 72.0F;
            float previousHandMissileTime = 0.0f;

            EnemyWave waveDesc = new EnemyWave();

            waveDesc.Count = enemyCount;
            waveDesc.Enemy = enemy.Name;
            waveDesc.DifficultyMultiplier = 1.0F;

            ResetLevelDescState(LevelDesc);
            TurretManager     turrets     = new TurretManager(LevelDesc);
            ProjectileManager projectiles = new ProjectileManager(LevelDesc, LevelManager.LookupProjectile);
            WaveInstance      wave        = new WaveInstance(LevelDesc, waveDesc, enemy, 0.0F, SimulatorDamageCallback);

            for (int i = 0; i < solution.Turrets.Count; i++)
            {
                turrets.AddTurret(LevelManager.LookupTurret(solution.Turrets[i].Name), solution.Turrets[i].pos, projectiles);
            }

            Debug.Log("----------------------------------------");
            Debug.Log("   Wave of " + enemyCount + " " + enemy.Name + "s");
            Debug.Log("----------------------------------------");

            do
            {
                wave.Advance(waveTime);
                projectiles.AdvanceAll(waveTime);
                turrets.Fire(waveTime);

                float timeSinceLastHandMissile = waveTime - previousHandMissileTime;

                if (timeSinceLastHandMissile >= HandMissileFreqency)
                {
                    // Real projectiles have to incur flight time but we'll simulate
                    // the damage as instanntaneous to keep it simple.  Also real projectiles
                    // have blast radius that should hit multiple enemies. We'll just hit one.
                }

                waveTime += timeDelta;
            } while (!wave.IsCompleted);

            DamageStats.DamagePerEnemy = DamageStats.DamageDealt / enemyCount;

            return(DamageStats);
        }
Beispiel #2
0
    void TickGameplay()
    {
        Waves.CurrentWave.Advance(GameTime);
        Coin           += Waves.CurrentWave.ReportCoinEarned();
        LivesRemaining -= Waves.CurrentWave.ReportLivesLost();

        Projectiles.AdvanceAll(GameTime);

        Turrets.Fire(GameTime);

        if (Waves.IsComplete)
        {
            OnLevelComplete();
        }
        else if (Waves.CurrentWave.IsCompleted)
        {
            Utilities.Log("State ==> WaveCountdown");
            ShowCountdownUI();
            Waves.AdvanceToNextWave(GameTime);
            State = LevelState.WaveCountdown;
            CountdownStartTime = GameTime;
        }

        if (null != Pointer.Hitting)
        {
            GameObject go = Pointer.Hitting;
            if (go.name.StartsWith("TurretSpace"))
            {
                TurretInstance turret = Turrets.GetTurretAtPosition(GameObjectFactory.WorldVec3ToMapPos(go.transform.position));

                if (null != turret)
                {
                    go = turret.go;
                }
            }

            GameplayUI.CursorOver(go);
        }

        bool value = false;

        if (Pointer.State.ButtonDown.TryGetValue(InputState.InputIntent.Selection, out value) && value)
        {
            GameplayUI.TriggerSelectAction();
        }
        if (Pointer.State.ButtonDown.TryGetValue(InputState.InputIntent.MissileTrigger, out value) && value)
        {
            ProcessMissileTrigger();
        }


        UpdateHUD();
    }