Пример #1
0
        private void SpawnVirus()
        {
            var direction = Quaternion.AngleAxis(CT.table.spawnVirusDirection.random, Vector3.forward) * Vector2.down;
            var pos       = new Vector2(Random.Range(VirusBase.baseRadius, UIUtil.width - VirusBase.baseRadius), UIUtil.height + VirusBase.baseRadius);

            var virusIndex = FormulaUtil.RandomIndexInProbArray(tableGameWave.virusProb);
            var virusTable = TableVirus.Get(tableGameWave.virus[virusIndex]);
            var virusType  = "DestroyViruses." + virusTable.type;
            var virus      = (VirusBase)EntityManager.Create(System.Type.GetType(virusType));

            var hpRange = new Vector2(tableGameLevel.hpRange.min, tableGameLevel.hpRange.max);
            var hp      = tableGameWave.virusHp[virusIndex].random * tableGameLevel.virusHpFactor * mHpFixFactor * CT.table.hpRandomRange.random;
            var speed   = tableGameWave.virusSpeed[virusIndex].random * tableGameLevel.virusSpeedFactor * mSpeedFixFactor * CT.table.speedRandomRange.random;
            var size    = tableGameWave.virusSize[virusIndex].random;

            virus.Reset(virusTable.id, hp, size, speed, pos, direction, hpRange, true);
        }