override public void Awake()
 {
     GetAIController();
     m_storeTarget = GetComponent <StoreTarget>();
     m_agent       = GetComponentInParent <NavMeshAgent>();
     weapons       = GetComponentsInChildren <Gadget>();
 }
        internal List <string> GetKeysNames(StoreTarget target, string section_name)
        {
            lock (m_Lock)
            {
                switch (target)
                {
                case StoreTarget.Original:
                    return(ReadSectionsKeys(m_Sections, section_name));

                case StoreTarget.Modified:
                    return(ReadSectionsKeys(m_Modified, section_name));

                default:
                    List <string> list  = ReadSectionsKeys(m_Sections, section_name);
                    List <string> list2 = ReadSectionsKeys(m_Modified, section_name);

                    foreach (string section in list2)
                    {
                        if (!list.Contains(section))
                        {
                            list.Add(section);
                        }
                    }
                    return(list);
                }
            }
        }
        internal void SectionRename(string old_name, string new_name, StoreTarget target)
        {
            if (new_name == old_name)
            {
                throw new ArgumentException("Both names are equal");
            }
            if (new_name == null || new_name.Length < 1)
            {
                throw new ArgumentException("Invalid new section name", "new_name");
            }
            if (old_name == null || old_name.Length < 1)
            {
                throw new ArgumentException("Invalid old section name", "old_name");
            }
            //if (!SectionExists(old_name)) { throw new InvalidOperationException("Section \"" + old_name + "\" does not exist."); }

            lock (m_Lock)
            {
                if (target != StoreTarget.Modified && m_Sections.ContainsKey(old_name))
                {
                    Dictionary <string, string> dic = m_Sections[old_name];
                    m_Sections.Remove(old_name);
                    m_Sections.Add(new_name, dic);
                }
                if (target != StoreTarget.Original && m_Modified.ContainsKey(old_name))
                {
                    Dictionary <string, string> dic = m_Modified[old_name];
                    m_Modified.Remove(old_name);
                    m_Modified.Add(new_name, dic);
                }
            }
        }
        // *** Sections Getters and Setters*** //
        internal string[] GetSectionsNames(StoreTarget target)
        {
            lock (m_Lock)
            {
                switch (target)
                {
                case StoreTarget.Original:
                    return(ReadDictionaryKeys(m_Sections).ToArray());

                case StoreTarget.Modified:
                    return(ReadDictionaryKeys(m_Modified).ToArray());

                default:
                    List <string> list  = ReadDictionaryKeys(m_Sections);
                    List <string> list2 = ReadDictionaryKeys(m_Modified);

                    foreach (string section in list2)
                    {
                        if (!list.Contains(section))
                        {
                            list.Add(section);
                        }
                    }
                    return(list.ToArray());
                }
            }
        }
 private void Awake()
 {
     storeTarget = GetComponentInChildren <StoreTarget>();
     if (updateTargets)
     {
         InvokeRepeating("FindTargets", 0, 0.5f);
     }
     else
     {
         FindTargets();
     }
 }
 internal void SectionDelete(string section_name, StoreTarget target)
 {
     lock (m_Lock)
     {
         if (target != StoreTarget.Modified && m_Sections.ContainsKey(section_name))
         {
             m_Sections.Remove(section_name);
         }
         if (target != StoreTarget.Original && m_Modified.ContainsKey(section_name))
         {
             m_Modified.Remove(section_name);
         }
     }
 }
        internal bool SectionExists(string section_name, StoreTarget target)
        {
            switch (target)
            {
            case StoreTarget.Modified:
                return(m_Modified.ContainsKey(section_name));

            case StoreTarget.Original:
                return(m_Sections.ContainsKey(section_name));

            default:
                return(m_Sections.ContainsKey(section_name) || m_Modified.ContainsKey(section_name));
            }
        }
Exemple #8
0
        public override int GetHashCode()
        {
            var result = Name.GetHashCode();

            foreach (var o in Operands)
            {
                result = result * 17 + o.GetHashCode();
            }

            if (StoreTarget != null)
            {
                result = result * 17 + StoreTarget.GetHashCode();
            }
            result = result * 17 + BranchPolarity.GetHashCode();
            if (BranchTarget != null)
            {
                result = result * 17 + BranchTarget.GetHashCode();
            }

            return(result);
        }
 private void Awake()
 {
     storeTarget = GetComponent <StoreTarget>();
 }
Exemple #10
0
 private void Awake()
 {
     m_state     = GetComponentInChildren <AIState>();
     storeTarget = GetComponentInChildren <StoreTarget>();
 }