Exemplo n.º 1
0
 private static void Levels(level l, level l1, level l2)
 {
     ConsoleKeyInfo cki = new ConsoleKeyInfo();
     cki = Console.ReadKey();    // Считываем нажатую клавишу
     if (cki.Key != ConsoleKey.D0 && cki.Key != ConsoleKey.D1) ShowMenu(l);
     if (cki.Key == ConsoleKey.D1) ShowMenu(l1);
     else if (cki.Key == ConsoleKey.D0) ShowMenu(l2);
 }
Exemplo n.º 2
0
 private void countBreakableBlocks()
 {
     levels = FindObjectOfType <level>();
     if (tag == "breakable")
     {
         levels.CountBreakableBlocks();
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Set the current Level
    /// </summary>
    /// <param name="Level"></param>
    public void SetCurrentLevel(level Level)

    {
        currentLevel       = Level;
        _targetLevel       = null;
        transform.position = Level.transform.position;
        isMoving           = false;
    }
Exemplo n.º 4
0
 private void Start()
 {
     level = FindObjectOfType <level>();
     if (tag == "Breakable")
     {
         level.countbreakableblock();
     }
 }
Exemplo n.º 5
0
 private void Countbrekblock()
 {
     levels = FindObjectOfType <level>();
     if (tag == "Breakabke")
     {
         levels.CountBreakableBlocks();
     }
 }
Exemplo n.º 6
0
 // Start is called before the first frame update
 private void Start()
 {
     loadPrefs();
     Input.simulateMouseWithTouches = true;
     checkPlatform();
     _currentLevel = levelsList.getLevel(currentLevelIndex);
     loadLevel();
 }
Exemplo n.º 7
0
 private void CountBreakableBlocks()
 {
     Level = FindObjectOfType <level>();
     if (tag == "Breakable")
     {
         Level.CountBlocks();
     }
 }
    public static void CreatelevelAssetFile()
    {
        level asset = CustomAssetUtility.CreateAsset <level>();

        asset.SheetName     = "3D_PF_Player";
        asset.WorksheetName = "level";
        EditorUtility.SetDirty(asset);
    }
Exemplo n.º 9
0
 // Use this for initialization
 public void Start()
 {
     level = FindObjectOfType <level>();
     game  = FindObjectOfType <GameSession>();
     if (tag == "Breakable")
     {
         level.CountBreakableBlocks();
     }
 }
Exemplo n.º 10
0
 private void Start()
 {
     lev = FindObjectOfType <level>();
     if (tag == "Breakable")
     {
         lev.CountBreakableBlocks();
     }
     gameStatus = FindObjectOfType <GameStatus>();
 }
Exemplo n.º 11
0
 public B1(Game Game, float X, level l) : base(Game, l)
 {
     path      = "Textures/game/bosses/b1";
     color     = Color.White;
     container = new Rectangle((int)X, 0, 256, 256);
     level     = l;
     health    = 100;
     bossName  = "F****t";
 }
Exemplo n.º 12
0
 /// <summary>
 /// 지역 탭
 /// </summary>
 private void makecommonfightTabs()
 {
     for (int i = 0; i < 12; i++)
     {
         string name = i.ToString();
         level  tab  = new level(name);
         commonfightTabControl.Controls.Add(tab);
     }
 }
Exemplo n.º 13
0
        public static void Main()
        {
            Map map = new Map(8, 5);

            try
            {
                Path path = new Path(
                    new [] {
                    new MapLocation(0, 2, map),
                    new MapLocation(1, 2, map),
                    new MapLocation(2, 2, map),
                    new MapLocation(3, 2, map),
                    new MapLocation(4, 2, map),
                    new MapLocation(5, 2, map),
                    new MapLocation(6, 2, map),
                    new MapLocation(7, 2, map)
                }
                    );

                Invader[] invaders =
                {
                    new Invader(path),
                    new Invader(path),
                    new Invader(path),
                    new Invader(path)
                };

                Tower[] towers =
                {
                    new Tower(new MapLocation(1, 3)),
                    new Tower(new MapLocation(3, 3)),
                    new Tower(new MapLocation(5, 3))
                };

                Level level = new level(invaders)
                {
                    Towers = towers
                };

                bool playerWon = level.Play();

                Console.WriteLine("Player " + (playerWon? "won" : "lost"));
            }
            catch (OutOfBoundsException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (TreehouseDefenseException)
            {
                Console.WriteLine("Unhandled TreehouseDefenseException");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unhandled Exception: " + ex);
            }
        }
Exemplo n.º 14
0
    private void Start()
    {
        //findobjectでlevelスクリプトを参照してブロックの数を数える

        level = FindObjectOfType <level>();
        if (tag == "Breakable")
        {
            level.CountBlocks();
        }
    }
Exemplo n.º 15
0
 private void CountBreakableBlocks()
 {
     //we need to access to the type of level
     //all instances are adding another block so that why it can count the number of blocks.
     level = FindObjectOfType <level>();
     if (tag == "Breakable")
     {
         level.CountBlocks();
     }
 }
Exemplo n.º 16
0
 private void countBreakableBlocks()
 {
     level         = FindObjectOfType <level>();
     currentpoints = FindObjectOfType <GameSession>();
     // it means just count the breakable blocks
     if (tag == "Breakable")
     {
         level.countBlocks();
     }
 }
Exemplo n.º 17
0
    // -----------------------------------------------------------------------------------------------------------------
    // STATIC
    public static level Instantiate(level.CConfig cfg, string name)
    {
        level obj = utils.Instantiate(null, name).AddComponent <level>();

        obj.m_config = cfg;
        obj.BuildMaterials();
        obj.BuildTiles();

        return(obj);
    }
Exemplo n.º 18
0
public void addIconControl(string imgURL, level Level) //adds icon to form
{
    btn.Image = System.Drawing.Image.FromFile(imgURL);
    btn.Click += new EventHandler(icon_Click);
    btn.Left = -Level.screenOffsetX + (int)xPos;
    btn.Top = -Level.screenOffsetY + (int)yPos;
    btn.Width = 18; //MAGIC NUMBER, TODO - set to be dependent on image
    btn.Height = 18;
    Level.parentForm.Controls.Add(btn); //TODO fix to remove activeForm and stop errors when debugging
}
Exemplo n.º 19
0
        public Player(Game Game, level lvl) : base(Game)
        {
            game  = Game;
            level = lvl;

            PAH = new PlayerAbillityHandler(game, this);
            keyboard_oldState = Keyboard.GetState();
            enableMovement    = true;

            mouse_oldState = Mouse.GetState();
        }
Exemplo n.º 20
0
    //Builds grid based on width and height of current level
    private void buildGrid()
    {
        currentLevel = levManager.CurrentLevel;                                                       //Get level to load from level manager

        GameObject background = Instantiate(gridBG);                                                  //Instantiate background for grid

        background.transform.localScale = new Vector3(localScreenWidth * 0.9f, localScreenWidth, 1f); //Scale background down so that it only takes up 90% of screen width

        Vector3 bgSize = background.transform.localScale;                                             //Store scale of background for easier access

        GameObject gridSpace = Instantiate(gridSpacePrefab);

        //Set scale of grid space prefab to appropriate portion of grid, also factoring in border width
        gridSpace.transform.localScale = new Vector3((bgSize.x / (float)currentLevel.width) - borderWidth * bgSize.x, (bgSize.y / (float)currentLevel.height) - borderWidth * bgSize.y, 1f);

        Vector3 spaceWorldScale = gridSpace.GetComponent <SpriteRenderer>().bounds.size;               //Store size of grid space in world units
        Vector3 worldBorder     = background.GetComponent <SpriteRenderer>().bounds.size *borderWidth; //Store size of border in world units by multiplying background's size by border width percentage

        //Calculate start position from where grid spaces will spawn, this is in lower left corner and will have grid coordinates (0,0)
        Vector3 startPos = background.GetComponent <SpriteRenderer>().bounds.min + new Vector3(spaceWorldScale.x, 0, -0.5f) + (worldBorder / 2);

        background.transform.localScale *= 1.04f;                            //Increase size of background so that its outer borders are slightly larger

        gridPosition = new Vector3[currentLevel.width, currentLevel.height]; //Initialize grid position array to dimensions of grid
        GameObject newSpace;                                                 //Temporarily store grid spaces as they are spawned for each position on grid

        tileDist = new Vector2(worldBorder.x + spaceWorldScale.x, worldBorder.y + spaceWorldScale.y);

        gridSpace.transform.position = startPos;

        //Loop through all grid coordinates and spawn a new space at each one
        for (int y = 0; y < currentLevel.height; y++)
        {
            //Move gridSpace back to start of row
            gridSpace.transform.position = new Vector3(startPos.x, gridSpace.transform.position.y, -0.5f);

            for (int x = 0; x < currentLevel.width; x++)
            {
                //Instantiate a copy of gridSpace at its current position
                newSpace = Instantiate(gridSpace);
                newSpace.transform.parent = background.transform;              //Make space a child of background

                gridPosition[x, y] = newSpace.transform.position;              //Store position for grid space at these coordinates

                gridSpace.transform.position += new Vector3(tileDist.x, 0, 0); //Move gridSpace along to next x pos on grid
            }

            gridSpace.transform.position += new Vector3(0, tileDist.y, 0);//Increment y pos to next row on grid
        }

        LoadTiles(gridSpace); //Load tiles to place on board

        Destroy(gridSpace);   //Destroy gridSpace object now that done with it
    }
Exemplo n.º 21
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        lvl                = (level)GetNode("/root/level");
        velocity           = new Vector2(velocity_x, velocity_y);
        collision_shape_2d = GetNode <CollisionShape2D>("collision_shape_2d");

        CircleShape2D shape = new CircleShape2D();

        shape.Radius             = radius;
        collision_shape_2d.Shape = shape;
    }
Exemplo n.º 22
0
 private void InitializeLevelsList()
 {
     for (int i = 0; i < levels.levels.Length; i++)
     {
         level             l                 = levels.levels[i];
         GameObject        levelObject       = Instantiate(levelPrefab, levelContentGroup.transform);
         LevelSelectButton levelSelectButton = levelObject.GetComponent <LevelSelectButton>();
         levelSelectButton.level = l;
         levelSelectButton.Initialize();
     }
 }
 public ActionResult Edit(level ob)
 {
     if (ModelState.IsValid)
     {
         LevelBL.Update(ob);
         return(RedirectToAction("level"));
     }
     else
     {
         return(View());
     }
 }
Exemplo n.º 24
0
    public void LoadPrevLevel()
    {
        level PrevLevel = LevelData.getPrevLevel(SceneManager.GetActiveScene().name);

        if (PrevLevel != null)
        {
            SceneManager.LoadScene(PrevLevel.name);
        }
        else
        {
        }
    }
Exemplo n.º 25
0
 void Awake()
 {
     if (ins == null)
     {
         ins = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
     else if (ins != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 26
0
    private void Start()
    {
        mylevel  = FindObjectOfType <level>();
        session  = FindObjectOfType <gameSession>();
        mySprite = GetComponent <SpriteRenderer>();
        maxHits  = hitSprites.Length + 1;

        if (tag == "Breakable")
        {
            mylevel.countOfBlocks();
        }
    }
Exemplo n.º 27
0
        public void index()
        {
            int x;

            x = 2 + 3 + 4;
            Console.WriteLine(x);
            System.IO.File.Create("C:/hello.txt");
            Form form1 = new Form();

            form1.Text = "操作符的详解";
            //成员访问       x.y
            //1.访问子级名称空间
            //2.访问名称空间的类
            //3.访问类中的静态方法  static
            //4. 访问对象的实例成员/方法
            //5. 访问枚举成员

            //方法调用        f(x)
            //1.方法的调用必须加(),无论是否有参数
            int[] MyArray = new int[] { 1, 2, 3 };

            //元素访问      a[x]
            //1.访问数组元素
            //2.访问字典元素
            //3.元素索引不一定都是整数
            x = 100;
            int y = x++;

            Console.WriteLine(x);
            Console.WriteLine(y);

            //自增 自减    x++     x--
            //1.x++  同 x=x+1
            //2.后置++,-- 优先级特殊 先赋值 后++,--

            Type type1 = typeof(int);

            Console.WriteLine(type1.Namespace);
            Console.WriteLine(type1.FullName);
            //类型信息查询   typeof
            //
            x = default(int);
            Console.WriteLine("int的默认值是:" + x);
            level level = default(level);

            Console.WriteLine(level);
            //类型默认值     default
            //1.值类型按设定
            //2.引用类型 为null
            //3.枚举类型  对应声明时的顺序 如果声明初始化没有0元素 会出错
            //#4.结合经验,default可以拿来快速获取枚举的首元素
        }
Exemplo n.º 28
0
    // -----------------------------------------------------------------------------------------------------------------
    // STATIC
    public static tail Instantiate(tail.CConfig config, string name, path path_obj, level level_obj)
    {
        tail obj = utils.Instantiate(null, name).AddComponent <tail>();

        obj.m_config      = config;
        obj.m_level       = level_obj;
        obj.m_level_tags  = level_obj.GetTagOwner();
        obj.m_path        = path_obj;
        obj.m_segment_len = config.mesh.GetBounds().z;
        obj.m_segments    = new LinkedList <GameObject>();

        return(obj);
    }
Exemplo n.º 29
0
    public void LoadMainMenu()
    {
        level MainMenuLevel = LevelData.startLevel;

        if (MainMenuLevel != null)
        {
            SceneManager.LoadScene(MainMenuLevel.name);
            FindObjectOfType <StopWatch>().ResetTimer();
        }
        else
        {
        }
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     level obj = new level { qno = int.Parse(TextBox1.Text), que = TextBox2.Text, opA = TextBox3.Text, opB = TextBox4.Text, opC = TextBox5.Text, opD = TextBox6.Text, correct = TextBox7.Text };
     int res = level.insert(obj);
     if (res > 0)
     {
         Response.Write("<script>alert(' question is inserted successfully ')</script>");
     }
     else
     {
         Response.Write("<script>alert(' question insertion is unsuccessfull ')</script>");
     }
 }
Exemplo n.º 31
0
    public void LoadNextLevel()
    {
        level nextLevel = LevelData.getNextLevel(SceneManager.GetActiveScene().name);

        if (nextLevel != null)
        {
            LevelData.currentLevel = nextLevel;
            SceneManager.LoadScene(nextLevel.name);
        }
        else
        {
        }
    }
Exemplo n.º 32
0
        // собирает информацию обо всех уровнях в большой массив
        public static void GetLevels()
        {
            L = new level[levels + 1];
            level lev = new level();

            lev.number       = 0;
            lev.name         = "пользовательский уровень";
            lev.page         = "Для пользовательского уровня укажите текст задания, или ссылки на картинки\r\n\r\nДля выбора задания игры необходимо выбрать уровень в списке слева\r\n\r\nhttp://d2.endata.cx/data/games/24889/test_pic_1_16.jpg\r\n";
            lev.text         = lev.page;
            lev.isClose      = false;
            lev.answers_bad  = new List <string>();
            lev.answers_good = new List <string>();
            lev.sectors      = 1;
            lev.bonuses      = 1;
            lev.sector       = new string[1];
            lev.sector[0]    = "";
            lev.bonus        = new string[1];
            lev.bonus[0]     = "";
            lev.urls         = new List <string>();
            lev.urls.Add("http://d2.endata.cx/data/games/24889/test_pic_1_16.jpg");
            lev.dt              = DateTime.Now;
            lev.formlevelid     = "";
            lev.formlevelnumber = "";
            L[0] = lev;
            for (int i = 1; i <= levels; i++)
            {
                lev        = new level();
                lev.number = i;
                lev.page   = GetPageLevel(i);
                Log.Store("level_" + i.ToString(), lev.page);
                lev.name         = GetLvlName(lev.page);
                lev.isClose      = GetLvlClose(lev.page);
                lev.answers_bad  = GetLvlAnsBad(lev.page);
                lev.answers_good = GetLvlAnsGood(lev.page);
                lev.sector       = GetLvlSectors(lev.page);
                lev.sectors      = lev.sector.Length;
                lev.bonus        = GetLvlBonuses(lev.page);
                lev.bonuses      = lev.sector.Length;
                if (!lev.isClose)
                {
                    lev.formlevelid     = GetLvlFormlevelid(lev.page);
                    lev.formlevelnumber = GetLvlFormlevelnumber(lev.page);
                }

                lev.text = GetLvlText(lev.page);
                lev.urls = GetLvlUrls(lev.page);
                lev.dt   = DateTime.Now;
                L[i]     = lev;
            }
        }
Exemplo n.º 33
0
    public int levelSupplyCount(level currentLevel)
    {
        switch (currentLevel)
        {
        case level.LEVEL_TWO:
            return(1);

        case level.LEVEL_THREE:
            return(2);

        default:
            return(0);
        }
    }
 public static int insert(level e)
 {
     SqlConnection con = Open();
     SqlCommand cmd = new SqlCommand(" insert qtabel2 values(@q,@ques,@a,@b,@c,@d,@corr)", con);
     cmd.Parameters.AddWithValue("@q", e.qno);
     cmd.Parameters.AddWithValue("@ques", e.que);
     cmd.Parameters.AddWithValue("@a", e.opA);
     cmd.Parameters.AddWithValue("@b", e.opB);
     cmd.Parameters.AddWithValue("@c", e.opC);
     cmd.Parameters.AddWithValue("@d", e.opD);
     cmd.Parameters.AddWithValue("@corr", e.correct);
     int res = cmd.ExecuteNonQuery();
     con.Close();
     return res;
 }
Exemplo n.º 35
0
        static void probCore(long T, Env env)
        {
            string line = env.srd.ReadLine();
            int N = Int32.Parse(line);
            level[] l = new level[N];
            //    string[] parts = line.Split(Env.delim, StringSplitOptions.None);
            //    int A = Int32.Parse(parts[0]);
            //    int B = Int32.Parse(parts[1]);
            for (int i = 0; i < N; i++)
            {
                line = env.srd.ReadLine();
                string[] parts = line.Split(Env.delim, StringSplitOptions.None);
                l[i].a = Int32.Parse(parts[0]);
                l[i].b = Int32.Parse(parts[1]);
                l[i].c = 0;
            }

            Array.Sort(l);

            int s = 0;
            int a = 0;
            while (true)
            {
                bool flag = false;
                for (int i = 0; i < N; i++)
                {
                    if ((l[i].c < 2) && l[i].b <= s)
                    {
                        a++;
                        s = s + 2 - l[i].c;
                        l[i].c = 2;
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    continue;
                }
                for (int i = 0; i < N; i++)
                {
                    if ((l[i].c < 1) && l[i].a <= s)
                    {
                        a++;
                        s = s + 1 - l[i].c;
                        l[i].c = 1;
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    continue;
                }
                if (s >= 2 * N)
                {
                    env.swr.WriteLine("Case #{0}: {1}", T, a);
                    return;
                }
                else if (!flag)
                {
                    env.swr.WriteLine("Case #{0}: Too Bad", T);
                    return;
                }
            }

            //    env.swr.WriteLine("Case #{0}: {1}", T, xyzExp);
            //    //    for (int i = 1; i < (list.Count); i++)
            //    //    {
            //    //        if ((lastPrint != list[i])
            //    //            && (list[i - 1] == list[i]))
            //    //        {
            //    //            flag = true;
            //    //            lastPrint = list[i];
            //    //            env.swr.Write(" {0}", lastPrint);
            //    //        }
            //    //    }
            //    //    if (!flag)
            //    //    {
            //    //        env.swr.Write(" NONE", T);
            //    //    }
            //    //env.swr.WriteLine();
        }
Exemplo n.º 36
0
        private static void ShowMenu(level l)
        {
            Console.Clear();
            switch (l)
            {
                case level.level0:
                    Console.WriteLine("************* Меню **************");
                    Console.WriteLine("Инфомация по двумерным фигурам --> 1");
                    Console.WriteLine("Информация по объемным фигурам --> 2");
                    Console.WriteLine("Выход                          --> 0");
                    Levels(l, level.level1, level.level2, level.exit); break;
                case level.level1:
                    Console.Clear();
                    Console.WriteLine("************* Плоскостные фигуры **************");
                    Console.WriteLine("Информация о квадрате          --> 1");
                    Console.WriteLine("Информация о прямоугольнике    --> 2");
                    Console.WriteLine("Информация о круге             --> 3");
                    Console.WriteLine("Переход на предыдущее меню     --> 0");
                    Levels(l, level.square, level.rectangle, level.round, level.level0); break;
                case level.level2:
                    Console.Clear();
                    Console.WriteLine("************* Объемные фигуры **************");
                    Console.WriteLine("Информация о кубе              --> 1");
                    Console.WriteLine("Информация о параллелепипеде   --> 2");
                    Console.WriteLine("Информация о шаре              --> 3");
                    Console.WriteLine("Переход на предыдущее меню     --> 0");
                    Levels(l, level.cube, level.cuboid, level.ball, level.level0); break;
                case level.square:
                    Square square = new Square();
                    square.ShowInfo();
                    square.ShowArea();
                    //#dev
                    Console.WriteLine("Отрисовать? Y/N");
                    string com = Console.ReadLine();
                    if (com == "Y")
                        square.Draw();
                    Console.ReadLine();
                    ShowMenu(level.level1);
                    break;
                case level.rectangle:
                    MyRectangle rectangle = new MyRectangle();
                    rectangle.ShowInfo();
                    rectangle.ShowArea();
                    //#dev
                    Console.WriteLine("Отрисовать? Y/N");
                    com = Console.ReadLine();
                    if (com == "Y")
                        rectangle.Draw();
                    Console.ReadLine();
                    ShowMenu(level.level1);
                    break;
                case level.round:
                    Round round = new Round();
                    round.ShowInfo();
                    round.ShowArea();
                    //#dev
                    Console.WriteLine("Отрисовать? Y/N");
                    com = Console.ReadLine();
                    if (com == "Y")
                        round.Draw();
                    Console.ReadLine();
                    ShowMenu(level.level1);
                    break;
                case level.cube:
                    Cube cube = new Cube();
                    cube.ShowInfo();
                    cube.ShowVolume();
                    //#dev
                    Console.WriteLine("Отрисовать? Y/N");
                    com = Console.ReadLine();
                    if ( com == "Y")
                        cube.Draw();

                    Console.ReadLine();
                    ShowMenu(level.level2);
                    break;
                case level.cuboid:
                    Cuboid cuboid = new Cuboid();
                    cuboid.ShowInfo();
                    cuboid.ShowVolume();
                    //#dev
                    Console.WriteLine("Отрисовать? Y/N");
                    com = Console.ReadLine();
                    if (com == "Y")
                        cuboid.Draw();

                    Console.ReadLine();
                    ShowMenu(level.level2);
                    break;
                case level.ball:
                    Ball ball = new Ball();
                    ball.ShowInfo();
                    ball.ShowVolume();
                    //#dev
                    Console.WriteLine("Отрисовать? Y/N");
                    com = Console.ReadLine();
                    if (com == "Y")
                        ball.Draw();

                    Console.ReadLine();
                    ShowMenu(level.level2);
                    break;
                case level.exit: break;
                default: Console.WriteLine("Уровень не существует"); break;
            }
        }