Example #1
0
        static void Main(string[] args)
        {
            try {
                //InfInt test1 = new InfInt("400");
                //InfInt test2 = new InfInt("1");
                // InfInt test3 = new InfInt("1453242414");
                Rational frac1 = new Rational(3, 18);
                Rational frac2 = new Rational(1, 7);
                //Console.WriteLine(frac1.ToString());
                Console.WriteLine(frac2.RationalToDecimal());
                Console.WriteLine($"subtract: {frac1 - frac2}");
                //Console.WriteLine($"multiply: {frac1 * frac2}");
                Console.WriteLine($"divide: {frac1 / frac2}");
                InfInt      test1    = new InfInt("40");
                InfInt      test2    = new InfInt("400");
                InfInt      test3    = new InfInt("1453242414");
                infRational bigfrac  = new infRational(test1, test2);
                infRational bigfrac2 = new infRational("23141", "312");
                infRational bigfrac3 = new infRational("23141", "312");
                Console.WriteLine($" Addition: {test1.Add(test2)}");
                //Console.WriteLine($" subtraction: {test2.Subtract(test1)}");
                //Console.WriteLine($"compareto: {test1.CompareTo(test2)}");
                //Console.WriteLine($" divide: {test1.Divide(test2)}");
                //Console.WriteLine($"multiply: {test1.Multiply(test2)}");

                Console.WriteLine($"{bigfrac}");
                Console.WriteLine($"{bigfrac2}");
                Console.WriteLine($"{bigfrac2.CompareTo(bigfrac3)}");
            }
            catch (DivideByZeroException e)
            {
                Console.WriteLine("Cannot Divide by zero");
            }
        }
Example #2
0
        public DotItem Create(DamageType damageType, float duration, InfInt dps)
        {
            DotItem item = Create();

            item.DamageType = damageType;
            item.Duration   = duration;
            item.DPS        = dps;
            return(item);
        }
Example #3
0
    public InfInt GetSavedZombiesHP()
    {
        InfInt hp = new InfInt();

        for (int i = 0; i < _zombies.Count; i++)
        {
            hp.Add(_zombies[i].HP);
        }
        return(hp);
    }
Example #4
0
    public ZombieManager(ZombieDiedSignal zombieDiedSignal, ZombiePool zombiePool,
                         ZombieFactory goFactory, GameConfig gameConfig, StartNewWaveSignal startNewWave,
                         WaveStartedSignal waveStarted, UpdateZombiesCountSignal onUpdateZombiesCountSignal,
                         NightManager nightManager, WindowsManager windowsManager, ZombieConfig zombieConfig,
                         TutorialManager tutorialManager, AnalyticsManager analyticsManager) : base("zombies.json")
    {
        _onZombieDiedSignal            = zombieDiedSignal;
        _onStartNewWaveSignal          = startNewWave;
        _onWaveStartedSignal           = waveStarted;
        _onUpdateZombiesCountSignal    = onUpdateZombiesCountSignal;
        _windowsManager                = windowsManager;
        _tutorialManager               = tutorialManager;
        _tutorialManager.ZombieManager = this;
        _analyticsManager              = analyticsManager;

        _zombiePool   = zombiePool;
        _GOfactory    = goFactory;
        _gameConfig   = gameConfig;
        _nightManager = nightManager;
        _zombieConfig = zombieConfig;

        _zombies = new List <Zombie>();
        _zombieCountBeforeBoss    = _gameConfig.waveSettings.startZombieCount;
        _currentZombieCount       = _zombieCountBeforeBoss;
        _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
        WaveNumber             = _gameConfig.waveSettings.startWave;
        _currentMainZombieType = ZombieType.Basic;
        _otherMainTypes        = new List <ZombieType>();
        _otherMainTypes.Add(ZombieType.Acid);
        _otherMainTypes.Add(ZombieType.Fire);
        _otherMainTypes.Add(ZombieType.Armor);
        _otherMainTypes.Add(ZombieType.Electro);

        _otherAddTypes = new List <ZombieType>();

        _hpPerZombie          = new InfInt();
        _currentDecadeStartHP = new InfInt(_gameConfig.waveSettings.firstWaveHP);
        _currentWaveHP        = new InfInt(_currentDecadeStartHP);

        _tempBigNumber = new InfInt();
        _tmpBigNumber  = new InfInt();

        _autoStartNewWave    = false;
        _waveStarted         = false;
        _timeTravelStartLock = false;
        _lastBossAlive       = false;
    }
Example #5
0
 public infRational(string input1, string input2)
 {   //explicit value constructor 2
     this.Numerator   = new InfInt(input1);
     this.Denominator = new InfInt(input2);
     if ((Numerator.CompareTo(new InfInt("0")) < 0) || Denominator.CompareTo(new InfInt("0")) < 0)     // if either numerator or denominator is negative
     {
         if ((Numerator.CompareTo(new InfInt("0")) < 0) && Denominator.CompareTo(new InfInt("0")) < 0) // if both are negative
         {
             Positive = true;
         }
         else
         {
             Positive = false;
         }
     }
     else
     {
         Positive = true;
     }
 }
Example #6
0
 public infRational(InfInt num, InfInt denom)
 {   //explicit value constructor 1
     this.Numerator   = num;
     this.Denominator = denom;
     if ((Numerator.CompareTo(new InfInt("0")) < 0) || Denominator.CompareTo(new InfInt("0")) < 0)     // if either numerator or denominator is negative
     {
         if ((Numerator.CompareTo(new InfInt("0")) < 0) && Denominator.CompareTo(new InfInt("0")) < 0) // if both are negative
         {
             Positive = true;
         }
         else
         {
             Positive = false;
         }
     }
     else
     {
         Positive = true;
     }
 }
Example #7
0
        public DamageInfo Create(Character character, int weaponIndex, Vector3 charPosition, InfInt damage, DamageType damageType, Vector3 targetPos, WeaponTag weaponTag, PhysicsType physics = PhysicsType.None, DotItem dot = null, DamageModifier modifier = DamageModifier.None, ZombieFX hitFx = ZombieFX.Unknown, ZombieFX dieFx = ZombieFX.Unknown)
        {
            DamageInfo info = Create();

            info.Character             = character;
            info.WeaponIndex           = weaponIndex;
            info.CharPosition          = charPosition;
            info.Damage                = new InfInt(damage);
            info.DamageType            = damageType;
            info.TargetPosition        = targetPos;
            info.ExplosionSphereRadius = 0.0f;
            info.Dot      = dot;
            info.Physics  = physics;
            info.Tags     = weaponTag;
            info.Modifier = modifier;
            info.HitFX    = hitFx;
            info.DieFX    = dieFx;
            return(info);
        }
Example #8
0
 public infRational()
 {   //Default Constructor
     Numerator   = new InfInt();
     Denominator = new InfInt();
     Positive    = true;
 }