Esempio n. 1
0
    public Summon BuildSummon(uint summon_id, ISkillCaster caster, ISummonCaster summon_caster, ISkillTarget summon_target, SMTargetGet trigger_target_get)
    {
        Summon summon = new Summon();

        summon.Create(GameCenter.Instance.DataManager.skillSummonDB.Get(id, summon_id), m_Skill, caster, summon_caster, summon_target);

        summon.TriggerTargetsGet = trigger_target_get;

        summons.Add(summon);

        return(summon);
    }
Esempio n. 2
0
        /// <summary>
        /// 召唤物初始化
        /// </summary>
        /// <param name="summon_data"></param>
        /// <param name="skill"></param>
        /// <param name="skill_caster"></param>
        /// <param name="summon_caster"></param>
        public void Create(SummonData summon_data, Skill skill, ISkillCaster skill_caster, ISummonCaster summon_caster, ISkillTarget summon_target)
        {
            m_SummonData   = summon_data;
            m_Skill        = skill;
            m_SkillCaster  = skill_caster;
            m_SummonCaster = summon_caster;
            m_TriggerCount = summon_data.prop.GetInt(PropertiesKey.SUMMON_TRIGGERCOUNT, 0);
            m_Duration     = summon_data.prop.GetInt(PropertiesKey.SUMMON_DURATION, 20);

            //要在下一行代码之前,因为在获取motion里面初始化中要使用此对象
            m_SummonMoveTarget = summon_target;
            m_Motions          = GameCenter.Instance.DataManager.skillMotionDB.GetMotion(m_SummonData.owner, m_SummonData.id, this);
            m_Actions          = GameCenter.Instance.DataManager.skillActionDB.GetAction(m_SummonData.owner, m_SummonData.id, this);

            GameObject summon = new GameObject(summon_data.prop.GetString(PropertiesKey.SUMMON_NAME) + "_fly");

            Transform = summon.GetComponent <Transform>();
            switch (summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_TYPE))
            {
            case "summon":
            {
                if (m_SummonCaster != null && m_SummonCaster.GetMount(summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_NAME)) != null)
                {
                    Transform.position = m_SummonCaster.GetMount(summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_NAME)).position
                                         + summon_data.prop.GetVector3(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_OFFSET);
                }
                break;
            }

            case "caster":
            {
                Transform.position = m_SkillCaster.GetMount(summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_NAME)).position
                                     + summon_data.prop.GetVector3(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_OFFSET);
                break;
            }

            case "scene":
            {
                Transform.position = summon_data.prop.GetVector3(PropertiesKey.SUMMON_CREATE_EFFECT_NODE_OFFSET);
                break;
            }
            }

            //生成特效
            if (!string.IsNullOrEmpty(summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_EFFECT_NAME)))
            {
                Effect create_effect = GameCenter.Instance.EffectManager.Create(summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_EFFECT_NAME), Transform.position, Transform.rotation);

                create_effect.Destroy();
                //Effect.SetParent(Transform, true);
            }
            //生成音效
            GameCenter.Instance.AudioManager.Play(eAudioLayer.EFFECTAUDIO, summon_data.prop.GetString(PropertiesKey.SUMMON_CREATE_AUDIO_NAME));

            //
            if (!string.IsNullOrEmpty(summon_data.prop.GetString(PropertiesKey.SUMMON_FLY_EFFECT_NAME)))
            {
                Effect = GameCenter.Instance.EffectManager.Create(summon_data.prop.GetString(PropertiesKey.SUMMON_FLY_EFFECT_NAME), Transform.position, Transform.rotation);

                Effect.SetParent(Transform, true);
            }
        }