public OptionsState()
        {
            Button changeScreenSize = new Button("Max Particles: " + ParticleEngine.MaxParticles, 300, 200, 250, 50, Keys.S);
            changeScreenSize.SetOnClickFunction(() => {
                ParticleEngine.MaxParticles += 128;
                if (ParticleEngine.MaxParticles > 2512) ParticleEngine.MaxParticles = 256;
                changeScreenSize.setText("Max Particles: " + ParticleEngine.MaxParticles);
            });
            components.Add(changeScreenSize);

            Button difficulityButton = new Button("Difficulity: " + difficulity.ToString(), 300, 270, 250, 50, Keys.S);
            difficulityButton.SetOnClickFunction(() =>
            {
                switch (difficulity)
                {
                    case Difficulity.IRONMAN: difficulity = Difficulity.SISSY; break;
                    case Difficulity.SISSY:   difficulity = Difficulity.REGULAR; break;
                    case Difficulity.REGULAR: difficulity = Difficulity.IRONMAN; break;
                }
                difficulityButton.setText("Difficulity: " + difficulity.ToString());
            });
            components.Add(difficulityButton);

            Button exitButtion = new Button("Exit", 300, 340, 250, 50, Keys.Escape);
            exitButtion.SetOnClickFunction(() => NextGameState = null);
            components.Add(exitButtion);

            Label stateLabel = new Label("==OPTIONS==", 360, 100);
            components.Add(stateLabel);
        }
示例#2
0
    public override void SetLevel(Difficulity level)
    {
        cWaypoint      = 0;
        firstCollision = true;
        diff           = level;
        switch (diff)
        {
        case Difficulity.Tutorial:
            //do nothing
            break;

        case Difficulity.Beginner:
            currentWaypoints        = waypointsBeginner;
            currentWaypoints[0].tag = "beginner current";
            break;

        case Difficulity.Intermediate:
            currentWaypoints        = waypointsIntermediate;
            currentWaypoints[0].tag = "intermediate current";
            break;

        case Difficulity.Advanced:
            currentWaypoints        = waypointsAdvanced;
            currentWaypoints[0].tag = "advanced current";
            break;
        }
    }
示例#3
0
 private static List <string> GetRooms(Difficulity difficulity)
 {
     return(GetAllRooms().Items()
            .Where(room => room.Attribute is AvailableAttribute attr && (attr.Difficulity & difficulity) != 0)
            .OrderBy(room => room.Identificator)
            .Select(room => room.Identificator)
            .ToList());
 }
示例#4
0
 public static void SetLevelForAll(Difficulity level)
 {
     foreach (var b in Behaviours)
     {
         if (b != null)
         {
             b.SetLevel(level);
         }
     }
 }
示例#5
0
文件: AI.cs 项目: AV2606/Tic-tac-toe
 public AI(Difficulity d, CellE AI = CellE.o, CellE opponent = CellE.x)
 {
     difficulity = d;
     me          = AI;
     him         = opponent;
     if (me == him)
     {
         throw new ArgumentException("The AI and the opponent cant be the same sign.");
     }
 }
示例#6
0
        private void AskRoom(User user, Difficulity difficulity)
        {
            var selectedRoom = GetRandomRoom(user, difficulity);

            GetRoomVariables(user).Set("room", new Serializable.String(selectedRoom));
            SendMessage(user,
                        $"Ты идешь по лесу и видишь на поляне <b>{GetAllRooms().Get(selectedRoom)?.Name}</b>",
                        GetButtons(user)
                        );
        }
 public override void SetLevel(Difficulity level)
 {
     if (level != Difficulity.Tutorial)
     {
         TutorialPanelFader.FadeOut(() =>
         {
             this.gameObject.SetActive(false);
         });
         ControllerPanelFader.FadeOut(() => ControllerPanelFader.gameObject.SetActive(false));
     }
 }
示例#8
0
 // Use this for initialization
 void Start()
 {
     //inital difficulty is beginner
     diff             = Difficulity.Beginner;
     currentWaypoints = waypointsBeginner;
     waypoint         = currentWaypoints[0];
     currentWaypoints[cWaypoint].gameObject.tag = "beginner current";
     counter        = 0;
     hitEnvironment = false;
     firstCollision = true;
     rb             = GetComponent <Rigidbody>();
 }
示例#9
0
 public void difChange(Difficulity d)
 {
     if ((int)difficulity == (int)d)
     {
         return;
     }
     if ((int)difficulity == 0)
     {
         PvPB.FlatStyle = FlatStyle.Standard;
     }
     if ((int)difficulity == 1)
     {
         EasyB.FlatStyle = FlatStyle.Standard;
     }
     if ((int)difficulity == 2)
     {
         MediumB.FlatStyle = FlatStyle.Standard;
     }
     if ((int)difficulity == 3)
     {
         HardB.FlatStyle = FlatStyle.Standard;
     }
     if (d == Difficulity.pvp)
     {
         difficulity    = Difficulity.pvp;
         PvPB.FlatStyle = FlatStyle.Popup;
     }
     if ((int)d == 1)
     {
         difficulity     = Difficulity.easy;
         EasyB.FlatStyle = FlatStyle.Flat;
     }
     if ((int)d == 2)
     {
         difficulity       = Difficulity.medium;
         MediumB.FlatStyle = FlatStyle.Flat;
     }
     if ((int)d == 3)
     {
         difficulity     = Difficulity.hard;
         HardB.FlatStyle = FlatStyle.Flat;
     }
 }
示例#10
0
 private void NextDifficultyLevel()
 {
     if (CurrentDifficulty == Difficulity.Advanced3)
     {
         //we are done with the experiment
         DataRecorder.RecordEvent(DataEvent.ExperimentEnded);
         ExperimentManager.Instance.ExperimentComplete();
         return;
     }
     if (CurrentDifficulty == Difficulity.Tutorial)
     {
         StartCoroutine(StressLevelPromptCoroutine());
         DataRecorder.RecordEvent(DataEvent.ExperimentStart);
     }
     CurrentDifficulty = CurrentDifficulty + 1;
     DataRecorder.RecordEvent(DataEvent.DifficultyLevelChanged, (int)CurrentDifficulty);
     //tell anybody who cares that the difficulty level changed
     DifficultySensitiveBehaviour.SetLevelForAll(CurrentDifficulty);
     Invoke("PromptForNextDifficultyLevel", AutoLevelTime);
 }
示例#11
0
        private void Go(User user, Difficulity difficulity)
        {
            var rooms = GetRooms(difficulity);

            if (rooms.Count == 0)
            {
                SendMessage(user, "Ты побродил по лесу, но так ничего и не нашел.");
                user.RoomManager.Leave();
            }
            else if (user.ItemManager.Get("item/slippers") != null)
            {
                SwitchAction(user, RoomSelection);
                GetRoomVariables(user).Set("difficulity", new Serializable.Int((int)difficulity));
                GetRoomVariables(user).Set("count", new Serializable.Int(user.Random.Next(3, 5 + 1)));
                AskRoom(user, difficulity);
            }
            else
            {
                var selectedRoom = GetRandomRoom(user, difficulity);
                SwitchRoom(user, selectedRoom);
            }
        }
示例#12
0
        private static string GetDescriptionForDifficulity(Difficulity dif)
        {
            switch (dif)
            {
            case Difficulity.Beginner:
                return(StringManager.GetString("NextLevelPanel_Beginner1Description"));

            case Difficulity.Beginner2:
                return(StringManager.GetString("NextLevelPanel_Beginner2Description"));

            case Difficulity.Beginner3:
                return(StringManager.GetString("NextLevelPanel_Beginner3Description"));

            case Difficulity.Intermediate:
                return(StringManager.GetString("NextLevelPanel_Intermediate1Description"));

            case Difficulity.Intermediate2:
                return(StringManager.GetString("NextLevelPanel_Intermediate2Description"));

            case Difficulity.Intermediate3:
                return(StringManager.GetString("NextLevelPanel_Intermediate3Description"));

            case Difficulity.Advanced:
                return(StringManager.GetString("NextLevelPanel_Advanced1Description"));

            case Difficulity.Advanced2:
                return(StringManager.GetString("NextLevelPanel_Advanced2Description"));

            case Difficulity.Advanced3:
                return(StringManager.GetString("NextLevelPanel_Advanced3Description"));

            case Difficulity.End:
                return(StringManager.GetString("NextLevelPanel_EndDescription"));

            default:
                return("[ERR: No Description available]");
            }
        }
        private void MoveTableForDifficulty(Difficulity level)
        {
            switch (level)
            {
            case Difficulity.Beginner:
            case Difficulity.Intermediate:
            case Difficulity.Advanced:
                SetDistanceFromPlayer(2f);
                break;

            case Difficulity.Beginner2:
            case Difficulity.Intermediate2:
            case Difficulity.Advanced2:
                SetDistanceFromPlayer(1.25f);
                break;

            case Difficulity.Beginner3:
            case Difficulity.Intermediate3:
            case Difficulity.Advanced3:
                SetDistanceFromPlayer(0.5f);
                break;
            }
        }
示例#14
0
        private static string GetRandomRoom(User user, Difficulity difficulity)
        {
            var rooms = GetRooms(difficulity);

            return(rooms[user.Random.Next(rooms.Count)]);
        }
 public override void SetLevel(Difficulity level)
 {
     _lastSetDifficulity = level;
     MoveTableForDifficulty(level);
     //the animations are played in BoxDoneMoving
 }
示例#16
0
 public override void SetLevel(Difficulity level)
 {
     DifficultyText.text = string.Format(DifficultyStringFormat, Enum.GetName(typeof(Difficulity), level));
 }
示例#17
0
 public AvailableAttribute(string identifier, Difficulity difficulity) : base(identifier)
 {
     Difficulity = difficulity;
 }
示例#18
0
 public abstract void SetLevel(Difficulity level);
示例#19
0
        public GameForm(Difficulity difficulity)
        {
            InitializeComponent();

            Ai                = new AI(difficulity);
            status            = GameStatus.X_turn;
            this.SizeChanged += (sender, e) => { CenterizeAllControls(); };
            GameFinished     += OnGameFinished;
            AIthread          = new Thread(AI);

            //Debug waste
            helpL.Enabled    = false;
            EasyB.Enabled    = false;
            MediumB.Enabled  = false;
            HardB.Enabled    = false;
            PvPB.Enabled     = false;
            ReWriteB.Enabled = false;
            Undo.Enabled     = false;

            helpL.Visible    = false;
            EasyB.Visible    = false;
            MediumB.Visible  = false;
            HardB.Visible    = false;
            PvPB.Visible     = false;
            ReWriteB.Visible = false;
            Undo.Visible     = false;
            //end of debug waste

            this.difficulity = difficulity;
            if (Program.Game == null)
            {
                Program.Game = this;
            }
            else
            {
                this.Close();
                this.Dispose();
                return;
            }
            ThreadPool.init();
            CheckForIllegalCrossThreadCalls = false;
            IsXTurn = true;
            ended   = false;
            game    = new GameLogic();
            cellsP  = new PictureBox[3, 3];
            // Box1.Click+= CellClick;
            cellsP[0, 0] = Box1;
            cellsP[0, 1] = Box2;
            cellsP[0, 2] = Box3;
            cellsP[1, 0] = Box4;
            cellsP[1, 1] = Box5;
            cellsP[1, 2] = Box6;
            cellsP[2, 0] = Box7;
            cellsP[2, 1] = Box8;
            cellsP[2, 2] = Box9;
            Ximg         = Box1.BackgroundImage;
            Oimg         = Box2.BackgroundImage;
            clearImg     = Box3.BackgroundImage;
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (!(i == 0 && j == 0))
                    {
                        cellsP[i, j].Click += CellClick;
                    }
                }
            }
            Clear();
            PvPB.FlatStyle    = FlatStyle.Popup;
            this.FormClosing += (x, y) => {
                if (Program.Game == this)
                {
                    Program.Game = null;
                }
            };
            this.BackColor       = Color.Empty;
            this.BackgroundImage = null;
            Color left, right;

            left  = Color.Salmon;
            right = Color.DarkViolet;
            if (this.difficulity == Difficulity.easy)
            {
                left  = Color.Green;
                right = Color.White;
            }
            if (this.difficulity == Difficulity.medium)
            {
                left  = Color.Orange;
                right = Color.Green;
            }
            if (this.difficulity == Difficulity.hard)
            {
                left  = Color.Red;
                right = Color.Orange;
            }
            if (this.difficulity == Difficulity.pvp)
            {
                left  = Color.Navy;
                right = Color.Red;
            }
            Bitmap bitmap = CreateGradient(left, right, new Tools.Imageing.Resolution(Width, Height));

            this.BackgroundImage = Image.FromHbitmap(bitmap.GetHbitmap());
            CenterizeAllControls();
        }
示例#20
0
 void Awake()
 {
     Instance          = this;
     CurrentDifficulty = Difficulity.Tutorial;
 }
示例#21
0
 public AvailableAttribute(string identifier, Difficulity difficulity, string rootId) : base(identifier)
 {
     Difficulity = difficulity;
     RootId      = rootId;
 }
示例#22
0
    // Start is called before the first frame update
    void Start()
    {
        tilesParent      = new GameObject();
        tilesParent.name = "Tiles Parent";
        rocksParent      = new GameObject();
        rocksParent.name = "Rocks Parent";
        frameParent      = new GameObject();
        frameParent.name = "Frame Parent";
        fenceParent      = new GameObject();
        fenceParent.name = "Fence Parent";

        revealedTilesCount = 0;
        int smallRocksCount = 0;

        if (LoadMap && data.revealedCount > 0 && data != null)
        {
            difficulity        = data.difficulity;
            xSize              = data.mapX;
            zSize              = data.mapZ;
            bombCount          = smallRocksCount = data.bombCount;
            map                = data.numbersMap;
            tileCount          = xSize * zSize;
            tiles              = new GameObject[xSize, zSize];
            revealedTilesCount = data.revealedCount;

            for (int i = 0; i < xSize; i++)
            {
                for (int j = 0; j < zSize; j++)
                {
                    SpawnTile(i, j, data.revealedMap[i, j], data.flaggedMap[i, j]);
                }
            }
        }
        else
        {
            switch (difficulity)
            {
            case Difficulity.Easy:
                xSize           = zSize = 8;
                bombCount       = 10;
                smallRocksCount = 10;
                break;

            case Difficulity.Medium:
                xSize           = zSize = 16;
                bombCount       = 40;
                smallRocksCount = 40;
                break;

            case Difficulity.Hard:
                xSize           = 16;
                zSize           = 30;
                bombCount       = 99;
                smallRocksCount = 99;
                break;

            case Difficulity.Costum:
                break;

            default:
                break;
            }
            map                = new sbyte[xSize, zSize];
            tiles              = new GameObject[xSize, zSize];
            tileCount          = xSize * zSize;
            revealedTilesCount = 0;

            // GenerateBombs();
            // GenerateNumbers();
            SpawnMap();
        }

        SpawnSmallRocks(smallRocksCount);
        GenerateFrame();
        GenerateFences();

        Vector3 center = new Vector3(Mathf.RoundToInt(xSize / 2), 0.5f, Mathf.RoundToInt(zSize / 2));

        player.transform.position = center;

        tiles[Mathf.RoundToInt(center.x), Mathf.RoundToInt(center.z)].gameObject.GetComponent <Renderer>().material.SetFloat("Vector1_9DB77AC7", .5f);

        center.y = -0.25f;
        water.transform.position = center;
        center.y = -5f;
        ground.transform.position = center;
    }