Esempio n. 1
0
        public InteractiveTemplate Map(InteractiveTemplate template, InteractiveSkillTemplate skillTemplate, InteractiveTemplateSkills binding,
                                       InteractiveCustomSkillRecord skill)
        {
            if (template == null)
            {
                return(m_current);
            }

            InteractiveTemplate current;

            if (m_currentMapping.TryGetValue(template.Id, out current))
            {
                if (binding != null && binding.InteractiveTemplateId == m_current.Id && binding.SkillId == skill.Id &&
                    current.CustomSkills.All(x => x.Id != skill.Id))
                {
                    current.CustomSkills.Add(skill);
                }

                if (skillTemplate != null && m_current.TemplateSkills.All(x => x.Id != skillTemplate.Id))
                {
                    current.TemplateSkills.Add(skillTemplate);
                }

                return(null);
            }

            var previous = m_current;

            m_current = template;
            m_currentMapping.Add(template.Id, template);
            if (binding != null && binding.InteractiveTemplateId == m_current.Id && binding.SkillId == skill.Id &&
                m_current.CustomSkills.All(x => x.Id != skill.Id))
            {
                m_current.CustomSkills.Add(skill);
            }

            if (skillTemplate != null && m_current.TemplateSkills.All(x => x.Id != skillTemplate.Id))
            {
                m_current.TemplateSkills.Add(skillTemplate);
            }

            return(previous);
        }
Esempio n. 2
0
        public InteractiveSpawn Map(InteractiveSpawn spawn, InteractiveSpawnSkills binding, InteractiveCustomSkillRecord skill)
        {
            if (spawn == null)
            {
                return(m_current);
            }

            if (m_current != null && m_current.Id == spawn.Id)
            {
                if (binding.InteractiveSpawnId == m_current.Id && binding.SkillId == skill.Id)
                {
                    m_current.CustomSkills.Add(skill);
                }
                return(null);
            }

            InteractiveSpawn previous = m_current;

            m_current = spawn;
            if (binding.InteractiveSpawnId == m_current.Id && binding.SkillId == skill.Id)
            {
                m_current.CustomSkills.Add(skill);
            }

            return(previous);
        }