public PlayerStat(IBoardSize boardSize, IDifficulty difficulty)
 {
     BoardSize  = boardSize.Name;
     Difficulty = difficulty.Name;
     UID        = generateID();
     Time.Start();
 }
Beispiel #2
0
 public ZombieMaker(IDifficulty difficulty, Pause pause)
 {
     this.difficulty = difficulty;
     pause.Attach(this);
     this.Pause = pause;
     IsPaused   = pause.GetState();
     GameTime   = 1;
 }
Beispiel #3
0
        public void Initialize(ChromaTowerRenderer towerRenderer)
        {
            ChromaTower tower = towerRenderer.tower;

            difficulty = tower.difficulty;

            towerRenderer.OnBallColorUpdate += GetBallColor;
            tower.OnSuccessfulHit           += SuccessVignette;
            tower.OnNewGame += () => { Hide(true); };
            tower.OnDamage  += DamageFlash;
        }
Beispiel #4
0
 private void DiffucltyIncrease()
 {
     MonoBehaviour[] list = GameObject.FindObjectsOfType <MonoBehaviour>();
     foreach (MonoBehaviour mb in list)
     {
         if (mb is IDifficulty)
         {
             IDifficulty Difficulty = (IDifficulty)mb;
             Difficulty.IncreaseDifficulty();
         }
     }
 }
Beispiel #5
0
        private void InitializeGame()
        {
            Player player = new BasicPlayer(new Rectangle(100, 200, 30, 30), Color.Red);

            //set hats if any
            if (CheckBoxHat.Checked)
            {
                player = new PlayerHatDecorator(player);
            }
            if (CheckBoxSunGlasses.Checked)
            {
                player = new PlayerSunglassesDecorator(player);
            }

            IBackgroundBuilder      backgroundBuilder       = new BackgroundBuilder();
            BackgroundBuildDirector backgroundBuildDirector = new BackgroundBuildDirector(backgroundBuilder);

            //set the background
            if ((string)ComboBoxBackground.SelectedItem == "Ice")
            {
                backgroundBuildDirector.Construct(EStageStyle.ICE);
            }
            else if ((string)ComboBoxBackground.SelectedItem == "Desert")
            {
                backgroundBuildDirector.Construct(EStageStyle.DESERT);
            }
            else if ((string)ComboBoxBackground.SelectedItem == "Jungle")
            {
                backgroundBuildDirector.Construct(EStageStyle.JUNGLE);
            }
            Background background         = backgroundBuildDirector.GetBackground();
            string     difficultySelected = (string)ComboBoxLevel.SelectedItem;

            IDifficulty difficulty = null;

            //set the difficulty
            if (difficultySelected == "Easy")
            {
                difficulty = new EasyDifficulty();
            }
            else if (difficultySelected == "Hard")
            {
                difficulty = new HardDifficulty();
            }
            else if (difficultySelected == "Impossible")
            {
                difficulty = new ImposibleDifficulty();
            }

            Game = new Game(player, background, difficulty);
            Obstacle.XVelocity = 4.0f;
        }
Beispiel #6
0
        public ChromaTower(IScoreKeeper scoreKeeper, IPlayerState playerState, IDifficulty difficulty)
        {
            GameState = GameState.Idle;

            if (scoreKeeper == null || playerState == null || difficulty == null)
            {
                throw new Exception("Score Keeper, Player State or the Difficulty cannot be null.");
            }

            this.scoreKeeper = scoreKeeper;
            this.playerState = playerState;
            this.difficulty  = difficulty;
        }
Beispiel #7
0
        public Game(Player player, Background background, IDifficulty difficulty)
        {
            Player     = player;
            Background = background;

            ObstacleManager = new ObstacleManager();
            Difficulty      = difficulty;

            ObstacleManager.Timer = Difficulty.GetRespawnInterval(ObstacleManager.Timer);
            Observers             = new List <Observer>();
            Observer collissionObserver  = new CollisionObserver(this);
            Observer outOfBoundsObserver = new ObstacleOutOfBoundsObserver(this);

            IsGameOver = false;
        }
Beispiel #8
0
        private void PrepareEngine()
        {
            playerHealth = new PlayerHPStaticRate(maxHP: playerMaxHP,
                                                  damageRate: damageRate,
                                                  regenRate: regenRate);

            playerState = new PlayerState(playerHealth);
            scoreKeeper = new PlayerPrefScoreKeeper();
            difficulty  = new Difficulty(playerState: playerState,
                                         maxSlots: colorCount,
                                         introPlatforms: introPlatformCount,
                                         almostDeadLimit: nearDeathRatio);

            tower = new ChromaTower(scoreKeeper, playerState, difficulty);
        }
Beispiel #9
0
        public void HasAJsonConstructor()
        {
            // Arrange
            var id              = 2;
            var name            = "name";
            var displayName     = "displayName";
            var difficultyLevel = DifficultyLevel.TEST;

            // Act
            sut = new Difficulty(
                id,
                name,
                displayName,
                difficultyLevel);

            // Assert
            Assert.That(sut, Is.InstanceOf <Difficulty>());
        }
Beispiel #10
0
        public void SetOnlineNoteInformation(OnlineBeatmap onlineBeatmap, IDifficulty difficulty)
        {
            float secondEquivalentOfBeat = 60 / onlineBeatmap.Metadata.BeatsPerMinute;
            float minHalfJumpDuration    = 1f;
            float jumpSpeedThreshold     = 18f;
            float halfJumpDuration       = 4f;

            while (difficulty.NoteJumpMovementSpeed * secondEquivalentOfBeat * halfJumpDuration > jumpSpeedThreshold)
            {
                halfJumpDuration /= 2f;
            }

            halfJumpDuration += difficulty.NoteJumpStartBeatOffset;

            if (halfJumpDuration < minHalfJumpDuration)
            {
                halfJumpDuration = minHalfJumpDuration;
            }

            difficulty.HalfJumpDuration = halfJumpDuration;
            difficulty.JumpDistance     = difficulty.NoteJumpMovementSpeed * (secondEquivalentOfBeat * (halfJumpDuration * 2));
        }
 public MinesweeperGame(IBoardSize size, IDifficulty difficulty) : base(size, difficulty)
 {
 }
Beispiel #12
0
        /// <summary>
        /// This functions loads the content for the level.
        /// </summary>
        /// <param name="fileStream">stream used to load level from text file</param>
        /// <param name="difficulty">difficulty setting to create level in</param>
        /// <param name="gameplayTextures">gameplay textures (i.e. background/tiles)</param>
        /// <param name="playerTextures">player animation textures</param>
        /// <param name="playerSounds"> player sound effects</param>
        /// <param name="enemyTextures">enemy animation textures</param>
        public void LoadContent(
            Stream fileStream, 
            DifficultyType difficultyType, 
            Texture2D[] gameplayTextures,
            Texture2D[] playerTextures,
            SoundEffect[] playerSounds,
            Texture2D[] enemyTextures)
        {
            switch (difficultyType) //difficulty state switch
            {
                case DifficultyType.Easy:
                    difficulty = new Easy();
                    break;
                case DifficultyType.Medium:
                    difficulty = new Medium();
                    break;
                case DifficultyType.Hard:
                    difficulty = new Hard();
                    break;
            }

            this.winScore = difficulty.winScore;
            this.textureLimit = difficulty.textureLimit;
            this.difficultyType = difficultyType;

            timeCount = TimeSpan.FromMinutes(0.0); //set start time of game to zero

            this.backgroundTexture = gameplayTextures[0]; //load background texture

            //load the tile textures
            this.platformTexture = gameplayTextures[1];
            this.floorATexture = gameplayTextures[2];
            this.floorBTexture = gameplayTextures[3];
            this.floorEdgeLTexture = gameplayTextures[4];
            this.floorEdgeRTexture = gameplayTextures[5];
            LoadTiles(fileStream); //load the tile map

            player = new Player(playerStart);
            player.LoadContent(playerTextures, playerSounds);

            //create new enemy list (i.e. room for multiple enemies)
            enemies = new List<Enemy>();
            enemySpawn = 0;
            enemyIndex = 0;
            this.enemyTextures = enemyTextures;
            walkLeft = false;
            enemyKilled = playerSounds[2];
            LoadEnemy(); //load an initial enemy
        }
Beispiel #13
0
 public void Setup()
 {
     sut = new Difficulty();
 }
 private void InsaneRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     Difficulty = new InsaneDifficulty();
 }
 private void HardRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     Difficulty = new HardDifficulty();
 }
 private void NormalRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     Difficulty = new NormalDifficulty();
 }
 private void easyRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     Difficulty = new EasyDifficulty();
 }
Beispiel #18
0
 public DifficultyResult() : base()
 {
     Difficulty = new Difficulty();
 }
 private void Awake()
 {
     _spawn      = GetComponent <ISpawn>();
     _destroy    = GetComponent <IDestroy>();
     _difficulty = GetComponent <IDifficulty>();
 }
 public GameBoard(IBoardSize size, IDifficulty difficulty)
 {
     BoardSize  = size;
     Difficulty = difficulty;
 }
        public string Calculate(KeywordQuickSearch C, IDifficulty D)
        {
            int    bad     = 0;
            int    good    = 0;
            string overall = "EASY/MEDIUM/HARD";

            foreach (var v in C.Details.Videos)
            {
                if (v.ViewCount > D.AvgViewCount)
                {
                    bad += 10;
                }
                else
                {
                    good += 10;
                }

                if (DateTime.Now.Year - v.UploadedDate.Year > 1)
                {
                    bad += 5;
                }
                else
                {
                    good += 5;
                }

                if (v.Likes > D.AvgLikes)
                {
                    bad += 3;
                }
                else
                {
                    good += 3;
                }

                if (v.Dislikes > D.AvgDislikes)
                {
                    good += 3;
                }
                else
                {
                    bad += 3;
                }

                if (v.VideoDuration.TotalMinutes > 5)
                {
                    bad += 3;
                }
                else
                {
                    good += 3;
                }
            }

            double T = (double)((double)good / (double)bad);

            if (T <= 0.5)
            {
                overall = "HARD";
            }
            else if (T > 0.5 && T <= 1.5)
            {
                overall = "MEDIUM";
            }
            else
            {
                overall = "EASY";
            }

            return(overall);
        }