Esempio n. 1
0
 private void AddCheck(int b)
 {
     try
     {
         if (!ListCheck.Exists(Check => Check.b == b)) //Checks to see if block is already due for a check
         {
             ListCheck.Add(new Check(b));              //Adds block to list to be updated
         }
     }
     catch
     {
         //s.Log("Warning-PhysicsCheck");
         //ListCheck.Add(new Check(b));    //Lousy back up plan
     }
 }
Esempio n. 2
0
        public void AddCheck(int index, bool overRide, PhysicsArgs data)
        {
            try {
                int x = index % Width;
                int y = (index / Width) / Length;
                int z = (index / Width) % Length;
                if (x >= Width || y >= Height || z >= Length)
                {
                    return;
                }

                if (listCheckExists.TrySetOn(x, y, z))
                {
                    Check check; check.Index = index; check.data = data;
                    ListCheck.Add(check); // Adds block to list to be updated
                }
                else if (overRide)
                {
                    Check[] items = ListCheck.Items;
                    int     count = ListCheck.Count;
                    for (int i = 0; i < count; i++)
                    {
                        if (items[i].Index != index)
                        {
                            continue;
                        }
                        items[i].data = data; return;
                    }
                    //Dont need to check physics here because if the list is active, then physics is active :)
                }

                if (!physThreadStarted && physics > 0)
                {
                    StartPhysics();
                }
            } catch {
                //s.Log("Warning-PhysicsCheck");
                //ListCheck.Add(new Check(b));    //Lousy back up plan
            }
        }
Esempio n. 3
0
        public void AddCheck(int b, bool overRide, PhysicsArgs data)
        {
            try {
                int x = b % Width;
                int y = (b / Width) / Length;
                int z = (b / Width) % Length;
                if (x >= Width || y >= Height || z >= Length)
                {
                    return;
                }

                if (!listCheckExists.Get(x, y, z))
                {
                    ListCheck.Add(new Check(b, data)); //Adds block to list to be updated
                    listCheckExists.Set(x, y, z, true);
                }
                else if (overRide)
                {
                    Check[] items = ListCheck.Items;
                    int     count = ListCheck.Count;
                    for (int i = 0; i < count; i++)
                    {
                        if (items[i].b != b)
                        {
                            continue;
                        }
                        items[i].data = data; return;
                    }
                    //Dont need to check physics here because if the list is active, then physics is active :)
                }
                if (!physicssate && physics > 0)
                {
                    StartPhysics();
                }
            } catch {
                //s.Log("Warning-PhysicsCheck");
                //ListCheck.Add(new Check(b));    //Lousy back up plan
            }
        }