Exemple #1
0
    private void Awake()
    {
        MasterScript.ScriptReferences();
        mapSize = PlayerPrefs.GetInt("Map Size");
        PlanetRead();
        SystemRead();
        HeroTechTree.ReadTechFile();
        SelectSystemsForMap();
        CheckSystem();
        CreateObjects();
        MasterScript.mapConstructor.DrawMinimumSpanningTree();

        //voronoiGenerator.CreateVoronoiCells ();

        ambientStars = GameObject.Find("ScriptsContainer").GetComponent <AmbientStarRandomiser> ();
        ambientStars.GenerateStars();

        LoadBasicTechTree();

        for (int i = 0; i < systemList.Count; ++i)
        {
            LineRenderScript lineRenderScript = systemList[i].systemObject.GetComponent <LineRenderScript>();

            lineRenderScript.StartUp();
        }

        //systemPopup.LoadOverlays ();

        MasterScript.galaxyGUI.SelectRace(PlayerPrefs.GetString("Player Race"));
        loaded = true;
    }
    public GameObject DrawDebugLine(Vector3 start, Vector3 end, Material mat)
    {
        float distance = Vector3.Distance(start, end);

        Vector3 vectRotation = new Vector3(0.0f, 0.0f, MathsFunctions.RotationOfLine(start, end) - 90f);

        Quaternion rotation = new Quaternion();

        rotation.eulerAngles = vectRotation;

        Vector3 midPoint = (start + end) / 2;                  //Get midpoint between target and current system

        midPoint = new Vector3(midPoint.x, midPoint.y, -2.0f); //Create vector from midpoint

        LineRenderScript lineRenderScript = MasterScript.systemListConstructor.systemList[0].systemObject.GetComponent <LineRenderScript>();

        GameObject line = (GameObject)Instantiate(lineRenderScript.line, midPoint, rotation);

        line.renderer.material = mat;

        float width = 0.20f;

        if (mat == MasterScript.turnInfoScript.humansMaterial || mat == MasterScript.turnInfoScript.selkiesMaterial)
        {
            width = 0.1f;
        }

        line.transform.localScale = new Vector3(width, distance, 0f);

        return(line);
    }