Exemple #1
0
    public static Vector4[] GeneratePointsScattered(float minX, float minZ, uint amount, float offset = 0)
    {
        float maxX = (gridUtils.Grid.TileHeight + gridUtils.Sidelength) * gridUtils.Grid.Size * .5f + gridUtils.Sidelength * .5f;
        float maxZ = gridUtils.Grid.TileWidth * gridUtils.Grid.Size + gridUtils.Grid.TileWidth * .5f;

        Vector4[] points = new Vector4[amount];
        uint      hid = 0;
        float     x, z;

        for (uint i = 0; i < amount; i++)
        {
            int failsave = 100;

            do
            {
                x = Random.Range(minX, maxX);
                z = Random.Range(minZ, maxZ);


                failsave--;
            }while (failsave > 0 && !GridMaster.WithinGridConfinesAccurate(new Vector2(x, z), out hid));
            if (failsave <= 0)
            {
#if UNITY_EDITOR
                Debug.LogError($"Point Scattered exited while loop on failsave condition for {new Vector2( x, z ) }");
#endif
            }

            points[i] = new Vector4(x, 0, z, hid);
        }

        return(points);
    }
    // Use this for initialization
    void OnEnable()
    {
        GameObject bmGO = GameObject.FindWithTag("Music");

        m_pBeatMaster = bmGO.GetComponent <BeatMaster>();
        m_fSpeed      = m_pBeatMaster.getDiscoPeteSpeedDependingOnMusic();

        GameObject gmGO = GameObject.FindWithTag("GridMaster");

        m_pGridMaster = gmGO.GetComponent <GridMaster>();
        m_pGridMaster.SetDiscoPeteToStart();

        m_pBeatMaster.beatEvent += BeatMasterOnBeatEvent;
        m_pBeatMaster.onJumpChancePassedEvent += BeatMasterOnJumpChancePassedEvent;

        m_pAnimator = GetComponent <Animator>();
        m_pAnimator.SetFloat(JUMP_DURATION, m_fSpeed);
        m_pAnimator.SetFloat(SPEED, m_pBeatMaster.songInfo.Bps);

        GameObject lapGO = GameObject.FindWithTag("LevelAndPointMaster");

        m_pLevelAndPointMaster = lapGO.GetComponent <LevelAndPointBehaviour>();

        if (m_pLevelAndPointMaster == null)
        {
            Debug.Log("DiscoPeteBehaviour: LevelAndPointMaster not found!");
        }
    }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     mainCam    = GameObject.Find("Main Camera");
     readout    = GameObject.Find("Readout");
     myMaster   = mainCam.GetComponent <GridMaster> ();
     myC        = GameObject.Find("Controller").GetComponent <Controller> ();
     myTimer    = GameObject.Find("Timer").GetComponent <TimeChange>();
     faceSprite = GameObject.Find("CharacterFace").GetComponent <SpriteRenderer>();
 }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        mainCam  = GameObject.Find("Main Camera");
        myMaster = mainCam.GetComponent <GridMaster> ();
        int randCol1 = Random.Range(0, 7);
        int randCol2 = Random.Range(0, 7);

        col1 = myMaster.colorPalette [randCol1];
        col2 = myMaster.colorPalette [randCol2];
        //this.GetComponent<TextMesh>().text =
    }
Exemple #5
0
 protected void GridMaster_DetailRowExpandedChanged(object sender, ASPxGridViewDetailRowEventArgs e)
 {
     if (e.Expanded)
     {
         var          b       = (HiddenField)GridMaster.FindDetailRowTemplateControl(e.VisibleIndex, "hRouteId");
         ASPxGridView grid    = (ASPxGridView)GridMaster.FindDetailRowTemplateControl(e.VisibleIndex, "GridSlave");
         int          routeId = int.Parse(b.Value);
         grid.KeyFieldName = "RateID";
         grid.DataSource   = bl.GetRatesAndBreaks(routeId);
         grid.DataBind();
     }
 }
Exemple #6
0
    protected void goBtn_Click(object sender, ImageClickEventArgs e)
    {
        bl.ClearRateRoutings();

        if (ComboCompanyList.Value != null)
        {
            customer_org_num = int.Parse(ComboCompanyList.Value.ToString());
        }
        rate_type = int.Parse(ddlRateType.SelectedValue);
        bl.SetParms(elt_account_number, customer_org_num, rate_type);
        GridMaster.DataBind();
        GridMaster.Visible = true;
        HideShowColumns(GridMaster);
    }
Exemple #7
0
    protected virtual void Start()
    {
        initPos = transform.position;

        if (registerInGrid)
        {
            m_iXPosInGrid = Mathf.FloorToInt(transform.position.x + 0.5f);
            m_iZPosInGrid = Mathf.FloorToInt(transform.position.z + 0.5f);

            //Debug.Log("GridTile::Start (" + m_iXPosInGrid + "," + m_iZPosInGrid + ")");
            GameObject gmGO = GameObject.FindWithTag("GridMaster");
            gridMaster = gmGO.GetComponent <GridMaster>();

            gridMaster.RegisterTile(this, m_iXPosInGrid, m_iZPosInGrid);
        }
    }
Exemple #8
0
    private void Update()
    {
        GridMaster gm = GridMaster.Instance;

        CalculateStartEndPosJob calcStartEndJob = new CalculateStartEndPosJob()
        {
            gridBoundsCenter  = gm.Bounds.center,
            gridBoundsExtents = gm.Bounds.extents,
            nodeSize          = GridMaster.NodeSize,
            isGridCreated     = gm.IsGridCreated,
            gridWidth         = gm.GridWidth,

            endPositionsToChooseFrom = endPositionsToChooseFrom,

            startPositionsIndices = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory),
            endPositionsIndices   = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory),
            rand = new Random(0x6E624EB7u)
        };

        JobHandle calcStartEndHandle = calcStartEndJob.Schedule(agentsTransAcc);

        FindPathJobParallel findPathsJob    = new FindPathJobParallel(gm.GridWidth * gm.GridDepth, gm.GridWidth, 4, calcStartEndJob.startPositionsIndices, calcStartEndJob.endPositionsIndices, gm.NodesNeighbors, gm.NodesTypes, quantity);
        JobHandle           findPathsHandle = findPathsJob.Schedule(quantity, 4, calcStartEndHandle);

        MoveAgentsJob moveJob = new MoveAgentsJob()
        {
            nodeIndicesDestinations = findPathsJob.nextNodesIndices,
            nodes = gm.NodesTransforms,
            speed = agentsSpeed,
            dt    = Time.deltaTime
        };

        JobHandle moveHandle = moveJob.Schedule(agentsTransAcc, findPathsHandle);

        UpdateCamPivot();

        moveHandle.Complete();

        findPathsJob.Dispose();
        calcStartEndJob.Dispose();

        if (Keyboard.current.escapeKey.wasPressedThisFrame)
        {
            Application.Quit();
        }
    }
    private void ItlFindObjects()
    {
        Debug.Log("LevelAndPointBehaviour::ItlFindObjects");

        GameObject guiGO = GameObject.FindWithTag("GUIMaster");

        m_pGUIMaster = guiGO.GetComponent <GUIMaster>();
        m_pGUIMaster.HideText();

        GameObject dpGO = GameObject.FindWithTag("DiscoPete");

        m_pDiscoPete = dpGO.GetComponent <DiscoPeteBehaviour>();

        GameObject gmGO = GameObject.FindWithTag("GridMaster");

        m_pGridMaster = gmGO.GetComponent <GridMaster>();

        GameObject bmGO = GameObject.FindWithTag("Music");

        m_pBeatMaster            = bmGO.GetComponent <BeatMaster>();
        m_pBeatMaster.beatEvent += OnBeat;

        if (m_pGUIMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: GUIMaster not found");
        }

        if (m_pDiscoPete == null)
        {
            Debug.Log("LevelAndPointBehaviour: DiscoPeteBehaviour not found");
        }

        if (m_pGridMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: GridMaster not found");
        }

        if (m_pBeatMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: BeatMaster not found");
        }
    }
Exemple #10
0
 void Awake()
 {
     tiles = GameObject.Find("Grid").GetComponent <GridMaster>();
     StartCoroutine("PathMovement");
 }
Exemple #11
0
        public List <SimObject> GetSingleArg(string[] splitted, out int argsUsed)
        {
            if (splitted.Length == 0)
            {
                argsUsed = 0;
                return(new List <SimObject>());
            }
            SimObject prim;
            UUID      uuid = UUID.Zero;
            string    name = splitted[0].Trim().Replace("  ", " ");

            if (name.IndexOf("-") > 2 && UUID.TryParse(name, out uuid))
            {
                prim     = GetSimObjectFromUUID(uuid);
                argsUsed = 1;
                return(PrimOrNot(prim));
            }
            var resolve = name.ToLower();

            /*
             * if (resolve.Equals("pointing") || resolve.Equals("it"))
             * {
             *  argsUsed = 1;
             *  if (!client.TheRadegastInstance.State.IsPointing)
             *  {
             *      prim = null;
             *      return false;
             *  }
             *  prim = GetPrimitive(client.TheRadegastInstance.State.TargetID, null);
             *  return prim != null;
             * }
             */
            foreach (string primid in new[] { "primid", "lid" })
            {
                if (resolve.StartsWith(primid))
                {
                    int tl = primid.Length;
                    if (name.Length > tl)
                    {
                        String s = name.Substring(tl);
                        uint   localID;
                        if (uint.TryParse(s, out localID))
                        {
                            prim     = GetSimObject(localID, null);
                            argsUsed = 1;
                            return(PrimOrNot(prim));
                        }
                    }
                }
            }
            if (name.StartsWith("@"))
            {
                int splitOffset = 0;
                name = name.Substring(1);
                if (name.Length == 0)
                {
                    splitOffset = 1;
                    splitted    = Parser.SplitOff(splitted, 1);
                }
                else
                {
                    splitted[0] = name;
                }
                int         argsUsed0;
                SimPosition position = GetVector(splitted, out argsUsed0);
                if (argsUsed0 == 0)
                {
                    argsUsed = splitOffset;
                    prim     = null;
                    return(PrimOrNot(prim));
                }
                double dist;
                prim     = GetSimObjectFromVector(position.GlobalPosition, out dist);
                argsUsed = argsUsed0 + splitOffset;
                if (dist > 2)
                {
                    prim = null;
                }
                return(PrimOrNot(prim));
            }

            if (name.StartsWith("$"))
            {
                return(ResolveCollection(name, out argsUsed));
            }
            if (name.StartsWith("["))
            {
                var fnd = GetUnion(Parser.SplitOff(splitted, 1), out argsUsed);
                argsUsed++;
                if (argsUsed < splitted.Length)
                {
                    string t = splitted[argsUsed];
                    if (t == "]")
                    {
                        argsUsed++;
                    }
                }
                return(fnd);
            }
            if (name == "+")
            {
                var fnd = GetSingleArg(Parser.SplitOff(splitted, 1), out argsUsed);
                argsUsed++;
                return(fnd);
            }
            if (name.StartsWith("("))
            {
                argsUsed = 1;
                var result = GridMaster.client.evalLispCode(name);
                var acol   = SingleNameValue.AsCollection(result);
                if (acol == null)
                {
                    argsUsed = 0;
                }
                var fnd = new List <SimObject>();
                GridMaster.AsPrimitives(fnd, acol);
                return(fnd);
            }

            int nth;

            if (int.TryParse(name, out nth))
            {
                nth--;
                splitted = Parser.SplitOff(splitted, 1);
                List <SimObject> fnd = null;
                if (splitted.Length == 0)
                {
                    argsUsed = 1;
                    fnd      = SimRootObjects.CopyOf();
                }
                else
                {
                    fnd = GetSingleArg(splitted, out argsUsed);
                }
                if (fnd == null)
                {
                    return(fnd);
                }
                if (nth >= fnd.Count)
                {
                    nth = fnd.Count - 1;
                }
                if (nth < 0)
                {
                    return(null);
                }
                if (m_TheSimAvatar != null)
                {
                    fnd.Sort(((SimObject)m_TheSimAvatar).CompareDistance);
                }
                return(new List <SimObject>()
                {
                    fnd[nth]
                });
            }

            int len = splitted.Length;

            if (len > 1)
            {
                len = 2;
            }
            string largs = name.Replace("_", " ");

            if (largs.Contains(" "))
            {
                len = 1;
            }
            argsUsed = 0;
            for (int i = len; i > 0; i--)
            {
                var fnd = new List <SimObject>();
                name = string.Join(" ", splitted, 0, i);
                foreach (var o in SimObjects)
                {
                    if (o.Matches(name))
                    {
                        fnd.Add(o);
                        argsUsed = i;
                    }
                }
                if (fnd.Count > 0)
                {
                    return(fnd);
                }
            }
            return(null);
        }
Exemple #12
0
 void Awake()
 {
     getTiles  = GameObject.Find("Grid").GetComponent <GridMaster>();
     thisTower = gameObject.GetComponent <Transform>();
 }
Exemple #13
0
 void Awake()
 {
     tileLocation = GetComponent <GridMaster>();
 }
        static UUIDGleaner GetUUIDGleaner(string p, MemberInfo info)
        {
            lock (UUID2Type)
                if (UUID2Type.Count == 0)
                {
                    UUIDGleaner texture  = ((obj, sim) => { SimAssetStore.FindOrCreateAsset(obj, AssetType.Texture); });
                    UUIDGleaner avatar   = ((obj, sim) => { GridMaster.DeclareAvatarProfile(obj); });
                    UUIDGleaner task     = ((obj, sim) => { GridMaster.DeclareTask(obj, sim); });
                    UUIDGleaner nothing  = ((obj, sim) => { });
                    UUIDGleaner objectID = ((obj, sim) => { GridMaster.CreateSimObject(obj, GridMaster, sim); });
                    UUIDGleaner role     = ((obj, sim) => DeclareGeneric("GroupRole", obj, " +p"));
                    UUID2Type[""]          = nothing;
                    UUID2Type["ID"]        = nothing;
                    UUID2Type["Sound"]     = ((obj, sim) => { SimAssetStore.FindOrCreateAsset(obj, AssetType.Sound); });
                    UUID2Type["Gesture"]   = ((obj, sim) => { SimAssetStore.FindOrCreateAsset(obj, AssetType.Gesture); });
                    UUID2Type["Landmark"]  = ((obj, sim) => { SimAssetStore.FindOrCreateAsset(obj, AssetType.Landmark); });
                    UUID2Type["Animation"] = ((obj, sim) => { SimAssetStore.FindOrCreateAsset(obj, AssetType.Animation); });
                    UUID2Type["Clothing"]  = ((obj, sim) => { SimAssetStore.FindOrCreateAsset(obj, AssetType.Clothing); });
                    UUID2Type["Region"]    = ((obj, sim) => { RegisterUUIDMaybe(obj, typeof(SimRegion)); });
                    UUID2Type["Estate"]    = ((obj, sim) => { RegisterUUIDMaybe(obj, typeof(EstateAssetType)); });
                    UUID2Type["Image"]
                                           = UUID2Type["SculptTexture"]
                                           = UUID2Type["Photo"]
                                           = UUID2Type["Insignia"]
                                           = UUID2Type["Picture"]
                                           = UUID2Type["Texture"]
                                           = UUID2Type["Sculpt"]
                                           = UUID2Type["ProfileImage"] = texture;
                    UUID2Type["Owner"]     = UUID2Type["Partner"] = UUID2Type["Creator"] = UUID2Type["Founder"] = avatar;
                    UUID2Type["Group"]     = ((obj, sim) => { GridMaster.DeclareGroup(obj); });
                    UUID2Type["Object"]    = objectID;
                    UUID2Type["Primitive"] = objectID;
                    // todo inventory item
                    UUID2Type["OwnerRole"] = role;
                    UUID2Type["FromTask"]  = task;
                    UUID2Type["FolderID"]  = nothing;
                    UUID2Type["ItemID"]    = nothing;
                    // ussualyl objects but need to confirm: The Key of the specified target object or avatar particles will follow"
                    UUID2Type["Target"] = nothing;
                    UUID2Type["Asset"]  = nothing;
                }
            UUIDGleaner o;

            lock (UUID2Type)
            {
                if (UUID2Type.TryGetValue(p, out o))
                {
                    return(o);
                }
                foreach (var s in new[] { "From", "To", "Next", "Last", "First", "Second", "Life", "Life", })
                {
                    if (p.StartsWith(s))
                    {
                        return(UUID2Type[p] = GetUUIDGleaner(p.Substring(s.Length), info));
                    }
                }
                foreach (var s in new[] { "ID", "UUID", "Asset" })
                {
                    if (p.EndsWith(s))
                    {
                        return(UUID2Type[p] = GetUUIDGleaner(p.Substring(0, p.Length - s.Length), info));
                    }
                }
                Debug("Dont know what UUID means in " + p);
                return((obj, sim) => { RegisterUUIDMaybe(obj, info); });
            }
        }
Exemple #15
0
    private void Update()
    {
        float      dt = Time.deltaTime;
        GridMaster gm = GridMaster.Instance;

        NativeArray <int> startPositionsIndices = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
        NativeArray <int> endPositionsIndices   = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

        JobHandle deps = new CalculateStartEndPosJob()
        {
            startPositionsIndices    = startPositionsIndices,
            endPositionsIndices      = endPositionsIndices,
            endPositionsToChooseFrom = endPositionsToChooseFrom,
            gridBoundsCenter         = gm.Bounds.center,
            gridBoundsExtents        = gm.Bounds.extents,
            isGridCreated            = gm.IsGridCreated,
            gridWidth = gm.GridWidth,
            nodeSize  = GridMaster.NodeSize,
            rand      = new Random(0x6E624EB7u),
        }
        .Schedule(agentsTransAcc);

        NativeArray <int> nextNodesIndices = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

        const int iterationsPerJob = 8;
        int       loopTimes        = quantity / iterationsPerJob;
        int       remainder        = quantity % iterationsPerJob;

        loopTimes = remainder > 0 ? loopTimes + 1 : loopTimes;

        NativeArray <JobHandle> handles = new NativeArray <JobHandle>(loopTimes, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

        const int scheduleAfterNumOfPaths = 256;
        int       numberOfScheduledPaths  = 0;

        for (int i = 0; i < loopTimes; ++i)
        {
            int iterations = (i < loopTimes - 1 || remainder == 0) ? iterationsPerJob : remainder;
            handles[i] = Pathfinder.ScheduleFindPaths(startPositionsIndices, endPositionsIndices, nextNodesIndices, i * iterationsPerJob, iterations, deps);

            numberOfScheduledPaths += iterations;
            if (numberOfScheduledPaths > scheduleAfterNumOfPaths)
            {
                // force worker threads start resolving paths while the main thread keeps scheduling
                JobHandle.ScheduleBatchedJobs();
                numberOfScheduledPaths %= scheduleAfterNumOfPaths;
            }
        }

        deps = JobHandle.CombineDependencies(handles);

        deps = new MoveAgentsJob()
        {
            nodeIndicesDestinations = nextNodesIndices,
            nodes = gm.NodesTransforms,
            speed = agentsSpeed,
            dt    = dt,
        }
        .Schedule(agentsTransAcc, deps);

        JobHandle disposeHandle = JobHandle.CombineDependencies(startPositionsIndices.Dispose(deps), endPositionsIndices.Dispose(deps), handles.Dispose(deps));

        disposeHandle = JobHandle.CombineDependencies(disposeHandle, nextNodesIndices.Dispose(deps));

        UpdateCamPivot(dt);

        JobHandle.CompleteAll(ref deps, ref disposeHandle);

#if !UNITY_EDITOR
        if (Keyboard.current.escapeKey.wasPressedThisFrame)
        {
            Application.Quit();
        }
#else
        if (Keyboard.current.escapeKey.wasPressedThisFrame)
        {
            EditorApplication.isPlaying = false;
        }
#endif
    }
Exemple #16
0
	//================================================================//
	// CreateNewLevel
	//================================================================//
	// Destroy all previous parts of the level, then load a level using 
	// MazeGenerator and the current level seed. 
	//================================================================//
	public void CreateNewLevel(int[] newStart)
	{
		while(levelParts.Count != 0) {
			Destroy(levelParts[0]);
			levelParts.RemoveAt (0);
		}

		MazeGenerator maze = new MazeGenerator(seedX, seedY, seedZ);
		PseudoRandom rnd = new PseudoRandom(seedX, seedY, seedZ);
		currentStart = newStart;
		currentMap = maze.CreateNSEWMap(currentSquareSize, currentSquareSize, currentDiversion, currentStart);
		currentFinish = FindEnd (currentMap); 
		mainCamera.GetComponent<CameraFollow> ().SetSpotlightSettings (currentSquareSize);

		MapToLevel (currentMap);
		CreateBoundries (currentMap);

		gridMaster = new GridMaster (0.5f, 0.5f, currentMap.GetLength(1), currentMap.GetLength(0), 1f, 1f);
		GameObject fin = (GameObject)Instantiate (finish, gridMaster.GetCoordVect2(currentFinish[0], currentFinish[1]), Quaternion.identity);
		levelParts.Add (fin);

		if (currentSquareSize > startSize) {
			currentScore +=currentSquareSize*(currentSquareSize-1)*10;
			currentPlayer.SetGridMaster (gridMaster);
			currentPlayer.SetLayout (this);
		}
		SaveCurrentGame ();
	}
Exemple #17
0
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        if (ComboOrigin.SelectedItem == null)
        {
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "nonum", "alert('Origin is required!');", true);
            return;
        }
        if (ComboDestination.SelectedItem == null)
        {
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "nonum", "alert('Destination is required!');", true);
            return;
        }
        RateRouting routing = new RateRouting();

        routing.Origin   = ComboOrigin.SelectedItem.Value.ToString();
        routing.Dest     = ComboDestination.SelectedItem.Value.ToString();
        routing.Unit     = ddlUnit.SelectedItem.Value.ToString();
        routing.UnitText = ddlUnit.SelectedItem.Text.ToString();
        List <RateRouting> list = bl.GetRateRoutings(elt_account_number, customer_org_num, rate_type);
        var exist = from c in list where c.Origin == routing.Origin && c.Dest == routing.Dest && c.Unit == routing.Unit select c;

        if (exist.Count() > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "reroute", "alert('Route already exists!');", true);
            return;
        }
        if (rate_type == 4)
        {
            routing.customer_org_account_number = int.Parse(ComboCompanyList.SelectedItem.Value.ToString());
            ClientProfileBL ClientProfileBL = new ClientProfileBL();
            routing.CustomerOrgName = ClientProfileBL.GetClient(elt_account_number, routing.customer_org_account_number).dba_name;
        }
        else if (rate_type == 1)
        {
            routing.agent_org_account_number = int.Parse(ComboCompanyList.SelectedItem.Value.ToString());
            ClientProfileBL ClientProfileBL = new ClientProfileBL();
            routing.AgentOrgName = ClientProfileBL.GetClient(elt_account_number, routing.customer_org_account_number).dba_name;
        }

        Rate defaultRate = new Rate();

        defaultRate.RateID  = bl.GetNextRateID();
        defaultRate.RouteID = routing.ID;
        defaultRate.Share   = "0";
        routing.Rates.Add(defaultRate);
        int null_count = 0;

        for (int i = 0; i < GridBreak.Rows.Count; i++)
        {
            var text = ((TextBox)GridBreak.Rows[i].Cells[1].Controls[1]).Text;
            if (string.IsNullOrEmpty(text))
            {
                null_count++;
                continue;
            }
            if (!ELT.COMMON.Util.IsNumber(text))
            {
                List <RateDefinitionColum> wb = ExtractBreaksFromGridBreak();
                GridBreak.DataSource = wb;
                GridBreak.DataBind();
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "nonum", "alert('Range should be a number!');", true);

                return;
            }
            defaultRate.RateDefinitionColums.Add(new RateDefinitionColum()
            {
                ID = i, Caption = text, Value = text
            });
        }
        if (null_count == GridBreak.Rows.Count)
        {
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "noelem", "alert('At least one Range Start is required!');", true);
            return;
        }
        var count = defaultRate.RateDefinitionColums.GroupBy(w => w.Caption).Select(x => x.Count() > 1).FirstOrDefault();

        if (count)
        {
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "samenum", "alert('You cannot have duplicate Ranage Start!');", true);
            return;
        }
        int routeid = bl.InsertRoute(routing);

        GridMaster.DataBind();
        ResetGridBreak();
        ScriptManager.RegisterClientScriptBlock(this, GetType(), "CloseNewRouting", "CloseNewRouting();", true);
        ScriptManager.RegisterClientScriptBlock(this, GetType(), "SaveBreaks", "redirectBack();", true);
    }
    private void Update()
    {
        float      dt = Time.deltaTime;
        GridMaster gm = GridMaster.Instance;

        CalculateStartEndPosJob calcStartEndJob = new CalculateStartEndPosJob()
        {
            gridBoundsCenter  = gm.Bounds.center,
            gridBoundsExtents = gm.Bounds.extents,
            nodeSize          = GridMaster.NodeSize,
            isGridCreated     = gm.IsGridCreated,
            gridWidth         = gm.GridWidth,
            rand = new Random(0x6E624EB7u),
            endPositionsToChooseFrom = endPositionsToChooseFrom,
            startPositionsIndices    = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory),
            endPositionsIndices      = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory)
        };

        JobHandle calcStartEndHandle = calcStartEndJob.Schedule(agentsTransAcc);

        FindPathJobParallel findPathsJob = new FindPathJobParallel()
        {
            numNodes          = gm.GridWidth * gm.GridDepth,
            gridWidth         = gm.GridWidth,
            numNeighbors      = GridMaster.NodeNeighbors,
            startNodesIndices = calcStartEndJob.startPositionsIndices,
            endNodeIndices    = calcStartEndJob.endPositionsIndices,
            nodesNeighbors    = gm.NodesNeighbors,
            nodesTypes        = gm.NodesTypes,
            nextNodesIndices  = new NativeArray <int>(quantity, Allocator.TempJob, NativeArrayOptions.UninitializedMemory),
        };

        JobHandle findPathsHandle = findPathsJob.Schedule(quantity, 4, calcStartEndHandle);

        MoveAgentsJob moveJob = new MoveAgentsJob()
        {
            nodeIndicesDestinations = findPathsJob.nextNodesIndices,
            nodes = gm.NodesTransforms,
            speed = agentsSpeed,
            dt    = dt
        };

        JobHandle moveHandle = moveJob.Schedule(agentsTransAcc, findPathsHandle);

        UpdateCamPivot(dt);

        JobHandle disposeHandle = calcStartEndJob.startPositionsIndices.Dispose(findPathsHandle);

        disposeHandle = JobHandle.CombineDependencies(disposeHandle, calcStartEndJob.endPositionsIndices.Dispose(findPathsHandle));
        disposeHandle = JobHandle.CombineDependencies(disposeHandle, findPathsJob.nextNodesIndices.Dispose(moveHandle));

        JobHandle.CompleteAll(ref moveHandle, ref disposeHandle);

#if !UNITY_EDITOR
        if (Keyboard.current.escapeKey.wasPressedThisFrame)
        {
            Application.Quit();
        }
#else
        if (Keyboard.current.escapeKey.wasPressedThisFrame)
        {
            EditorApplication.isPlaying = false;
        }
#endif
    }