Esempio n. 1
0
    void Start()
    {
        if (Screen.height / (Screen.width / 9) > 16)
        {
            for (int i = 0; i < borders.Count; ++i)
            {
                ScreenOptimization.fix18_9(borders[i]);
            }

            for (int i = 0; i < stringColliders.Count; ++i)
            {
                ScreenOptimization.fix18_9(stringColliders[i]);
            }

            for (int i = 0; i < strings.Count; ++i)
            {
                ScreenOptimization.fix18_9(strings[i]);
            }

            for (int i = 0; i < borderHolders.Count; ++i)
            {
                ScreenOptimization.fix18_9(borderHolders[i]);
            }
        }
    }
Esempio n. 2
0
    //загрузка цвета стенок
    public void loadNeon(string key)
    {
        TextAsset textAsset = (TextAsset)Resources.Load("XML/Game/levelData");
        XElement  xdoc      = XDocument.Parse(textAsset.text).Element("levelData");

        foreach (XElement diff in xdoc.Elements(key))
        {
            //стенки ворот
            for (int i = 1; i <= 2; ++i)
            {
                gate.transform.GetChild(i).GetComponent <Image>().material = Resources.Load <Material>("Sprites/Materials/Borders/" + diff.Element("gate").Value.ToString());
            }

            //верхняя и нижняя стенки
            for (int i = 0; i < 2; ++i)
            {
                borders.transform.GetChild(i).GetComponent <Image>().material = Resources.Load <Material>("Sprites/Materials/Borders/" + diff.Element("topBorders").Value.ToString());
            }

            //левая и правая стенки
            for (int i = 2; i < 4; ++i)
            {
                borders.transform.GetChild(i).GetComponent <Image>().material = Resources.Load <Material>("Sprites/Materials/Borders/" + diff.Element("sideBorders").Value.ToString());
            }

            //верхняя и нижняя нитка
            for (int i = 0; i < 2; ++i)
            {
                strings[i].transform.GetComponent <LineRenderer>().material = Resources.Load <Material>("Sprites/Materials/Borders/" + diff.Element("string").Value.ToString());
            }
        }

        ScreenOptimization.setNeonRadius(MainCamera);
    }
Esempio n. 3
0
    private void Start()
    {
        AIString = GameObject.FindGameObjectWithTag("UpString").GetComponent <BezierLine>();
        game     = GameObject.FindGameObjectWithTag("Game").GetComponent <Game>();
        gate     = game.gate.GetComponent <Gate>();

        active = false;

        Difficulty diff = new Difficulty();

        /*if (!XMLManager.LoadData<Difficulty>(ref diff, "settings"))
         * {
         *    XMLManager.LoadDifficulty(ref diff, "begginer");
         *    XMLManager.SaveData<Difficulty>(diff, "settings");
         * }*/

        XMLManager.LoadDifficulty(ref diff, (GameRule.globalDiff ? GameRule.difficulties + 2 : GameRule.difficulties).ToString());

        speedAI    = diff.speedAI;
        accuracyAI = diff.accuracyAI;
        timeRest   = diff.timeRest;

        accuracyAI /= 2;
        upBorder    = ScreenOptimization.GetWorldCoord2D(gameObject).first.y;
        dispersion  = Camera.main.ScreenToWorldPoint(new Vector2(accuracyAI * Screen.width, 0)).x + Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, 0)).x;
    }
Esempio n. 4
0
    void Start()
    {
        // Границы поля
        Pair <Vector2, Vector2> points;

        points           = ScreenOptimization.GetWorldCoord2D(leftBorderHolder);
        playerDownBorder = new Border(
            points.first.y - radius,
            points.second.y + radius,
            points.first.x + radius,
            points.second.x - radius);

        points         = ScreenOptimization.GetWorldCoord2D(rightBorderHolder);
        playerUpBorder = new Border(
            points.first.y - radius,
            points.second.y + radius,
            points.first.x + radius,
            points.second.x - radius);
    }
Esempio n. 5
0
    void Start()
    {
        // Установка двух крайних опорных точек для прорисовки линии
        coordY = transform.position.y;
        Pair <Vector2, Vector2> coords = ScreenOptimization.GetWorldCoord2D(gameObject);

        startPoint = new Vector2(coords.first.x, transform.position.y);
        endPoint   = new Vector2(coords.second.x, transform.position.y);

        // Прорисовка
        Bezier = this.GetComponent <LineRenderer>();

        // Подсчет коррекции
        correction = coords.first.y - coords.second.y;
        if (!DownString)
        {
            correction = -correction;
        }

        correctionForEdge = Camera.main.WorldToScreenPoint(new Vector2(startPoint.x, 0.5f * correction)).y - Screen.height / 2;
        checker           = null;

        drawCalm();
    }