Exemple #1
0
    public PartsHolder(int _numParts, string loadPath, byte[] loadData = null)
    {
        holder = this;

        InitializeGameArea initArea = new InitializeGameArea();

        Environment environment;

        if (loadPath != null)
        {
            environment = ImplementWasp.Initialize(loadPath);
        }
        else
        {
            environment = ImplementWasp.Initialize(null, loadData);
        }

        minX = environment.GameArea.minX;
        maxX = environment.GameArea.maxX;

        minY = environment.GameArea.minZ;
        maxY = environment.GameArea.maxZ;

        minZ = environment.GameArea.minY;
        maxZ = environment.GameArea.maxY;

        TIExportField.Resolution = environment.FieldResolution;

        GlobalReferences.TemplateParts = ImplementWasp.Load();

        Debug.Log("Template Parts:" + GlobalReferences.TemplateParts.Count + " Parts were loaded");

        floor = GameObject.Find("Floor");
        floor.transform.position = new Vector3(0, minY, 0);
        floor.SetActive(environment.GroundPlane);

        GameObject areaProxy = GameObject.Find("GameAreaProxy");

        if (areaProxy != null)
        {
            areaProxy.GetComponent <GameAreaProxy>().Initialize(new Region(minX, maxX, minY, maxY, minZ, maxZ));
        }

        initArea.Initialize(minX, maxX, minY, maxY, minZ, maxZ, ConnectionScanning.ConnectionThreshold * 1.5f, ComputeColGridSize());

        numParts = _numParts;

        SpawnMultiple(NumParts);
    }
Exemple #2
0
    //MonoBehaviour methods - Initializes Game Beginning
    #region
    public void Initialize(float _minX, float _maxX, float _minY, float _maxY, float _minZ, float _maxZ, string loadPath, int _numParts)
    {
        minX = _minX;
        maxX = _maxX;

        minY = _minY;
        maxY = _maxY;

        minZ = _minZ;
        maxZ = _maxZ;

        if (loadPath == "")
        {
            loadPath = (Application.dataPath + "/Resources/WaspInput.json");
        }

        GlobalReferences.TemplateParts = ImplementWasp.Load(loadPath);

        numParts = _numParts;
        SpawnMultiple(NumParts);
    }