Exemplo n.º 1
0
 public ClusterCollection(ClusterConditions CC, int updaterate = 200, int refreshrate = 100)
 {
     CurrentClusters     = new List <UnitCluster>();
     lastClusterComputed = DateTime.Today;
     lastClusterRefresh  = DateTime.Today;
     clusterConditions   = CC;
     RefreshRate         = refreshrate;
     UpdateRate          = updaterate;
 }
Exemplo n.º 2
0
 public ClusterCollection(ClusterConditions CC, int updaterate = 200, int refreshrate = 100)
 {
     CurrentClusters = new List<UnitCluster>();
     lastClusterComputed = DateTime.Today;
     lastClusterRefresh = DateTime.Today;
     clusterConditions = CC;
     RefreshRate = refreshrate;
     UpdateRate = updaterate;
 }
Exemplo n.º 3
0
        public void UpdateUnitPointLists(ClusterConditions CC)
        {
            if (ListUnits.Count == 0)
            {
                return;
            }

            List <int> RemovalIndexList = new List <int>();
            bool       changeOccured    = false;

            foreach (var item in ListUnits)
            {
                if (!item.IsStillValid() || (!CC.IgnoreNonTargetable || !item.IsTargetable.Value))
                {
                    RemovalIndexList.Add(ListUnits.IndexOf(item));
                    RAGUIDS.Remove(item.RAGUID);
                    changeOccured = true;
                }
            }


            if (changeOccured)
            {
                RemovalIndexList.Sort();
                RemovalIndexList.Reverse();
                foreach (var item in RemovalIndexList)
                {
                    //ListCacheObjects.RemoveAt(item);
                    ListUnits.RemoveAt(item);
                    ListPoints.RemoveAt(item);
                }

                if (ListUnits.Count > 1)
                {
                    //Logger.DBLog.InfoFormat("Updating Cluster");

                    //Reset Vars
                    Info = new ClusterInfo();

                    NearestMonsterDistance = -1f;

                    //Set default using First Unit
                    CacheUnit firstUnit = ListUnits[0];
                    MidPoint = firstUnit.PointPosition;
                    RAGUIDS.Add(firstUnit.RAGUID);
                    NearestMonsterDistance = firstUnit.CentreDistance;
                    Info.Update(ref firstUnit);


                    //Iterate thru the remaining
                    for (int i = 1; i < ListUnits.Count - 1; i++)
                    {
                        this.UpdateProperties(ListUnits[i]);
                    }
                }
            }
        }
Exemplo n.º 4
0
        ///<summary>
        ///Tracks Lists of Clusters for specific Conditions used during Ability Clustering.
        ///</summary>
        internal List<UnitCluster> AbilityClusterCache(ClusterConditions CC)
        {
            if (!AbilityClusters.ContainsKey(CC))
            {
                Logger.Write(LogLevel.Cluster, "Creating new entry for ClusterConditions -- {0}", CC.ToString());
                AbilityClusters.Add(CC, new ClusterCollection(CC, 400, 200));
            }

            if (AbilityClusters[CC].ShouldUpdateClusters)
                AbilityClusters[CC].UpdateClusters();
            else
                AbilityClusters[CC].RefreshClusters();

            //Logger.DBLog.InfoFormat("Ability Clusters Found {0}", AbilityClusters[CC].Count.ToString());
            return AbilityClusters[CC].CurrentClusters;
        }
Exemplo n.º 5
0
 public ClusterTargetCollection(ClusterConditions CC) : base(CC)
 {
 }
Exemplo n.º 6
0
 public ClusterTargetCollection(ClusterConditions CC)
     : base(CC)
 {
 }
Exemplo n.º 7
0
        public void UpdateUnitPointLists(ClusterConditions CC)
        {
            if (ListUnits.Count == 0) return;

            List<int> RemovalIndexList = new List<int>();
            bool changeOccured = false;
            foreach (var item in ListUnits)
            {
                if (!item.IsStillValid() || (!CC.IgnoreNonTargetable || !item.IsTargetable.Value))
                {
                    RemovalIndexList.Add(ListUnits.IndexOf(item));
                    RAGUIDS.Remove(item.RAGUID);
                    changeOccured = true;
                }
            }

            if (changeOccured)
            {
                RemovalIndexList.Sort();
                RemovalIndexList.Reverse();
                foreach (var item in RemovalIndexList)
                {
                    //ListCacheObjects.RemoveAt(item);
                    ListUnits.RemoveAt(item);
                    ListPoints.RemoveAt(item);
                }

                if (ListUnits.Count > 1)
                {
                    //Logger.DBLog.InfoFormat("Updating Cluster");

                    //Reset Vars
                    Info = new ClusterInfo();

                    NearestMonsterDistance = -1f;

                    //Set default using First Unit
                    CacheUnit firstUnit = ListUnits[0];
                    MidPoint = firstUnit.PointPosition;
                    RAGUIDS.Add(firstUnit.RAGUID);
                    NearestMonsterDistance = firstUnit.CentreDistance;
                    Info.Update(ref firstUnit);

                    //Iterate thru the remaining
                    for (int i = 1; i < ListUnits.Count - 1; i++)
                    {
                        this.UpdateProperties(ListUnits[i]);
                    }
                }

            }
        }