コード例 #1
0
 internal void Setup(RTSAgent agent, int id)
 {
     System.Type mainType = this.GetType();
     if (mainType.IsSubclassOf(typeof(ActiveAbility)))
     {
         while (mainType.BaseType != typeof(ActiveAbility) &&
                mainType.GetCustomAttributes(typeof(CustomActiveAbilityAttribute), false).Length == 0)
         {
             mainType = mainType.BaseType;
         }
         Data = AbilityDataItem.FindInterfacer(mainType);
         if (Data == null)
         {
             throw new System.ArgumentException("The Ability of type " + mainType + " has not been registered in database");
         }
         this.MyAbilityCode = Data.Name;
     }
     else
     {
         this.MyAbilityCode = mainType.Name;
     }
     _agent = agent;
     ID     = id;
     TemplateSetup();
     OnSetup();
     this.VariableContainerTicket = LSVariableManager.Register(this);
     this._variableContainer      = LSVariableManager.GetContainer(VariableContainerTicket);
 }
コード例 #2
0
        public IEnumerable <LSVariable> GetDesyncs(int[] compare)
        {
            int position = 0;

            foreach (int ticket in this.TrackedLockstepTickets)
            {
                LSVariableContainer container = LSVariableManager.GetContainer(ticket);
                int[] hashes = container.GetCompareHashes();
                for (int i = 0; i < hashes.Length; i++)
                {
                    if (compare[i] != hashes[position])
                    {
                        yield return(container.Variables[i]);
                    }
                    position++;
                }
            }
        }