Inheritance: MonoBehaviour
Exemple #1
0
        public Field(Game game, int Level, Difficulty difficulty)
            : base(game)
        {
            therand = new Random(); // Good enough randomization for now?

            m_difficulty = difficulty;

            RandomField();

            m_below_field = new BlockColour[6, 2];

            for (int x = 0; x < 6; x++)
            {
                m_below_field[x, 0] = m_field[x, 0].Colour;
            }
            MakeBelowRow();
            MakeBelowRow();

            m_lift_phase = 0;
            m_cruiser_pos = new Point(2, 5);
            m_state = GameState.Main;
            m_counter = 60;
            m_level = Level;
            m_score = 0;
            m_fast_lifting = false;
            m_chain_length = 1;

            CalcLiftSpeed();
            CalcFlashFrames();
        }
Exemple #2
0
 public MainPage(Difficulty difficulty)
 {
     App.Current.MainWindow.WindowState = WindowState.Maximized;
     this.difficulty = difficulty;
     InitializeComponent();
     LayoutRoot.SizeChanged += LayoutRoot_SizeChanged;
 }
Exemple #3
0
 void OnHardClick(GameObject go)
 {
     
     dif = Difficulty.Hard;
     Debug.Log("OnHardClick  " + dif);
     SceneManager.LoadScene("Level");
 }
Exemple #4
0
 public Game(ref Player playerA,ref Player playerB,Difficulty difficulty,GameMode gameMode)
 {
     current_game = this;
     board = new PlayerType[3,3]{{PlayerType.NONE,PlayerType.NONE,PlayerType.NONE},
                                 {PlayerType.NONE,PlayerType.NONE,PlayerType.NONE},
                                 {PlayerType.NONE,PlayerType.NONE,PlayerType.NONE}};
     this.playerA = playerA;
     this.playerA.score = 0;
     this.playerB = playerB;
     this.difficulty = difficulty;
     this.game_mode = gameMode;
     if (game_mode == GameMode.SINGLE_PLAYER)
     {
         //playerA.name = "User";
         playerB.name = "Computer";
         playerA.moveAllowed = true;
         playerB.moveAllowed = false;
     }else if(game_mode == GameMode.MULTI_PLAYER_STANDALONE){
         //playerA.name = "Ball";
         playerB.name = "Cross";
         //playerA.moveAllowed = true;
         playerB.moveAllowed = false;
         this.difficulty = Difficulty.NONE;
     }
     else if (game_mode == GameMode.MULTI_PLAYER)
     {
         this.difficulty = Difficulty.NONE;
     }
     this.current_player = playerA;
     this.connected = false;
 }
Exemple #5
0
        public Stat(string id, int level, int str, int per, int end, int agi, int luck, int bigGuns, int energyWeapons, int explosives, int smallGuns, int unarmed, int melee, Difficulty diff)
        {
            this.ID = id;

            this.Strength = str;
            this.Perception = per;
            this.Endurance = end;
            this.Agility = agi;
            this.Luck = luck;

            this.HP = (15 + str + (2 * end)) + (level * (3 + (end / 2)));
            this.ActionPoints = 5 + ((agi / 2) + (end / 2));
            this.CriticalChance = luck;
            this.PoisonResistance = end * 5;
            this.RadiationResistance = end * 2;
            this.MeleeDamage = Math.Max(str - 5, 0);
            this.Sequence = per * 2;
            this.AC = agi;

            this.BigGuns = bigGuns;
            this.EnergyWeapons = energyWeapons;
            this.Explosives = explosives;
            this.SmallGuns = smallGuns;
            this.Unarmed = unarmed;
            this.Melee = melee;

            this.Diff = diff;
        }
        public ZombieMountain(Difficulty difficulty, Hero hero)
            : base(difficulty, hero)
        {
            if (difficulty == Difficulty.Easy)
            {
                this.initialHitPercentage = 70;
                this.fastReaction = (int)ReactionTime.Normal;
                this.averageReaction = (int)ReactionTime.Slow;
                this.slowReaction = (int)ReactionTime.UltraSlow;
            }
            else if (difficulty == Difficulty.Medium)
            {
                this.initialHitPercentage = 60;
                this.fastReaction = (int)ReactionTime.Fast;
                this.averageReaction = (int)ReactionTime.Normal;
                this.slowReaction = (int)ReactionTime.Slow;
            }
            else
            {
                this.initialHitPercentage = 45;
                this.fastReaction = (int)ReactionTime.UltraFast;
                this.averageReaction = (int)ReactionTime.Fast;
                this.slowReaction = (int)ReactionTime.Normal;
            }

            enemy = new Enemy(PlayerStats.Zombie, Armor.None, Weapon.None, Magic.StrongHit);
        }
Exemple #7
0
 public Stage(Difficulty timeDiff, Difficulty numProbsDiff, Difficulty distDiff)
 {
     this.NumberOfProblemsDifficulty = numProbsDiff;
     this.TimeDifficulty = timeDiff;
     this.DistractionsDifficulty = distDiff;
     PrepareStage();
 }
        /// <summary>
        /// Initializes gameplay phase
        /// </summary>
        /// <param name="difficulty">The chosen difficulty</param>
        /// <param name="buttons">The submitted placement of ships</param>
        /// <param name="name">The name of the player</param>
        public PlayGame(Difficulty difficulty, Button[] buttons, string name, Ship[] ships, MainWindow main)
        {
            InitializeComponent();

            this.main = main;
            // Set player name
            this.name = name.ToLower().Replace(' ', '_');

            // Set player and computer's ships
            shipsPlayer = ships;
            shipsComputer = new Ship[] {
                                        new Ship(ShipName.AIRCRAFT_CARRIER, 5),
                                        new Ship(ShipName.BATTLESHIP, 4),
                                        new Ship(ShipName.SUBMARINE, 3),
                                        new Ship(ShipName.CRUISER, 3),
                                        new Ship(ShipName.DESTROYER, 2)
            };

            // Set button field arrays
            buttonsPlayer = new Button[100];
            PlayerShips.Children.CopyTo(buttonsPlayer, 0);

            buttonsComputer = new Button[100];
            ComputerShips.Children.CopyTo(buttonsComputer, 0);

            common = new Common(ComputerShips, buttonsComputer);
            computerAI = new ComputerAI(this, difficulty);

            initializeGame(buttons);
        }
        private void AddEntries(Difficulty difficultyLevel)
        {
            int counter = 0;

            HighScoresTextBox.Text = "                 High Scores - " + difficultyLevel.ToString();
            HighScoresTextBox.Text += "\r\n";
            HighScoresTextBox.Text += "\r\n   #       Date & Time         Duration        Score";
            HighScoresTextBox.Text += "\r\n   ---------------------------------------------";

            if (m_highScores.ContainsKey(difficultyLevel))
            {
                List<HighScoreEntry> scoreEntries = m_highScores[difficultyLevel];

                scoreEntries.Sort(CompareHighScores);

                foreach (HighScoreEntry highScore in scoreEntries)
                {
                    counter++;
                    HighScoresTextBox.Text += string.Format("\r\n  {0,2}   {1}   {2}     {3,10}",
                                                            counter,
                                                            highScore.GameTime.ToString("dd-MMM-yyyy HH:mm"),
                                                            SiriusSudokuForm.GetTimeText(highScore.DurationSeconds),
                                                            highScore.FinalScore.ToString());
                }
            }

            for (; counter < 11; counter++)
            {
                HighScoresTextBox.Text += string.Format("\r\n  {0,2}", counter);
            }
        }
Exemple #10
0
 public EncodingGame(Difficulty _difficulty)
 {
     isCodeCracked = false;
     numTurns = 0;
     currPlayer = PlayerTurn.User;
     difficulty = _difficulty;
 }
 public computerAI(string name, bool isActive, ImageBrush computerImage, ImageBrush computerImageHover, Difficulty difficulty)
 {
     this._Name = name;
     this._ActivePlayer = isActive;
     this._Image = computerImage;
     this._ImageHover = computerImageHover;
     switch(difficulty)
     {
         case Difficulty.Beginner:
             this._MaxTreeDepth = 1;
             this._DifficultyLevel = Difficulty.Beginner;
             break;
         case Difficulty.Easy:
             this._MaxTreeDepth = 1;
             this._DifficultyLevel = Difficulty.Easy;
             break;
         case Difficulty.Medium:
             this._MaxTreeDepth = 2;
             this._DifficultyLevel = Difficulty.Medium;
             break;
         case Difficulty.Hard:
             this._MaxTreeDepth = 3;
             this._DifficultyLevel = Difficulty.Hard;
             break;
         default:
             this._MaxTreeDepth = 3;
             this._DifficultyLevel = Difficulty.Hard;
             break;
     }
 }
Exemple #12
0
 public Game(List<Player> players, Difficulty difficulty, Type type, MapProvider mapProvider)
 {
     m_players = players;
     m_difficulty = difficulty;
     m_type = type;
     m_mapProvider = mapProvider;
 }
 internal Option()
 {
     _Difficulty = Difficulty.Medium;
     _Player = StoneColor.White;
     _StartColor = StoneColor.Black;
     Changed = true;
 }
Exemple #14
0
        public static bool UseSkill(Skill skill, Entity entity, Difficulty difficulty)
        {
            int target = skill.Value + (int) difficulty
                + skill.ClassModifiers.Keys.Where(key => key == entity.Class).Sum(key => skill.ClassModifiers[key])
                + entity.SkillModifiers.Where(mod => mod.Modifying == skill.Name).Sum(mod => mod.Amount);

            switch(skill.PrimaryAttribute.ToLower())
            {
                case "strength":
                    target += Skill.AttributeModifier(entity.Strength);
                    break;
                case "dexterity":
                    target += Skill.AttributeModifier(entity.Dexterity);
                    break;
                case "cunning":
                    target += Skill.AttributeModifier(entity.Cunning);
                    break;
                case "willpower":
                    target += Skill.AttributeModifier(entity.Willpower);
                    break;
                case "magic":
                    target += Skill.AttributeModifier(entity.Magic);
                    break;
                case "constitution":
                    target += Skill.AttributeModifier(entity.Constitution);
                    break;
            }

            return RollDice(DiceType.D100) <= target;
        }
    public void ConstructRitual(int length, Difficulty difficulty)
    {
        reward = Reward.GetReward(length);

        ritual = new List<RitualKey>();

        List<KeyCodes> keyCodesPool = new List<KeyCodes>()
        {
            KeyCodes.A, KeyCodes.B, KeyCodes.X, KeyCodes.Y
        };

        if (difficulty == Difficulty.Medium)
        {
            keyCodesPool.AddRange(new KeyCodes[4]{ KeyCodes.Left, KeyCodes.Right, KeyCodes.Up, KeyCodes.Down });
        }

        if (difficulty == Difficulty.Hard)
        {
            keyCodesPool.AddRange(new KeyCodes[4] { KeyCodes.LT, KeyCodes.RT, KeyCodes.LB, KeyCodes.RB });
        }

        for (int i = 0; i < length; ++i)
        {
            RitualKey ritualKey = new RitualKey(keyCodesPool[Random.Range(0, keyCodesPool.Count)]);

            ritual.Add(ritualKey);
        }

        PostChangedEvent();
    }
        public DarkForestLevel(Difficulty difficulty, Hero hero)
            : base(difficulty, hero)
        {
            this.bitePower = (int)(enemy.PlayerStats.AttackPower * this.Hero.PlayerStats.CalculateDefencePercentage());
            this.agilityEffect = this.Hero.PlayerStats.CalculateAgilityPercentage();

            if (difficulty == Difficulty.Easy)
            {
                this.fastReaction = (int)ReactionTime.Normal * this.agilityEffect;
                this.averageReaction = (int)ReactionTime.Slow * this.agilityEffect;
                this.slowReaction = (int)ReactionTime.UltraSlow * this.agilityEffect;
            }
            else if (difficulty == Difficulty.Medium)
            {
                this.fastReaction = (int)ReactionTime.Fast * this.agilityEffect;
                this.averageReaction = (int)ReactionTime.Normal * this.agilityEffect;
                this.slowReaction = (int)ReactionTime.Slow * this.agilityEffect;
            }
            else
            {
                this.fastReaction = (int)ReactionTime.UltraFast * this.agilityEffect;
                this.averageReaction = (int)ReactionTime.Fast * this.agilityEffect;
                this.slowReaction = (int)ReactionTime.Normal * this.agilityEffect;
            }
        }
        public IGameBoard GeneratePuzzle(Difficulty difficulty)
        {
            var t = new DancingLinksEngine();
            var result = t.GenerateOne(0);

            return ConvertSudokuPuzzleToGameBoard(result, difficulty);
        }
Exemple #18
0
	void Start()
	{
		operatorFactory = new OperatorFactory();
		operators = new List<GameObject>();
		level = DifficultyMode.SelectedDifficulty;
		minNumOperators = 1;
		if (level == Difficulty.Easy)
		{
			maxNumOperators =1;
		}
		else if (level == Difficulty.Medium)
		{
			maxNumOperators = 2;
		}
		else if (level == Difficulty.Hard)
		{
			maxNumOperators = 3;
		}
		else if(level == Difficulty.Expert)
		{
			minNumOperators = 2;
			maxNumOperators = 4;
		}
		Debug.Log ("Difficutly = " + level);

		GetRandomEquation();
	}
        private IGameBoard ConvertSudokuPuzzleToGameBoard(SudokuPuzzle result, Difficulty difficulty)
        {
            var lines = result.StringRep.Split('\n');

            var mergedLines = string.Empty;
            foreach (var line in lines)
            {
                mergedLines += line;
            }

            var fields = new int[81];
            for (var i = 0; i < 81; i++)
            {
                if (mergedLines[i] == '.')
                {
                    fields[i] = 0;
                }
                else
                {
                    fields[i] = int.Parse(mergedLines[i].ToString());
                }
            }

            var gameBoard = new GameBoard(fields, difficulty);
            return gameBoard;
        }
Exemple #20
0
        public DecodingGame(Difficulty _difficulty)
        {
            initializeKeysMap();
            isCodeCracked = false;
            numTurns = 0;
            currPlayer = PlayerTurn.User;
            difficulty = _difficulty;

            numAlmost = 0;
            numExact = 0;

            codeImgSize = 20;
            feedbackImgSize = 10;

            Random random = new Random();

            code = new int[CODE_LENGTH];
            codeColorCounts = new int[codeColors.Length];
            for (int i = 0; i < CODE_LENGTH; i++)
            {
                code[i] = random.Next(codeColors.Length);
                codeColorCounts[code[i]]++;
            }

            playerGuess = new int[CODE_LENGTH];
            playerGuessColorCounts = new int[codeColors.Length];
            resetPlayerGuess();

            guesses = new List<Guess>();            
        }
 public ScoreDTO(int player_id, int score, Difficulty difficulty, GameMode game_mode)
 {
     this.player_id = player_id;
     this.score = score;
     this.difficulty = difficulty;
     this.game_mode = game_mode;
 }
 public MondaiResult(string mondaiId, DateTime startTime, TimeSpan duration, Difficulty difficulty)
 {
     _mondaiId = mondaiId;
     _startTime = startTime;
     _duration = duration;
     Difficulty = difficulty;
 }
 public static float damageDealtMultipler(Difficulty dif)
 {
     switch (dif) {
         case Difficulty.Easy: return 1.5f;
         default: return 1f;
     }
 }
	public Operator GetRandomOperator(Difficulty level)
	{
		List<Operator> operators = GetOperators(level); 
		Operator randomOp = operators[Random.Range(0, operators.Count)]; //random Operator

		return randomOp;
	}
        public WinningScreen(Texture2D background, Texture2D buttonTex, SpriteFont font, Color color, Difficulty difficulty,Texture2D control, Player player, bool superShipWasAvailable, bool superShipAvailable, TimeSpan TotalTime, Rectangle window, SoundBank soundBack)
            : base(background, WallpaperType.Streched, buttonTex, font, window, soundBack)
        {
            this.playerTex = player.GetTexture;
            this.control = control;

            this.AddButton("Play Again", color, new Vector2(buttonTex.Width / 2f + buttonTex.Height / 3f, window.Height - buttonTex.Height / 3f));
            this.AddButton("Exit", color, new Vector2(buttonTex.Width * 2f + buttonTex.Height / 3f, window.Height - buttonTex.Height / 3f));

            this.AddLabel("Well Done! You have finished the game!", new Vector2(50));

            float w = window.Width / 2f-150;
            float h = window.Height / 14f;
            float t = 100;

            this.AddLabel("Bullets fired : " + player.GetBulletsFired,new Vector2(w,h+t));
            this.AddLabel("      Accuracy: " + player.GetBulletsAccuracy + "%", new Vector2(w, h * 2 + t));
            this.AddLabel("Missiles fired: " + player.GetMissilesFired, new Vector2(w, h * 3 + t));
            this.AddLabel("      Accuracy: " + player.GetMissilesAccuracy + "%", new Vector2(w, h * 4 + t));
            this.AddLabel("Total Accuracy: " + player.GetTotalAccuracy + "%", new Vector2(w, h * 5 + t));
            this.AddLabel("MidKits Used  : " + player.GetMidkitsUsed, new Vector2(w, h * 6 + t));
            this.AddLabel("Player Score  : " + player.GetPlayerScore , new Vector2(w, h * 7 + t));
            this.AddLabel("Time played     " + TotalTime.Hours +":" + TotalTime.Minutes + ":" + TotalTime.Seconds , new Vector2(w, h * 8 + t));

            this.AddAnimation( new Animation(playerTex, new Point(4, 1),new Vector2(100,window.Height/2f),20,true,font,difficulty.ToString(),window));
            this.AddAnimation( new Animation(control,new Point(1,3),new Vector2(150,window.Height/2f+100),700,false,font,"",window));

            if (superShipAvailable && !superShipWasAvailable)
                this.AddLabel("*Congratulations!! You've unlocked a new ship,The ultimate ship.", new Vector2(100, h * 9f + t));
        }
Exemple #26
0
        // TODO: Refactor constructors
        public Level(string directory)
        {
            Difficulty = Difficulty.Normal;
            Name = "world";
            LevelDirectory = directory;
            if (!Directory.Exists(LevelDirectory))
                Directory.CreateDirectory(LevelDirectory);
            // Load from level.dat
            if (!File.Exists(Path.Combine(LevelDirectory, "level.dat")))
            {
                WorldGenerator = DefaultGenerator;
                WorldGenerator.Initialize(this);
                SpawnPoint = WorldGenerator.SpawnPoint;
                World = new World(this, WorldGenerator, Path.Combine(directory, "region"));

                SaveInterval = TimeSpan.FromSeconds(5);
                saveTimer = new Timer(Save, null, (int)SaveInterval.TotalMilliseconds, Timeout.Infinite);
                tickTimer = new Timer(Tick, null, TickLength, TickLength);
                return;
            }

            LoadFromFile(directory);

            // Move spawn point
            var chunk = World.GetChunk(World.WorldToChunkCoordinates(SpawnPoint));
            var relativeSpawn = World.FindBlockPosition(SpawnPoint);
            SpawnPoint = new Vector3(SpawnPoint.X, chunk.GetHeight((byte)relativeSpawn.X, (byte)relativeSpawn.Z), SpawnPoint.Z);

            SaveInterval = TimeSpan.FromSeconds(5);
            saveTimer = new Timer(Save, null, (int)SaveInterval.TotalMilliseconds, Timeout.Infinite);
            tickTimer = new Timer(Tick, null, TickLength, TickLength);
        }
 public ValidLevels(int _level, Difficulty _difficulty, int _seed, bool _isFallToRed, bool _isOneClick, bool _isCantTouch, bool _isNoLines)
 {
     level = _level;
     difficulty = _difficulty;
     seed = _seed;
     SetOnlySpecialAttributes(_isFallToRed, _isOneClick, _isCantTouch, _isNoLines);
 }
        public Screen LaunchGameScreen(GameType type, Difficulty diff)
        {
            if (type == GameType.Classic)
                return new Screens.ClassicGameScreen(diff);

            else
                return new Screens.QuadrantGameScreen( Screens.QuadrantExcercises.NumbersOne);
        }
Exemple #29
0
 /// This constructs a squiggly generator class.
 public SquigglyGenerator(int[,] solution, int[,] scheme,Difficulty difficultyIn)
 {
     this.scheme = scheme;
     this.SolutionGrid = new SquigglyGrid();
     this.SolutionGrid.Grid = solution;
     squigglySolver = new SquigglySolver(scheme);
     difficulty = difficultyIn;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public PauseMenuScreen(GameType currentGameType, Difficulty currentDifficulty)
     : base("Paused", Color.RoyalBlue)
 {
     IsPopup = true;
     KinectDependencies.Add(KinectDependency.Skeleton);
     gameType = currentGameType;
     gameDiff = currentDifficulty;
 }
Exemple #31
0
        internal override void WriteWPTDetails(XmlWriter writer, GPXWriter gpx)
        {
            base.WriteWPTDetails(writer, gpx);
            if (!gpx.IncludeGroundSpeakExtensions)
            {
                return;
            }
            writer.WriteStartElement(CACHE_PREFIX, "cache", GPXWriter.NS_CACHE);
            if (String.IsNullOrEmpty(CacheID))
            {
                writer.WriteAttributeString("id", gpx.GetNextGUID().ToString());
            }
            else
            {
                writer.WriteAttributeString("id", CacheID);
            }
            writer.WriteAttributeString("available", Available.ToString());
            writer.WriteAttributeString("archived", Archived.ToString());
            // Temp until smart-tag like support
            if (HasCorrected)
            {
                writer.WriteElementString(CACHE_PREFIX, "name", GPXWriter.NS_CACHE, "(*) " + CacheName);
            }
            else
            {
                writer.WriteElementString(CACHE_PREFIX, "name", GPXWriter.NS_CACHE, CacheName);
            }
            writer.WriteElementString(CACHE_PREFIX, "placed_by", GPXWriter.NS_CACHE, PlacedBy);
            writer.WriteStartElement(CACHE_PREFIX, "owner", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("id", OwnerID);
            writer.WriteString(CacheOwner);
            writer.WriteEndElement();
            writer.WriteElementString(CACHE_PREFIX, "type", GPXWriter.NS_CACHE, GetCTypeString(TypeOfCache));
            writer.WriteElementString(CACHE_PREFIX, "container", GPXWriter.NS_CACHE, Container);
            List <CacheAttribute> attrs = gpx.GetAttributes(this.Name);

            writer.WriteStartElement(CACHE_PREFIX, "attributes", GPXWriter.NS_CACHE);
            foreach (CacheAttribute curr in attrs)
            {
                writer.WriteStartElement(CACHE_PREFIX, "attribute", GPXWriter.NS_CACHE);
                if (!String.IsNullOrEmpty(curr.ID))
                {
                    writer.WriteAttributeString("id", curr.ID);
                }
                if (curr.Include)
                {
                    writer.WriteAttributeString("inc", "1");
                }
                else
                {
                    writer.WriteAttributeString("inc", "0");
                }
                writer.WriteString(curr.AttrValue);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteElementString(CACHE_PREFIX, "difficulty", GPXWriter.NS_CACHE, Difficulty.ToString("0.#", CultureInfo.InvariantCulture));
            writer.WriteElementString(CACHE_PREFIX, "terrain", GPXWriter.NS_CACHE, Terrain.ToString("0.#", CultureInfo.InvariantCulture));
            writer.WriteElementString(CACHE_PREFIX, "country", GPXWriter.NS_CACHE, Country);
            writer.WriteElementString(CACHE_PREFIX, "state", GPXWriter.NS_CACHE, State);
            StringBuilder shortDescription = new StringBuilder();

            if (HasCorrected)
            {
                shortDescription.Append(Catalog.GetString("Original Coordinate:"));
                shortDescription.Append(Utilities.getCoordString(OrigLat, OrigLon));
                shortDescription.Append("<br/>");
            }
            if (gpx.WriteAttributes)
            {
                attrs = gpx.GetAttributes(this.Name);
                foreach (CacheAttribute curr in attrs)
                {
                    if (curr.Include)
                    {
                        shortDescription.Append(Catalog.GetString("Y:"));
                    }
                    else
                    {
                        shortDescription.Append(Catalog.GetString("N:"));
                    }
                    shortDescription.Append(curr.AttrValue);
                    shortDescription.Append("<br/>");
                }
                if (attrs.Count > 0)
                {
                    shortDescription.Append("<hr noshade/>");
                }
            }
            if (!String.IsNullOrEmpty(Notes))
            {
                shortDescription.Append(Notes);
                shortDescription.Append("<hr noshade/>");
            }
            shortDescription.Append(ShortDesc);
            writer.WriteStartElement(CACHE_PREFIX, "short_description", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("html", "True");
            if (gpx.HTMLOutput == HTMLMode.GARMIN)
            {
                writer.WriteCData(Utilities.HTMLtoGarmin(shortDescription.ToString()));
            }
            else if (gpx.HTMLOutput == HTMLMode.PLAINTEXT)
            {
                writer.WriteCData(Utilities.HTMLtoText(shortDescription.ToString()));
            }
            else
            {
                writer.WriteCData(shortDescription.ToString());
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "long_description", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("html", "True");
            if (gpx.HTMLOutput == HTMLMode.GARMIN)
            {
                writer.WriteCData(Utilities.HTMLtoGarmin(LongDesc));
            }
            else if (gpx.HTMLOutput == HTMLMode.PLAINTEXT)
            {
                writer.WriteCData(Utilities.HTMLtoText(LongDesc));
            }
            else
            {
                writer.WriteCData(LongDesc);
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "encoded_hints", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("html", "True");
            if (gpx.HTMLOutput == HTMLMode.GARMIN || gpx.HTMLOutput == HTMLMode.PLAINTEXT)
            {
                writer.WriteCData(Utilities.HTMLtoText(Hint));
            }
            else
            {
                writer.WriteCData(Hint);
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "logs", GPXWriter.NS_CACHE);
            if (gpx.IsMyFinds)
            {
                CacheLog log = gpx.CacheStore.GetLastFindLogBy(this.Name, gpx.MyFindsOwner);
                if (log.LogStatus == "find")
                {
                    log.LogStatus = "Found it";
                }
                log.WriteToGPX(writer);
            }
            else
            {
                List <CacheLog> logs   = gpx.GetCacheLogs(this.Name);
                int             iCount = 0;
                foreach (CacheLog log in logs)
                {
                    if ((iCount >= gpx.LogLimit) && (gpx.LogLimit != -1))
                    {
                        break;
                    }
                    else
                    {
                        log.WriteToGPX(writer);
                    }
                    iCount++;
                }
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "travelbugs", GPXWriter.NS_CACHE);
            List <TravelBug> bugs = gpx.GetTravelBugs(this.Name);

            foreach (TravelBug bug in bugs)
            {
                bug.WriteToGPX(writer);
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
Exemple #32
0
        private void GenerateFromDropList(
            Race race,
            DropManager dropManager,
            int lootLevel,
            Workshop lootWorkshop,
            Difficulty difficulty,
            ConcurrentDictionary <string, ServerInventoryItem> newObjects,
            float remapWeight,
            ItemDropList dropList,
            int playerLevel,
            int groupCount)
        {
            foreach (var dropItem in dropList.items)
            {
                int count;
                if (dropItem.Roll(out count, groupCount, playerLevel))
                {
                    if (count > 0)
                    {
                        switch (dropItem.type)
                        {
                        case InventoryObjectType.Weapon: {
                            for (int i = 0; i < count; i++)
                            {
                                GenerateWeapon(dropManager, lootLevel, lootWorkshop, difficulty, newObjects, remapWeight);
                            }
                        }
                        break;

                        case InventoryObjectType.Scheme: {
                            for (int i = 0; i < count; i++)
                            {
                                GenerateScheme(dropManager, lootLevel, lootWorkshop, difficulty, newObjects, remapWeight);
                            }
                        }
                        break;

                        case InventoryObjectType.Material: {
                            var matDropItem = dropItem as MaterialDropItem;
                            if (matDropItem != null)
                            {
                                GenerateMaterials(matDropItem.templateId, count, newObjects);
                            }
                        }
                        break;

                        case InventoryObjectType.nebula_element: {
                            var nebElemDropItem = dropItem as NebulaElementDropItem;
                            if (nebElemDropItem != null)
                            {
                                GenerateNebulaElements(nebElemDropItem.templateId, count, newObjects);
                            }
                        }
                        break;

                        case InventoryObjectType.craft_resource: {
                            var craftResourceDropItem = dropItem as CraftResourceDropItem;
                            if (craftResourceDropItem != null)
                            {
                                GenerateCraftResource(craftResourceDropItem.templateId, count, newObjects);
                            }
                        }
                        break;

                        case InventoryObjectType.pet_scheme: {
                            var petSchemeDropItem = dropItem as PetSchemeDropItem;
                            if (petSchemeDropItem != null)
                            {
                                GeneratePetScheme(race, petSchemeDropItem.template, petSchemeDropItem.petColor, count, newObjects);
                            }
                        }
                        break;

                        case InventoryObjectType.contract_item: {
                            var contractDropItem = dropItem as ContractObjectDropItem;
                            if (contractDropItem != null)
                            {
                                GenerateContractItemObject(contractDropItem.templateId, contractDropItem.contractId, count, newObjects);
                            }
                        }
                        break;

                        case InventoryObjectType.planet_resource_hangar: {
                            var hangarDropItem = dropItem as PlanetHangarDropItem;
                            if (hangarDropItem != null && count > 0)
                            {
                                GeneratePlanetHangarScheme(count, newObjects);
                            }
                        }
                        break;

                        case InventoryObjectType.planet_resource_accelerator: {
                            var accDropItem = dropItem as PlanetResourceAcceleratorDropItem;
                            if (accDropItem != null && count > 0)
                            {
                                GeneratePlanetResourceAcceleratorScheme(count, newObjects);
                            }
                        }
                        break;
                        }
                    }
                }
            }
        }
Exemple #33
0
 private void GenerateWeapons(DropManager dropManager, int lootLevel, Workshop lootWorkshop, Difficulty d, ConcurrentDictionary <string, ServerInventoryItem> newObjects, float remapWeight)
 {
     for (int i = 0; i < ChestUtils.NumOfWeapons(d); i++)
     {
         ObjectColor color = resource.ColorRes.GenColor(ColoredObjectType.Weapon).color;
         WeaponDropper.WeaponDropParams weaponParams = new WeaponDropper.WeaponDropParams(resource, lootLevel, lootWorkshop, WeaponDamageType.damage, Difficulty.none);
         var weaponDropper             = dropManager.GetWeaponDropper(weaponParams, remapWeight);
         IInventoryObject weaponObject = weaponDropper.Drop() as IInventoryObject;
         newObjects.TryAdd(weaponObject.Id, new ServerInventoryItem(weaponObject, 1));
         //log.InfoFormat("weapon of level = {0} generated", weaponObject.Level);
     }
 }
Exemple #34
0
 public Difficulties(Difficulty difficultyP1, Difficulty difficultyP2)
 {
     this.difficultyP1 = difficultyP1;
     this.difficultyP2 = difficultyP2;
 }
 //設定難度
 protected override void SetStageDifficulty(Difficulty difficulty)
 {
     difficulty = (MoveParameter)difficulty;
 }
Exemple #36
0
        static void Main(string[] args)
        {
            map[19, 19] = 1;
            int haveInput = 0;

            // choose difficulty level
            Console.WriteLine("Choose difficulty (Easy, Medium or Hard)");
            string d = Console.ReadLine().ToLower();                     // toLower just in case

            Console.Clear();                                             // Remove the Choose difficulty text
            Difficulty difficult = new Difficulty();

            switch (d)
            {
            case "easy": difficult = Difficulty.Easy; break;

            case "medium": difficult = Difficulty.Medium; break;

            case "hard": difficult = Difficulty.Hard; break;
            }

            if (difficult == Difficulty.Easy)
            {
                timer = 100 * 2;
            }
            else if (difficult == Difficulty.Medium)
            {
                timer = 70 * 2;
            }
            else if (difficult == Difficulty.Hard)
            {
                timer = 50;
            }
            drawMap(map, buildings, true);
            while (!lose)
            {
                Thread.Sleep(timer);
                if (Console.KeyAvailable)
                {
                    keyInfo = Console.ReadKey();

                    if (Convert.ToString(keyInfo.Key) == "Enter")
                    {
                        Console.Clear();
                        Console.WriteLine("What kind of building you want to build?");
                        Console.WriteLine("e) Electricity factory                  ");
                        Console.WriteLine("f) Food factory                         ");
                        Console.WriteLine("w) Water factory                        ");
                        Console.WriteLine("h) Hospital                             ");
                        Console.WriteLine("r) Residence                            ");
                        Console.WriteLine("s) Security                             ");
                        Console.WriteLine("Write only letter a, b, c, d, e or f    ");
                        string   letter   = Console.ReadLine();
                        Position position = new Position();

                        position.x = cursorX;
                        position.y = cursorY;

                        switch (letter)
                        {
                        case "e": buildings[countOfBuildings] = new ElectricityFactory('E', position, Color.Blue, ref electricity); break;

                        case "f": buildings[countOfBuildings] = new FoodFactory('F', position, Color.Gray, ref electricity, ref food); break;

                        case "w": buildings[countOfBuildings] = new WaterFactory('W', position, Color.Green, ref electricity, ref water); break;

                        case "h": buildings[countOfBuildings] = new HospitalBuilding('H', position, Color.Pink, 1, ref health, ref electricity); break;

                        case "r": buildings[countOfBuildings] = new ResidenceBuilding('R', position, Color.Yellow, 1, ref security, ref health, ref electricity, ref food, ref water, ref money); residenceBuildingsCount++; break;

                        case "s": buildings[countOfBuildings] = new SecurityBuilding('S', position, Color.Red, 1, ref security, ref electricity); break;
                        }
                        countOfBuildings++;
                        drawMap(map, buildings, true);
                    }
                    if (Convert.ToString(keyInfo.Key) == "LeftArrow")
                    {
                        cursorX--;
                    }
                    if (Convert.ToString(keyInfo.Key) == "RightArrow")
                    {
                        cursorX++;
                    }
                    if (Convert.ToString(keyInfo.Key) == "UpArrow")
                    {
                        cursorY--;
                    }
                    if (Convert.ToString(keyInfo.Key) == "DownArrow")
                    {
                        cursorY++;
                    }
                    if (cursorX < 0)
                    {
                        cursorX = 0;
                    }
                    if (cursorX >= Map_Size_X)
                    {
                        cursorX = Map_Size_X - 1;
                    }
                    if (cursorY < 0)
                    {
                        cursorY = 0;
                    }
                    if (cursorY >= Map_Size_Y)
                    {
                        cursorY = Map_Size_Y - 1;
                    }

                    Console.Clear();
                    keyInfo = new ConsoleKeyInfo();
                    EnemyMove(ref map, ref buildings, sizeOfEnemy);
                    sizeOfEnemy++;
                    drawMap(map, buildings, true);
                    Console.SetCursorPosition(0, 20);
                    Console.WriteLine("Electricity: {0} Food: {1} Water: {2} Happiness: {3} \nHealth: {4} Money: {5} Population: {6} Security: {7}",
                                      electricity.Amount, food.Amount, water.Amount, happiness.Amount, health.Amount, money.Amount, population.Amount, security.Amount);
                    Console.WriteLine("Use up, down, left and right arrow keys to choose your position to build!");
                    Console.WriteLine("Press enter to choose a building!");

                    Console.SetCursorPosition(cursorX, cursorY);
                    Console.WriteLine("X");
                    haveInput = 1;
                }
                else
                {
                    drawMap(map, buildings, false);
                    Console.SetCursorPosition(0, 20);
                    Console.WriteLine("Electricity: {0} Food: {1} Water: {2} Happiness: {3} \nHealth: {4} Money: {5} Population: {6} Security: {7}",
                                      electricity.Amount, food.Amount, water.Amount, happiness.Amount, health.Amount, money.Amount, population.Amount, security.Amount);
                    Console.WriteLine("Use up, down, left and right arrow keys to choose your position to build!");
                    Console.WriteLine("Press enter to choose a building!");
                    Console.SetCursorPosition(cursorX, cursorY);
                    Console.WriteLine("X");
                }
            }
        }
Exemple #37
0
 public QuestionGenerator(AgeGroup ageGroup, Difficulty difficulty)
 {
     this.ageGroup   = ageGroup;
     this.difficulty = difficulty;
     this.random     = new Random();
 }
 public void UpdatePlayerDifficulty(string difficultySelected)
 {
     playerData.difficultySelected = difficultySelected;
     SavePlayerData();
     currentDifficulty = DetermineDifficulty();
 }
        public void SetLevelInspector(string musicName, string musicArtist, Sprite _icon, Difficulty difficulty)
        {
            currentPanel        = PanelType.LevelInspector;
            MusicNameText.text  = musicName;
            ArtistNameText.text = "by " + musicArtist;
            iconImage.sprite    = _icon;
            switch (difficulty)
            {
            case Difficulty.Easy:
                DifficultyText.text = "Difficulty: [ <color=lime>" + difficulty.ToString() + "</color> ]";
                break;

            case Difficulty.Medium:
                DifficultyText.text = "Difficulty: [ <color=yellow>" + difficulty.ToString() + "</color> ]";
                break;

            case Difficulty.Hard:
                DifficultyText.text = "Difficulty: [ <color=red>" + difficulty.ToString() + "</color> ]";
                break;

            case Difficulty.Insane:
                DifficultyText.text = "Difficulty: [ <color=magenta>" + difficulty.ToString() + "</color> ]";
                break;

            case Difficulty.Impossible:
                DifficultyText.text = "Difficulty: [ <color=black>" + difficulty.ToString() + "</color> ]";
                break;
            }
        }
 void Start()
 {
     speed = Mathf.Lerp(speedMinMax.x, speedMinMax.y, Difficulty.GetDifficultyPercent());
     visibleHeightThreshold = -Camera.main.orthographicSize - transform.localScale.y;
 }
Exemple #41
0
 public Training(string title, string description, int duration, TrainingType type, Difficulty difficulty, string link)
 {
     Title       = title;
     Description = description;
     Duration    = duration;
     Type        = type;
     Difficulty  = difficulty;
     Link        = link;
     Rates       = new List <int>();
 }
 private void pushDifficulty(Difficulty difficulty)
 {
     this.currentDifficulty = difficulty;
     EventBus <DifficultyChangedEvent> .getInstance().publish(new DifficultyChangedEvent(difficulty));
 }
 private void SetNewGapTime()
 {
     gapTime = Mathf.Lerp(gapTimeMinMax[1], gapTimeMinMax[0], Difficulty.GetDifficultyPercent())
               + Random.Range(-1, 1) * gapTimeVariability;
 }
Exemple #44
0
    // Override
    #region Override

    #endregion

    // Public
    #region Public

    public abstract void SetProperties(Difficulty difficulty = Difficulty.Easy, float?animationTime = null, int?numberAnswers = null);
Exemple #45
0
    public async UniTask Initialize(bool startAutomatically = true)
    {
        ObjectPool = new ObjectPool(this);

        // Decide game mode
        var mode = Context.SelectedGameMode;

        if (mode == GameMode.Unspecified)
        {
            if (EditorGameMode != GameMode.Unspecified)
            {
                mode = EditorGameMode;
            }
            else
            {
                throw new Exception("Game mode not specified");
            }
        }

        if (mode == GameMode.Tier)
        {
            var tierState = Context.TierState;
            if (tierState == null)
            {
                await Context.LevelManager.LoadLevelsOfType(LevelType.Tier);

                tierState         = new TierState(MockData.Season.tiers[0]);
                Context.TierState = tierState;
            }

            if (tierState.IsFailed || tierState.IsCompleted)
            {
                // Reset tier state
                tierState         = new TierState(tierState.Tier);
                Context.TierState = tierState;
            }

            tierState.CurrentStageIndex++;

            Level      = tierState.Tier.Meta.stages[Context.TierState.CurrentStageIndex].ToLevel(LevelType.Tier);
            Difficulty = Difficulty.Parse(Level.Meta.charts.Last().type);
        }
        else if (mode == GameMode.GlobalCalibration)
        {
            // Load global calibration level
            Level = await Context.LevelManager.LoadOrInstallBuiltInLevel(BuiltInData.GlobalCalibrationModeLevelId,
                                                                         LevelType.Temp);

            Difficulty = Level.Meta.GetEasiestDifficulty();

            // Initialize global calibrator
            globalCalibrator = new GlobalCalibrator(this);
        }
        else
        {
            if (Context.SelectedLevel == null && Application.isEditor)
            {
                // Load test level
                await Context.LevelManager.LoadFromMetadataFiles(LevelType.User, new List <string>
                {
                    $"{Context.UserDataPath}/{EditorDefaultLevelDirectory}/level.json"
                });

                Context.SelectedLevel      = Context.LevelManager.LoadedLocalLevels.Values.First();
                Context.SelectedDifficulty = Context.SelectedLevel.Meta.GetHardestDifficulty();
            }

            Level      = Context.SelectedLevel;
            Difficulty = Context.SelectedDifficulty;
        }

        onGameReadyToLoad.Invoke(this);

        await Resources.UnloadUnusedAssets();

        // Load chart
        print("Loading chart");
        var    chartMeta = Level.Meta.GetChartSection(Difficulty.Id);
        var    chartPath = "file://" + Level.Path + chartMeta.path;
        string chartText;

        using (var request = UnityWebRequest.Get(chartPath))
        {
            await request.SendWebRequest();

            if (request.isNetworkError || request.isHttpError)
            {
                Debug.LogError(request.error);
                throw new Exception($"Failed to download chart from {chartPath}");
            }

            chartText = Encoding.UTF8.GetString(request.downloadHandler.data);
        }

        var mods = new HashSet <Mod>(Context.SelectedMods);

        if (Application.isEditor && EditorForceAutoMod)
        {
            mods.Add(Mod.Auto);
        }

        Chart = new Chart(
            chartText,
            mods.Contains(Mod.FlipX) || mods.Contains(Mod.FlipAll),
            mods.Contains(Mod.FlipY) || mods.Contains(Mod.FlipAll),
            true,
            Context.Player.Settings.UseExperimentalNoteAr,
            mods.Contains(Mod.Fast) ? 1.5f : (mods.Contains(Mod.Slow) ? 0.75f : 1),
            camera.orthographicSize
            );
        ChartLength = Chart.Model.note_list.Max(it => it.end_time);
        foreach (var type in (NoteType[])Enum.GetValues(typeof(NoteType)))
        {
            ObjectPool.UpdateNoteObjectCount(type, Chart.MaxSamePageNoteCountByType[type] * 3);
        }

        // Load audio
        print("Loading audio");
        AudioListener.pause = false;

        if (Context.AudioManager == null)
        {
            await UniTask.WaitUntil(() => Context.AudioManager != null);
        }
        Context.AudioManager.Initialize();
        var audioPath = "file://" + Level.Path + Level.Meta.GetMusicPath(Difficulty.Id);
        var loader    = new AudioClipLoader(audioPath);
        await loader.Load();

        if (loader.Error != null)
        {
            Debug.LogError(loader.Error);
            throw new Exception($"Failed to download audio from {audioPath}");
        }

        Music       = Context.AudioManager.Load("Level", loader.AudioClip, false, false, true);
        MusicLength = Music.Length;

        // Load storyboard
        StoryboardPath =
            Level.Path + (chartMeta.storyboard != null ? chartMeta.storyboard.path : "storyboard.json");

        if (File.Exists(StoryboardPath))
        {
            // Initialize storyboard
            // TODO: Why File.ReadAllText() works but not UnityWebRequest?
            // (UnityWebRequest downloaded text could not be parsed by Newtonsoft.Json)
            try
            {
                var storyboardText = File.ReadAllText(StoryboardPath);
                Storyboard = new Cytoid.Storyboard.Storyboard(this, storyboardText);
                Storyboard.Parse();
                await Storyboard.Initialize();

                print($"Loaded storyboard from {StoryboardPath}");
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                Debug.LogError("Could not load storyboard.");
            }
        }

        // Load hit sound
        if (Context.Player.Settings.HitSound != "none")
        {
            var resource = await Resources.LoadAsync <AudioClip>("Audio/HitSounds/" + Context.Player.Settings.HitSound);

            Context.AudioManager.Load("HitSound", resource as AudioClip, isResource: true);
        }

        // State & config
        State             = new GameState(this, mode, mods);
        Context.GameState = State;

        if (Application.isEditor)
        {
            Debug.Log("Chart checksum: " + State.ChartChecksum);
        }

        Config = new GameConfig(this);

        // Touch handlers
        if (mode != GameMode.GlobalCalibration && !State.Mods.Contains(Mod.Auto))
        {
            inputController.EnableInput();
        }

        // System config
        Application.targetFrameRate = 120;
        Context.SetAutoRotation(false);

        // Update last played time
        Level.Record.LastPlayedDate = DateTimeOffset.UtcNow;
        Level.SaveRecord();

        // Initialize note pool
        ObjectPool.Initialize();

        IsLoaded = true;
        if (mode != GameMode.GlobalCalibration)
        {
            Context.ScreenManager.ChangeScreen(OverlayScreen.Id, ScreenTransition.None);
        }

        onGameLoaded.Invoke(this);

        levelInfoParent.transform.RebuildLayout();

        if (startAutomatically)
        {
            StartGame();
        }
    }
Exemple #46
0
 protected override bool shouldLoadDifficulty(Difficulty difficulty)
 {
     return(true);
 }
Exemple #47
0
        public void Enforce()
        {
            if (this.SeedType == SeedType.Random)
            {
                this.Seed = "";
                var r = new Random();
                for (int i = 0; i < 6; i++)
                {
                    var val = r.Next(36);
                    if (val < 10)
                    {
                        this.Seed += ((char)('0' + val)).ToString();
                    }
                    else
                    {
                        this.Seed += ((char)('a' + val - 10)).ToString();
                    }
                }
            }
            switch (this.Rules)
            {
            case Ruleset.A:
                this.SetNormalMaps();
                this.RepeatRooms  = false;
                this.EnterUnknown = false;
                this.Variants     = false;
                this.Algorithm    = LogicType.Pathway;
                this.Length       = MapLength.Short;
                this.Dashes       = NumDashes.One;
                this.Difficulty   = Difficulty.Normal;
                this.Lights       = ShineLights.Hubs;
                this.Darkness     = Darkness.Never;
                break;

            case Ruleset.B:
                this.SetNormalMaps();
                this.RepeatRooms  = false;
                this.EnterUnknown = false;
                this.Variants     = false;
                this.Algorithm    = LogicType.Pathway;
                this.Length       = MapLength.Medium;
                this.Dashes       = NumDashes.Two;
                this.Difficulty   = Difficulty.Normal;
                this.Lights       = ShineLights.Hubs;
                this.Darkness     = Darkness.Never;
                break;

            case Ruleset.C:
                this.SetNormalMaps();
                this.RepeatRooms  = false;
                this.EnterUnknown = false;
                this.Variants     = false;
                this.Algorithm    = LogicType.Pathway;
                this.Length       = MapLength.Medium;
                this.Dashes       = NumDashes.One;
                this.Difficulty   = Difficulty.Expert;
                this.Lights       = ShineLights.Hubs;
                this.Darkness     = Darkness.Vanilla;
                break;

            case Ruleset.D:
                this.SetNormalMaps();
                this.RepeatRooms  = false;
                this.EnterUnknown = false;
                this.Variants     = false;
                this.Algorithm    = LogicType.Pathway;
                this.Length       = MapLength.Long;
                this.Dashes       = NumDashes.Two;
                this.Difficulty   = Difficulty.Expert;
                this.Lights       = ShineLights.Hubs;
                this.Darkness     = Darkness.Vanilla;
                break;

            case Ruleset.E:
                this.SetNormalMaps();
                this.RepeatRooms  = false;
                this.EnterUnknown = false;
                this.Variants     = false;
                this.Algorithm    = LogicType.Labyrinth;
                this.Length       = MapLength.Medium;
                this.Dashes       = NumDashes.One;
                this.Difficulty   = Difficulty.Normal;
                this.Lights       = ShineLights.Hubs;
                this.Darkness     = Darkness.Never;
                break;

            case Ruleset.F:
                this.SetNormalMaps();
                this.RepeatRooms  = false;
                this.EnterUnknown = false;
                this.Variants     = false;
                this.Algorithm    = LogicType.Labyrinth;
                this.Length       = MapLength.Medium;
                this.Dashes       = NumDashes.Two;
                this.Difficulty   = Difficulty.Hard;
                this.Lights       = ShineLights.Hubs;
                this.Darkness     = Darkness.Never;
                break;
            }
        }
Exemple #48
0
    void Update()
    {
        if (Time.time > nextSpawnTime)
        {
            float secondsBetweenSpawns = Mathf.Lerp(spawnDelayMinMax.y, spawnDelayMinMax.x, Difficulty.GetDifficultyPercent());
            nextSpawnTime = Time.time + secondsBetweenSpawns;

            //			float spawnAngle = Random.Range (-spawnAngleMax, spawnAngleMax);
            float spawnSize = 0.7f;
            float slalomx   = 5;
            if (lastSlalomX < 0)
            {
                slalomx = Random.Range(0, screenHalfSize.x / 4);
            }
            else
            {
                slalomx = Random.Range(-screenHalfSize.x / 4 - 5, 0);
            }

            /*while (Mathf.Abs(slalomx - lastSlalomX) > 5)
             * {
             *  print("repositioning\n");
             *  slalomx = Random.Range(-screenHalfSize.x / 4 - 5, screenHalfSize.x / 4);
             * }*/
            lastSlalomX = slalomx;
            float      slalomy                = -screenHalfSize.y - 15;
            Vector2    spawnPosition          = new Vector2(slalomx, slalomy);
            Vector2    spawnPosition2         = new Vector2(slalomx + 5, slalomy);
            Vector2    spawnPositionLine      = new Vector2(slalomx + (5 / 2) + 0.7f, slalomy);
            Vector2    spawnPositionLineLeft  = new Vector2(-(screenHalfSize.x - slalomx) / 2.0F, slalomy);
            Vector2    spawnPositionLineRight = new Vector2((screenHalfSize.x - (slalomx + 5)) / 2.0F, slalomy);
            GameObject slalomPostLeft         = (GameObject)Instantiate(fallingObstaclePrefab, spawnPosition, Quaternion.identity);
            GameObject slalomPostRight        = (GameObject)Instantiate(fallingObstaclePrefab, spawnPosition2, Quaternion.identity);
            GameObject pointLine              = (GameObject)Instantiate(linePrefab, spawnPositionLine, Quaternion.identity);

            GameObject pointLineLeft = (GameObject)Instantiate(outPrefab, spawnPositionLineLeft, Quaternion.identity);
            pointLineLeft.transform.localScale = new Vector3(screenHalfSize.x + slalomx, 0.1F, 0);


            GameObject pointLineRight = (GameObject)Instantiate(outPrefab, spawnPositionLineRight, Quaternion.identity);
            pointLineRight.transform.localScale = new Vector3(screenHalfSize.x - (slalomx + 5), 0.1F, 0);

            slalomPostLeft.transform.localScale  = Vector2.one * spawnSize;
            slalomPostRight.transform.localScale = Vector2.one * spawnSize;
        }
    }
 public override int GetHashCode()
 {
     return(Difficulty.GetHashCode());
 }
Exemple #50
0
 protected void generateFormula(int solutionBounds, int difficulty)
 {
     formulaTree = AbstractNode.createTree(Difficulty.getRandomInt(solutionBounds), difficulty);
     solution    = formulaTree.getValue().ToString();
     //Debug.Log(formulaTree + " = " + formulaTree.getValue());
 }
Exemple #51
0
        private void FillForDamager(DamageInfo damager, ItemDropList dropList, ChestSourceInfo sourceInfo)
        {
            ConcurrentDictionary <string, ServerInventoryItem> newObjects = new ConcurrentDictionary <string, ServerInventoryItem>();

            Workshop lootWorkshop = (Workshop)damager.workshop;

            //in 10% dropped source workshop items
            if (sourceInfo != null && sourceInfo.hasWorkshop)
            {
                if (Rand.Float01() < 0.1f)
                {
                    lootWorkshop = sourceInfo.sourceWorkshop;
                }
            }

            DropManager dropManager = DropManager.Get(resource);

            int lootLevel = damager.level;

            if (sourceInfo != null && sourceInfo.level != 0)
            {
                log.InfoFormat("set loot level = {0} yellow", sourceInfo.level);
                lootLevel = sourceInfo.level;
            }

            Difficulty d = Difficulty.starter;

            if (sourceInfo != null)
            {
                d = sourceInfo.difficulty;
            }


            int groupCount = 1;

            NebulaObject playerObject = GetNebulaObject(damager);

            groupCount = GetGroupCount(playerObject);

            float remapWeight = GetColorRemapWeight(playerObject, groupCount);

            if (dropList == null)
            {
                //generate single weapon
                GenerateWeapons(dropManager, lootLevel, lootWorkshop, d, newObjects, remapWeight);

                GenerateSchemes(dropManager, lootLevel, lootWorkshop, d, newObjects, remapWeight);
            }
            else
            {
                GenerateFromDropList(
                    (Race)damager.race,
                    dropManager,
                    lootLevel,
                    lootWorkshop,
                    d,
                    newObjects,
                    remapWeight,
                    dropList,
                    damager.level,
                    groupCount);
            }
            //generate single scheme


            //generate creadits
            //CreditsObject creadits = new CreditsObject(resource.MiscItemDataRes.CreditsObject());
            //creadits.SetCount(20);
            //newObjects.TryAdd(creadits.Id, creadits);
            if (content.TryAdd(damager.DamagerId, newObjects))
            {
                if (damager.DamagerType == (byte)ItemType.Avatar)
                {
                    NotifyChestDamager(damager);
                }
            }
        }
Exemple #52
0
    public Dictionary <string, List <int[]> > GetBtnInfo(Difficulty difficulty, int Level)
    {
        Dictionary <string, List <int[]> > BtnInfo = new Dictionary <string, List <int[]> >();

        if ((int)difficulty <= 1010)
        {
            foreach (var value in config[(int)difficulty].Keys)
            {
                if (value == Level)
                {
                    string info = config[(int)difficulty][value];
                    info = info.Trim();
                    string[] BtnInfos = info.Split('&');
                    foreach (string One in BtnInfos)
                    {
                        string[] OneInof = One.Split('=');
                        OneInof[1] = OneInof[1].Trim();
                        List <int[]> OnePos = new List <int[]>();
                        for (int i = 0; i < OneInof[1].Length - 1; i += 2)
                        {
                            int   in1    = int.Parse(OneInof[1][i].ToString());
                            int   in2    = int.Parse(OneInof[1][i + 1].ToString());
                            int[] assasa = new int[] { in1, in2 };
                            OnePos.Add(assasa);
                        }
                        BtnInfo.Add(OneInof[0].Trim(), OnePos);
                    }
                    return(BtnInfo);
                }
            }
            return(null);
        }
        else
        {
            foreach (var value in config[(int)difficulty].Keys)
            {
                if (value == Level)
                {
                    string info = config[(int)difficulty][value];
                    info = info.Trim();
                    string[] BtnInfos = info.Split('&');
                    foreach (string One in BtnInfos)
                    {
                        string[] OneInof = One.Split('=');
                        OneInof[1] = OneInof[1].Trim();
                        string[]     vs     = OneInof[1].Split('~');
                        List <int[]> OnePos = new List <int[]>();
                        foreach (string c in vs)
                        {
                            int   diff = (int)difficulty % 100;
                            int[] ass  = GetIndex(int.Parse(c), diff);
                            OnePos.Add(ass);
                        }
                        BtnInfo.Add(OneInof[0].Trim(), OnePos);
                    }
                    return(BtnInfo);
                }
            }
            return(null);
        }
    }
Exemple #53
0
        private void GenerateScheme(DropManager dropManager, int lootLevel, Workshop lootWorkshop, Difficulty d, ConcurrentDictionary <string, ServerInventoryItem> newObjects, float remapWeight)
        {
            var moduleTemplate            = resource.ModuleTemplates.RandomModule(lootWorkshop, CommonUtils.RandomEnumValue <ShipModelSlotType>());
            var schemeDropper             = dropManager.GetSchemeDropper(lootWorkshop, lootLevel, remapWeight);
            IInventoryObject schemeObject = schemeDropper.Drop() as IInventoryObject;

            newObjects.TryAdd(schemeObject.Id, new ServerInventoryItem(schemeObject, 1));
            //log.InfoFormat("scheme of level = {0} generated", schemeObject.Level);
        }
Exemple #54
0
 /// <summary>
 /// Create and Initialize Mine Sweeper Game
 /// </summary>
 public MineSweeper(Difficulty difficulty)
 {
     TotalRows    = DifficultyToRows[difficulty];
     TotalColumns = DifficultyToColumns[difficulty];
     TotalMines   = (int)(TotalRows * TotalColumns * DifficultyToMineDensity[difficulty]);
 }
Exemple #55
0
 //Returns the bodmas weighting of this node and its subtrees//
 public override int getBodmasWeight()
 {
     return(Difficulty.getBodmas(this.symbol));
 }
        public static string ToShortString(this Difficulty d, string fileNameContext = null)
        {
            if (fileNameContext != null)
            {
                fileNameContext = fileNameContext.ToLower();
                switch (d)
                {
                case Difficulty.Light:
                    if (fileNameContext.Contains("nov"))
                    {
                        return("NOV");
                    }
                    break;

                case Difficulty.Challenge:
                    if (fileNameContext.Contains("adv"))
                    {
                        return("ADV");
                    }
                    break;

                case Difficulty.Extended:
                    if (fileNameContext.Contains("exh"))
                    {
                        return("EXH");
                    }
                    break;

                case Difficulty.Infinite:
                    if (fileNameContext.Contains("inf"))
                    {
                        return("INF");
                    }
                    else if (fileNameContext.Contains("grv"))
                    {
                        return("GRV");
                    }
                    else if (fileNameContext.Contains("hvn"))
                    {
                        return("HVN");
                    }
                    else if (fileNameContext.Contains("vvd"))
                    {
                        return("VVD");
                    }
                    else if (fileNameContext.Contains("mxm"))
                    {
                        return("MXM");
                    }
                    break;
                }
            }

            switch (d)
            {
            case Difficulty.Light: return("LT");

            case Difficulty.Challenge: return("CH");

            case Difficulty.Extended: return("EX");

            case Difficulty.Infinite: return("IN");
            }

            return("XX");
        }
        public static Vector3 GetColor(this Difficulty d, string fileNameContext = null)
        {
            if (fileNameContext != null)
            {
                fileNameContext = fileNameContext.ToLower();
                switch (d)
                {
                case Difficulty.Light:
                    if (fileNameContext.Contains("nov"))
                    {
                        return(new Vector3(0.8f, 0.4f, 1));
                    }
                    break;

                case Difficulty.Challenge:
                    if (fileNameContext.Contains("adv"))
                    {
                        return(new Vector3(1, 1, 0.25f));
                    }
                    break;

                case Difficulty.Extended:
                    if (fileNameContext.Contains("exh"))
                    {
                        return(new Vector3(1, 0.2f, 0.4f));
                    }
                    break;

                case Difficulty.Infinite:
                    if (fileNameContext.Contains("inf"))
                    {
                        return(new Vector3(1, 0.5f, 1));
                    }
                    else if (fileNameContext.Contains("grv"))
                    {
                        return(new Vector3(1, 0.4f, 0));
                    }
                    else if (fileNameContext.Contains("hvn"))
                    {
                        return(new Vector3(0, 0.55f, 1));
                    }
                    else if (fileNameContext.Contains("vvd"))
                    {
                        return(new Vector3(1, 0.1f, 0.55f));
                    }
                    else if (fileNameContext.Contains("mxm"))
                    {
                        return(new Vector3(0.95f));
                    }
                    break;
                }
            }

            switch (d)
            {
            case Difficulty.Light: return(new Vector3(0, 1, 0));

            case Difficulty.Challenge: return(new Vector3(1, 1, 0));

            case Difficulty.Extended: return(new Vector3(1, 0, 0));

            case Difficulty.Infinite: return(new Vector3(0.5f, 1, 1));
            }

            return(Vector3.One);
        }
        public static string ToDifficultyString(this Difficulty d, string fileNameContext = null)
        {
            if (fileNameContext != null)
            {
                fileNameContext = fileNameContext.ToLower();
                switch (d)
                {
                case Difficulty.Light:
                    if (fileNameContext.Contains("nov"))
                    {
                        return("Novice");
                    }
                    break;

                case Difficulty.Challenge:
                    if (fileNameContext.Contains("adv"))
                    {
                        return("Advanced");
                    }
                    break;

                case Difficulty.Extended:
                    if (fileNameContext.Contains("exh"))
                    {
                        return("Exhaust");
                    }
                    break;

                case Difficulty.Infinite:
                    if (fileNameContext.Contains("inf"))
                    {
                        return("Infinite");
                    }
                    else if (fileNameContext.Contains("grv"))
                    {
                        return("Gravity");
                    }
                    else if (fileNameContext.Contains("hvn"))
                    {
                        return("Heavenly");
                    }
                    else if (fileNameContext.Contains("vvd"))
                    {
                        return("Vivid");
                    }
                    else if (fileNameContext.Contains("mxm"))
                    {
                        return("Maximum");
                    }
                    break;
                }
            }

            switch (d)
            {
            case Difficulty.Light: return("Light");

            case Difficulty.Challenge: return("Challenge");

            case Difficulty.Extended: return("Extended");

            case Difficulty.Infinite: return("Infinite");
            }

            return("XX");
        }
Exemple #59
0
    // Update is called once per frame
    void Update()
    {
        if (Time.time > nextSpawnTime)
        {
            float secondsBetweenSpawns = Mathf.Lerp(secondsBetweenSpawnsMinMax.y, secondsBetweenSpawnsMinMax.x, Difficulty.GetDifficultyPercent());
            nextSpawnTime = Time.time + secondsBetweenSpawns;
            spawnSize     = Random.Range(spawnSizeMinMax.x, spawnSizeMinMax.y);
            float spawnAngle = Random.Range(-spawnAngleMax, spawnAngleMax);

            Vector2    spawnPosition = new Vector2(Random.Range(-screenHalfSizeWorldUnits.x, screenHalfSizeWorldUnits.x), screenHalfSizeWorldUnits.y + spawnSize);
            GameObject fallingBlock  = (GameObject)Instantiate(fallingBlockPrefab, spawnPosition, Quaternion.Euler(Vector3.forward * spawnAngle));


            fallingBlock.transform.localScale = Vector2.one * spawnSize;
        }
    }
Exemple #60
0
        }     //End private void btnAdvanced_Click(object sender, EventArgs e)

        private void btnMaster_Click(object sender, EventArgs e)
        {
            //Declare variables
            Point move = new Point(-1, -1);

            this.Difficulty = Difficulty.Master;

            if (this.chkAIOnly.Checked)
            {
                if (this.chkSingleTurn.Checked)
                {
                    if (this.Advanced.PlayersVal != BoardVals.O)
                    {
                        this.Advanced = new Advanced(BoardVals.O);
                    } //End if (this.Beginner.PlayersVal != BoardVals.O)

                    if (!this.Board.findFourInARow(this.Master.PlayersVal) && !this.Board.findFourInARow(this.Advanced.PlayersVal))
                    {
                        if (this.WhosTurn == BoardVals.O)
                        {
                            this.WhosTurn = BoardVals.X;

                            move = this.Advanced.minimaxDecision();

                            if (!this.Board.setState(move, this.Advanced.PlayersVal))
                            {
                                ///wat?
                            } //End
                            this.Advanced.Board.setState(move, this.Advanced.PlayersVal);
                            this.Master.Board.setState(move, this.Advanced.PlayersVal);
                            displayData("Advanced's Turn\n\n" + this.Board.displayBoard());
                        } //End if (this.WhosTurn == BoardVals.O)
                        else if (this.WhosTurn == BoardVals.X)
                        {
                            this.WhosTurn = BoardVals.O;

                            this.timer = Stopwatch.StartNew();
                            move       = this.Master.minimaxDecision();
                            this.timer.Stop();

                            if (!this.Board.setState(move, this.Master.PlayersVal))
                            {
                                ///wat?
                            } //End
                            this.Advanced.Board.setState(move, this.Master.PlayersVal);
                            this.Master.Board.setState(move, this.Master.PlayersVal);
                            displayData("Master's Turn\n\n" + this.Board.displayBoard());
                            displayDataAppend("Number of nodes generated: " + this.Master.NodesGenerated);
                            displayMillisecondsElapsed();
                        } //End else if (this.WhosTurn == BoardVals.X)
                    }     //End if (!this.Board.findFourInARow(this.Master.PlayersVal) && !this.Board.findFourInARow(this.Advanced.PlayersVal))
                }         //End if (this.chkSingleTurn.Checked)
                else
                {
                    if (!this.chkFinishGame.Checked)
                    {
                        reset();
                        this.Advanced = new Advanced(BoardVals.O);
                    } //End if (!this.chkFinishGame.Checked)

                    int turns = 0;
                    while (!this.Board.findFourInARow(this.Master.PlayersVal) && !this.Board.findFourInARow(this.Advanced.PlayersVal) && this.Board.getPossibleMoves().Count > 0)
                    {
                        turns += 1;

                        move = this.Advanced.minimaxDecision();

                        this.Board.setState(move, this.Advanced.PlayersVal);
                        this.Advanced.Board.setState(move, this.Advanced.PlayersVal);
                        this.Master.Board.setState(move, this.Advanced.PlayersVal);
                        displayData(this.Board.displayBoard());

                        if (this.Board.findFourInARow(this.Advanced.PlayersVal))
                        {
                            break;
                        } //End if (this.Board.findFourInAROw(this.Advanced.PlayersVal))

                        this.timer = Stopwatch.StartNew();
                        move       = this.Master.minimaxDecision();
                        this.timer.Stop();

                        this.Board.setState(move, this.Master.PlayersVal);
                        this.Advanced.Board.setState(move, this.Master.PlayersVal);
                        this.Master.Board.setState(move, this.Master.PlayersVal);
                        displayData(this.Board.displayBoard());
                        displayDataAppend("Number of nodes generated: " + this.Master.NodesGenerated);
                        displayMillisecondsElapsed();
                    } //End while (!this.Board.findFourInARow(this.Master.PlayersVal) && !this.Board.findFourInARow(this.Advanced.PlayersVal) && this.Board.getPossibleMoves().Count > 0)
                }     //End else

                if (this.Board.findFourInARow(this.Master.PlayersVal) || this.Board.findFourInARow(this.Advanced.PlayersVal))
                {
                    if (this.Board.findFourInARow(this.Master.PlayersVal))
                    {
                        displayDataAppend("Master won!");
                    } //End if (this.Board.findFourInARow(this.Master.PlayersVal))
                    else if (this.Board.findFourInARow(this.Advanced.PlayersVal))
                    {
                        displayDataAppend("Advanced won!");
                    } //End else if (this.Board.findFourInARow(this.Advanced.PlayersVal))
                }     //End if (this.Board.findFourInARow(this.Master.PlayersVal) || !this.Board.findFourInARow(this.Advanced.PlayersVal))
                else if (this.Board.getPossibleMoves().Count <= 0)
                {
                    displayDataAppend("Draw!");
                } //End else if (this.Board.getPossibleMoves().Count <= 0)
            }     //End if (this.chkAIOnly.Checked)
            else
            {
                move = this.Master.minimaxDecision();

                this.Board.setState(move, this.Master.PlayersVal);
                //this.Master.Board.setState(move, this.Master.PlayersVal);
                if (!this.Master.Board.setState(move, this.Master.PlayersVal))
                {
                    ///wat?
                } //End
                displayData(this.Board.displayBoard());
            }     //End else
        }         //End private void btnMaster_Click(object sender, EventArgs e)