Ejemplo n.º 1
0
        protected override void UpdateSubRoutine()
        {
            if (SubRoutineTimeRemaining > 0f)
            {
                SubRoutineTimeRemaining -= Time.deltaTime;
            }
            else
            {
                var chanceOfRetreatingRoutine = CRandom.Next(1, 4);
                SubRoutineTimeRemaining = CRandom.Nextf(MinRoutineTime, MaxRoutineTime);

                if (chanceOfRetreatingRoutine <= 1)
                {
                    CurrenMovementSubRoutineType = MovementSubRoutineType.MovingLeft;
                }
                else if (chanceOfRetreatingRoutine <= 2)
                {
                    CurrenMovementSubRoutineType = MovementSubRoutineType.MovingRight;
                }
                else
                {
                    CurrenMovementSubRoutineType = MovementSubRoutineType.MovingBackward;;
                }
            }
        }
 protected override void UpdateSubRoutine()
 {
     if (CurrentSightRoutineDelay > 0f)
     {
         CurrentSightRoutineDelay -= Time.deltaTime;
     }
     else if (CurrenSightSubRoutineType == SightSubRoutineType.LookForward)
     {
         var nextSightRoutine = CRandom.Next(1, 3);
         CurrenSightSubRoutineType =
             nextSightRoutine <= 1 ? SightSubRoutineType.LookLeft : SightSubRoutineType.LookRight;
     }
 }
Ejemplo n.º 3
0
        private void PlaySound(TypePickable weaponType)
        {
            switch (weaponType)
            {
            case TypePickable.Shotgun:
                shotgunShootSound.Play();
                break;

            case TypePickable.Uzi:
                uziShootSounds[CRandom.Next(0, 2)].Play();
                break;

            default:
                starterWeaponShootSounds[CRandom.Next(0, 3)].Play();
                break;
            }
        }
Ejemplo n.º 4
0
        public int CreateUser(string email, string username, string password)
        {
            int salt = rnd.Next(100000, 999999);

            password = HashAndSalt(password, salt);
            RowCollection rows = new RowCollection(new Row[]
            {
                new Row(new Cell[]
                {
                    new Cell(new Column("email", typeof(string)), email),
                    new Cell(new Column("password", typeof(string)), password),
                    new Cell(new Column("salt", typeof(int)), salt),
                    new Cell(new Column("username", typeof(string)), username)
                })
            });

            connection.Insert("user", rows);
            return(0);
        }
Ejemplo n.º 5
0
        public BalanceGA(PopulationManager <BalanceGA> Manager, List <double> root = null, CRandom rand = null)
        {
            UpdatedAtGeneration = -1;

            if (rand != null)
            {
                this.rand = new CRandom(rand.Next());
            }

            ReloadParameters(Manager);

            Vector = root;

            //Generate random one
            if (root == null)
            {
                Vector    = GenerateData();
                CreatedBy = "Random";
            }

            this.CreatedAtGeneration = Manager.GenerationsRun + 1;
        }