Beispiel #1
0
 public override void Setup()
 {
     if (!instanceList.Contains(this as T))
     {
         instanceList.Add(this as T);
     }
 }
Beispiel #2
0
 public void AddBuildingPrivilege(BuildingPrivlidge ent)
 {
     if (!(ent == null) && !buildingPrivileges.Contains(ent))
     {
         buildingPrivileges.Add(ent);
     }
 }
Beispiel #3
0
 public void AddDecayEntity(DecayEntity ent)
 {
     if (!(ent == null) && !decayEntities.Contains(ent))
     {
         decayEntities.Add(ent);
     }
 }
Beispiel #4
0
        private void RegisterPermission(string permissionName)
        {
            if (!_registeredPermissions.Contains(permissionName))
            {
                _registeredPermissions.Add(permissionName);
            }

            permission.RegisterPermission(permissionName, this);
        }
Beispiel #5
0
    public void Add(DecayEntity ent)
    {
        if (ent.buildingID == 0)
        {
            if (!decayEntities.Contains(ent))
            {
                decayEntities.Add(ent);
            }
            return;
        }
        Building building = GetBuilding(ent.buildingID);

        if (building == null)
        {
            building = CreateBuilding(ent.buildingID);
            buildingDictionary.Add(ent.buildingID, building);
        }
        building.Add(ent);
        building.Dirty();
    }
Beispiel #6
0
        public void AddBuildingBlock(BuildingBlock ent)
        {
            if (ent == null || buildingBlocks.Contains(ent))
            {
                return;
            }
            buildingBlocks.Add(ent);
            if (!AI.nav_carve_use_building_optimization)
            {
                return;
            }
            NavMeshObstacle component = ent.GetComponent <NavMeshObstacle>();

            if (component != null)
            {
                isNavMeshCarvingDirty = true;
                if (navmeshCarvers == null)
                {
                    navmeshCarvers = new ListHashSet <NavMeshObstacle>();
                }
                navmeshCarvers.Add(component);
            }
        }
Beispiel #7
0
        public void ListHashSetTest()
        {
            ListHashSet<string> set = new ListHashSet<string>();

            Assert.AreEqual(set.Count(), 0);
            CollectionAssert.AreEqual(new string[] { }, set.ToArray());
            Assert.IsFalse(set.Contains("a"));
            Assert.IsFalse(set.Contains("b"));

            set.Add("b");
            Assert.AreEqual(set.Count(), 1);
            Assert.IsFalse(set.Contains("a"));
            Assert.IsTrue(set.Contains("b"));
            CollectionAssert.AreEqual(new string[] { "b" }, set.ToArray());

            set.Add("a");
            Assert.AreEqual(set.Count(), 2);
            Assert.IsTrue(set.Contains("a"));
            Assert.IsTrue(set.Contains("b"));
            CollectionAssert.AreEqual(new string[] { "b", "a" }, set.ToArray());

            set.Add("b");
            Assert.AreEqual(set.Count(), 2);
            Assert.IsTrue(set.Contains("a"));
            Assert.IsTrue(set.Contains("b"));
            CollectionAssert.AreEqual(new string[] { "b", "a" }, set.ToArray());

            Assert.AreEqual(set[0], "b");
            Assert.AreEqual(set[1], "a");

            set.Remove("b");

            CollectionAssert.AreEqual(new string[] { "a" }, set.ToArray());
            Assert.IsTrue(set.Contains("a"));
            Assert.IsFalse(set.Contains("b"));

            set.Clear();

            CollectionAssert.AreEqual(new string[] {}, set.ToArray());
            Assert.IsFalse(set.Contains("a"));
            Assert.IsFalse(set.Contains("b"));
        }