Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            loaded = true;
            Setting();
            GLCube CubeTest = new GLCube(40);

            List1 = CubeTest.List();
        }
Exemplo n.º 2
0
 public override void Erase()
 {
     if (cube != null)
     {
         cube.Destroy();
         cube = null;
     }
     for (int i = 0; i < cubePlacements.Count; i++)
     {
         cubePlacements[i].Destroy();
     }
     cubePlacements.Clear();
     base.Erase();
 }
Exemplo n.º 3
0
 public override void Construct(Vector3 point, int currentPointValue,WorkType wType)
 {
     base.Construct(point, currentPointValue, wType);
     if (ValidateWorkForQueue(currentPointValue))
     {
         if (GameManager.actionManager.ApplyWork(this))
         {
             Color col = wType.getColor();
             col.a = 0.4f;
             cube = new GLCube(point, Vector3.one, col, this);
         }
     }
     else
     {
         GameManager.actionManager.CancelPendingWork();
     }
 }
Exemplo n.º 4
0
 public void simpleConstruct(Vector3 point, WorkType wType)
 {
     cubePoint = point;
     workType = wType;
     if (GameManager.actionManager.ApplyWork(this))
     {
         Color col = wType.getColor();
         col.a = 0.4f;
         cube = new GLCube(point, Vector3.one, col, this);
     }
 }
Exemplo n.º 5
0
 public override void Erase()
 {
     if (cube != null)
     {
         cube.Destroy();
         cube = null;
     }
     base.Erase();
 }
Exemplo n.º 6
0
 public void AddSpawnLocation(Vector3 point)
 {
     GLCube cube = new GLCube(point, Vector3.one, Color.green,40.0f);
 }
Exemplo n.º 7
0
        protected bool WideRangeTest()
        {
            Stopwatch getValueTimer = new Stopwatch();
            Stopwatch setValueTimer = new Stopwatch();
            Stopwatch timer = new Stopwatch();
            timer.Start();
            Vector3 tempv = new Vector3();

            sbyte val;
            int successfullSetValues = 0;
            for (int x = 0; x < 36; x++)
            {
                //int y = 0;
                //int z = 0;
                for (int y = 0; y < 36; y++)
                {
                    for (int z = 0; z < 36; z++)
                    {
                        tempv.x = x * 1;
                        tempv.y = y * 1;
                        tempv.z = z * 1;
                        getValueTimer.Start();
                        val = testTree.GetValueAt(tempv);
                        getValueTimer.Stop();

                        if (val <= 0)
                        {
                            setValueTimer.Start();
                            testTree.SetValueAtPoint(tempv, 33);
                            setValueTimer.Stop();

                            if (testTree.GetValueAt(tempv) != 33)
                            {
                                DebugOutput.Shout("failValue " + tempv.ToString());
                                DebugOutput.Shout("failValue " + testTree.GetValueAt(tempv).ToString());
                                SubHybridTree subtree = ((HybridTree)testTree).GetSubTree(tempv);

                                DebugOutput.Shout(subtree.GetPosition().ToString());

                                GLCube cube = new GLCube(tempv, Vector3.one, Color.red, this);
                               // DebugOutput.Shout("failValue");

                                goto finishedRange;
                            }
                            else
                            {
                                successfullSetValues++;
                            }
                        }
                    }
                }
            }
            finishedRange:

            timer.Stop();
            DebugOutput.Shout(timer.ElapsedMilliseconds + " milliseconds to test tree with " + successfullSetValues.ToString() + " values set");
            DebugOutput.Shout(setValueTimer.ElapsedMilliseconds + " milliseconds to setvalues ");
            DebugOutput.Shout(getValueTimer.ElapsedMilliseconds + " milliseconds to getValueTimer ");
            return false;
        }
Exemplo n.º 8
0
    protected virtual void Awake()
    {
        if (GameManager.canvasManager != null)
        {

            Transform t = GameManager.canvasManager.GetSubMenu("ActionSelector");
            if (t != null)
            {

                menu = t.GetComponent<ActionSelectorMenu>();
                if (menu != null)
                {
                    menu.manager = this;
                    DebugOutput.Shout("WorkManager# ActionSelectorMenu is acquired");

                }
            }
        }
        workManager = GameManager.workManager;
        workType = WorkerPrefabCollection.prefabCollection.WorkGroups[0];
        workBrush = Vector3.one;
        brushCube = new GLCube(CameraNavigator.focusPoint, workBrush, Color.white, this);

        workTypes = WorkerPrefabCollection.prefabCollection.WorkGroups;

        /*
        if (!safetyCheck())
        {
            DebugOutput.Shout("Killing this gameObject " + name);
            GameObject.Destroy(gameObject);
        }*/
        SetWorkType(actionType);
    }
Exemplo n.º 9
0
    public void GenerateStartField(float size, onGeneratedStartField ex)
    {
        Vector3 startPoint = new Vector3();
        TaskPool.QueueTask(() =>
        {
            Vector3 lowestPoint = startPoint;
            AquariaTerrainGenerator tgen = new AquariaTerrainGenerator(worldGenerator);

            for (float f = -50; f < 50; f++)
            {
                startPoint.x = f;
                startPoint.y = tgen.GetGroundHeight(startPoint);
                if (startPoint.y < lowestPoint.y)
                {
                    lowestPoint = startPoint;
                }
            }
            for (float f = -50; f < 50; f++)
            {
                startPoint.z = f;
                startPoint.y = tgen.GetGroundHeight(startPoint);
                if (startPoint.y < lowestPoint.y)
                {
                    lowestPoint = startPoint;
                }
            }
            startPoint = lowestPoint;
            DebugOutput.Shout(startPoint.ToString());
        }, () => {
            GLCube cubeG = new GLCube(startPoint, Vector3.one + Vector3.up, Color.cyan,this);
            ex(startPoint);
        });
    }
Exemplo n.º 10
0
 public void simpleConstruct(Vector3 point, WorkType wType,SurveyProject project)
 {
     surveyProject = project;
     cubePoint = point;
     //surveyProject.AddProbeToQueue(this);
     workType = wType;
     if (GameManager.actionManager.ApplyWork(this))
     {
         Color col = wType.getColor();
         col.a = 0.4f;
         cube = new GLCube(point, Vector3.one, col, this);
     }
 }
Exemplo n.º 11
0
    protected override void Awake()
    {
        base.Awake();

        secondaryBrush = new GLCube(Vector3.one, Vector3.one, Color.green, this);
        SetSecondaryBrushSizeAndPos(Vector3.zero, Vector3.zero);
        indoorActionHandler = new AIndoorActionTypeHandler(1);

        actionHandlers = new List<AActionTypeHandler>();
        actionHandlers.Add(new ALandscapingActionType(0, UtilityColor.Purple, "landscaping mode"));
        actionHandlers.Add(new AIndoorActionTypeHandler(0, Color.green, "construction mode"));
        actionHandlers.Add(new AActionTypeHandler(2, Color.blue, "Decorationmode"));
        UpdateActionType();
    }
Exemplo n.º 12
0
 void RegisterMiningWork(MiningWork work)
 {
     AddMineralToDivision(work.pointValue);
     GLCube glCube = new GLCube(work.cubePoint, Vector3.one, UtilityColor.HexToColor(
         "ff9428"), 2.5f, true);
     PendingOfflineTimer = float.MaxValue;
     RegisterWork(work);
 }
Exemplo n.º 13
0
    protected override void SetPointObjectValue(Vector3 point, sbyte value)
    {
        GLCube pointcube = new GLCube(point, new Vector3(0.9f, 0.9f, 0.9f), Color.green, 400.0f);
        return;
        int index = worldTree.GetIndexAtWorldPoint(point);
        if (worldTree.GetValueAt(index) == value)
        {
            return;
        }
        PointObject po = null;

        PointObjectPrefab poType = PointObjectPrefabCollection.GetPointObjectDataType(value);
        if (poType.baseElement)
        {
            //look for neighboring pointObjects
            Vector3 offset;
            for (int i = -1; i < 2; i++)
            {
                for (int j = -1; j < 2; j++)
                {
                    for (int k = -1; k < 2; k++)
                    {
                        offset = point;
                        offset.x += i;
                        offset.y += j;
                        offset.z += k;

                        if (offset != point)
                        {
                            int jndex = worldTree.GetIndexAtWorldPointSimple(offset);
                            if (worldTree.GetValueAt(jndex) == value)
                            {
                                po = worldTree.GetObjectAt(jndex);
                                if (!po.isFull())
                                {
                                    po.AddSubPoint(point);
                                    goto AddedSub;
                                }
                                else
                                {
                                    po = null;
                                }
                            }

                        }
                    }
                }
            }
            if (po == null)
            {
                po = new PointObject((int)value, point);
            }

        }
        else
        {
            po = new PointObject((int)value, point);

        }
        AddedSub:

        worldTree.SetObjectValue(index, po);
        worldTree.SetValueAtIndex(index, value);
    }