Пример #1
0
        protected override void OnStopped()
        {
            Server.OnUserDisconnected -= Server_OnUserDisconnected;

            if (redIntel != null && redIntel.CreatableInfo != null)
            {
                objectComponent.NetworkDestroy(redIntel.CreatableInfo.Id);
                objectComponent.NetworkDestroy(blueIntel.CreatableInfo.Id);
                objectComponent.NetworkDestroy(redPost.CreatableInfo.Id);
                objectComponent.NetworkDestroy(bluePost.CreatableInfo.Id);

                redIntel.OnPickedUp  -= Intel_OnPickedUp;
                redIntel.OnDropped   -= Intel_OnDropped;
                redIntel.OnReturned  -= Intel_OnReturned;
                blueIntel.OnPickedUp -= Intel_OnPickedUp;
                blueIntel.OnDropped  -= Intel_OnDropped;
                blueIntel.OnReturned -= Intel_OnReturned;

                redPost.PhysicsBody.OnCollision  -= Post_OnCollision;
                bluePost.PhysicsBody.OnCollision -= Post_OnCollision;
            }

            redIntel.Dispose();
            blueIntel.Dispose();
            redPost.Dispose();
            blueIntel.Dispose();

            teamA.Clear();
            teamB.Clear();

            teamAScore = 0;
            teamBScore = 0;

            base.OnStopped();
        }
        public static void Main()
        {
            string decorationLine = new string('-', Console.WindowWidth);
            Console.Write(decorationLine);
            Console.WriteLine("***Presenting the functionality of the data structure 'BiDictionary' - allows");
            Console.WriteLine("adding values by two keys, searching by a single key or by both keys and");
            Console.WriteLine("removing values by both keys***");
            Console.Write(decorationLine);

            BiDictionary<string, string, Person> peopleDictionary =
                new BiDictionary<string, string, Person>();

            Console.WriteLine("---Test add operation---");
            foreach (Person person in people)
            {
                peopleDictionary.Add(person.FirstName, person.LastName, person);
            }

            Console.WriteLine("Count after addition: {0}", peopleDictionary.Count);
            Console.WriteLine();

            Console.WriteLine("---Test get values by first key---");
            string firstName = "Gosho";
            Console.WriteLine("All people with first name '{0}' are:", firstName);
            PrintPeopleOnConsole(peopleDictionary.GetByFirstKey(firstName));
            Console.WriteLine();

            Console.WriteLine("---Test get values by second key---");
            string lastName = "Peshov";
            Console.WriteLine("All people with last name '{0}' are:", lastName);
            PrintPeopleOnConsole(peopleDictionary.GetBySecondKey(lastName));
            Console.WriteLine();

            Console.WriteLine("---Test get values by first key and second key---");
            string firstKey = "Gosho";
            string secondKey = "Goshov";
            Console.WriteLine("All people with first name '{0}' and last name '{1}' are:",
                firstKey,
                secondKey);
            PrintPeopleOnConsole(peopleDictionary.GetByBothKeys(firstKey, secondKey));
            Console.WriteLine();

            Console.WriteLine("---Test remove operation---");
            Console.WriteLine("Removing all people with first key '{0}' and second key '{1}'",
                firstKey,
                secondKey);
            peopleDictionary.Remove(firstKey, secondKey);
            Console.WriteLine("Count of people after removal: {0}", peopleDictionary.Count);
            Console.WriteLine("Count of people with first name '{0}' after removal: {1}",
                firstKey,
                peopleDictionary.GetByFirstKey(firstKey).Count);
            Console.WriteLine("Count of people with last name '{0}' after removal: {1}",
                secondKey,
                peopleDictionary.GetBySecondKey(secondKey).Count);
            Console.WriteLine();

            Console.WriteLine("---Test clear operation---");
            peopleDictionary.Clear();
            Console.WriteLine("Count of people after clearing the dictionary: {0}", peopleDictionary.Count);
        }
Пример #3
0
 public void BiDictionaryClear_Test()
 {
     var dictionary = new BiDictionary<object, object>();
     dictionary.Add("test", "test");
     dictionary.Add("test2", "test2");
     dictionary.Clear();
     Assert.Empty(dictionary);
 }
Пример #4
0
        public void BiDictionaryTest_clear_simple()
        {
            var biDictionary = new BiDictionary <Vector2Int, Vector2Int>
            {
                { new Vector2Int(5, 5), new Vector2Int(4, 4) },
                { new Vector2Int(6, 6), new Vector2Int(3, 3) },
                { new Vector2Int(7, 7), new Vector2Int(2, 2) }
            };

            biDictionary.Clear();

            Assert.AreEqual(0, biDictionary.Count());
        }
        public void Clear()
        {
            var Random  = Initialise();
            var Records = new BiDictionary <int, int>();

            foreach (var(Left, Right) in YieldRandom(Random, 1024))
            {
                Records.Add(Left, Right);
            }

            Records.Clear();

            Assert.AreEqual(0, Records.Count);
        }
        public void ClearAdd()
        {
            var Random  = Initialise();
            var Records = new BiDictionary <int, int>();

            foreach (var(Left, Right) in YieldRandom(Random, 1024))
            {
                Records.Add(Left, Right);
            }

            Records.Clear();

            foreach (var(Left, Right) in YieldRandom(Random, 1024))
            {
                Records.Add(Left, Right);
            }

            Validate(Records);
        }
Пример #7
0
        //INitiate tiles could be called bu the puzzle manager.
        private void InitiateTiles()
        {
            initiated = true;
            //if we do this at runtime, not for initialization, theres probably gonna need to be event unregistering and memory management issues. I dont have events yet soooo
            map.Clear();
            //reset min and max to improbable states.
            _max = new Vector3Int(Int32.MinValue, Int32.MinValue, 0);
            _min = new Vector3Int(Int32.MaxValue, Int32.MaxValue, 0);

            BoundsInt bounds = tilemap.cellBounds;

            for (int x = bounds.xMin; x <= bounds.xMax; x++)
            {
                for (int y = bounds.yMin; y <= bounds.yMax; y++)
                {
                    for (int z = bounds.zMin; z <= bounds.zMax; z++)                    //not officially supporting layered grids but might as well try. //Probably better to use multiple tilemaps.
                    {
                        Vector3Int position = new Vector3Int(x, y, z);
                        NavTile    nt       = tilemap.GetTile(position) as NavTile;                //todo z values?
                        if (nt != null)
                        {
                            //Create NavNode
                            NavNode node = new NavNode(position, this, nt.walkableDirections, nt.walkable);
                            RegisterTile(position, node);
                            if (defaultTileColor != null)
                            {
                                tilemap.SetColor(position, defaultTileColor.Value);
                            }
                            //Adjust Min and Max
                            _min = new Vector3Int(Mathf.Min(_min.x, position.x), Mathf.Min(_min.y, position.y), 0);
                            _max = new Vector3Int(Mathf.Max(_max.x, position.x), Mathf.Max(_max.y, position.y), 0);
                        }
                    }
                }
            }
        }
Пример #8
0
        public void TestClear()
        {
            _biDictionary.Clear();

            Assert.AreEqual(0, _biDictionary.Count);
        }
Пример #9
0
 public void Clear()
 {
     Free.Clear();
     Entries.Clear();
 }
Пример #10
0
 public void Clear()
 {
     root = new OctreeNode();
     elementByKey.Clear();
 }