Exemplo n.º 1
0
 public void InitEventData(int nID)
 {
     m_EventData = new AnimEventData(nID);
     if (DataTemplate.GetInstance().m_ArtresourceTable.tableContainsKey(nID))
     {
         m_ModelActionRow = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(nID);
     }
 }
Exemplo n.º 2
0
    public static void CreateAnimEventData()
    {
        //string path =;//.Split(char.Parse("/"));
        //Debug.Log("App path " + path);
        AnimEventData newAnimEventData = ScriptableObject.CreateInstance <AnimEventData>();

        AssetDatabase.CreateAsset(newAnimEventData, "Assets/AnimEventData/AnimEventData.asset");
        //AssetDatabase.SaveAssets();
        Selection.activeObject = newAnimEventData;
    }
Exemplo n.º 3
0
 // Called when an animation event happens
 public override void OnAnimEvent(AnimEventData data)
 {
     base.OnAnimEvent(data);
     if (data.GetType() == typeof(PlayerAnimEventData))
     {
     }
     else
     {
         Debug.Log("AnimEventData not supported in Player");
     }
 }
 public void ChangeAnimCtrl(RuntimeAnimatorController anim_ctrl, AnimEventData anim_event)
 {
     if (!(anim_ctrl == null) && !(anim_event == null))
     {
         ExecuteLastEvent(true);
         curHash         = 0;
         curDatas        = null;
         curTime         = 0f;
         curIndex        = 0;
         ignoreEventFlag = false;
         animator.set_runtimeAnimatorController(anim_ctrl);
         animator.Rebind();
         animEventData = anim_event;
     }
 }
Exemplo n.º 5
0
    public void CacheAnimDataUseResourceDependPlayer(Player player, AnimEventData animEventData)
    {
        if (!(player == null) && !(animEventData == null))
        {
            animEventData.Initialize();
            AnimEventData.AnimData[] animations = animEventData.animations;
            for (int i = 0; i < animations.Length; i++)
            {
                AnimEventData.EventData[] events = animations[i].events;
                foreach (AnimEventData.EventData eventData in events)
                {
                    switch (eventData.id)
                    {
                    case AnimEventFormat.ID.EFFECT_DEPEND_WEAPON_ELEMENT:
                    {
                        string str = eventData.stringArgs[0];
                        int    currentWeaponElement2 = player.GetCurrentWeaponElement();
                        if (currentWeaponElement2 < 6)
                        {
                            str += currentWeaponElement2.ToString();
                            if (!string.IsNullOrEmpty(str))
                            {
                                CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, str);
                            }
                        }
                        break;
                    }

                    case AnimEventFormat.ID.SE_ONESHOT_DEPEND_WEAPON_ELEMENT:
                    {
                        int currentWeaponElement = player.GetCurrentWeaponElement();
                        if (currentWeaponElement <= 6 && eventData.intArgs.Length > currentWeaponElement && eventData.intArgs[currentWeaponElement] != 0)
                        {
                            CacheSE(eventData.intArgs[currentWeaponElement], null);
                        }
                        break;
                    }
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
    protected void ApplyAnimEventData(AnimEventData data)
    {
        if (data != null)
        {
            if (CanUseAnimEventDataForSpeed())
            {
                CurrentMoveSpeed = data.m_TranslationSpeed;
            }

            /*if( GetType() == typeof(Enemy) )
             * {
             *      Debug.Log("Transform speed.. " + m_CurrentMoveSpeed);
             * }*/
        }
        else
        {
            if (CanUseAnimEventDataForSpeed())
            {
                CurrentMoveSpeed = 0.0f;
            }
        }
    }
Exemplo n.º 7
0
 // Called when an animation event happens
 public override void OnAnimEvent(AnimEventData data)
 {
     m_AnimEventData = data;
     // Because this needs to called only once
     // thats why its not inside function ApplyAnimEventData;
     if (data.m_TriggerData != null)
     {
         //SetToDefaultEnabledAllActorTriggerBase();
         for (int i = 0; i < data.m_TriggerData.Length; i++)
         {
             if (data.m_TriggerData[i].m_TriggerType != null)
             {
                 //Debug.Log("Enabled trigger " + data.m_TriggerData[i].m_TriggerType + " Enabled " + data.m_TriggerData[i].m_Enabled);
                 SetEnableActorTriggerBase(data.m_TriggerData[i].m_TriggerType, data.m_TriggerData[i].m_Enabled);
             }
             else
             {
                 Debug.LogError("Wrong trigger type is assigned to AnimEventData for game object '" + gameObject.name + "'");
             }
         }
     }
 }
Exemplo n.º 8
0
    public void CacheAnimDataUseResource(AnimEventData animEventData, EffectNameAnalyzer name_analyzer = null, List <AnimEventData.EventData> cntAtkDataList = null)
    {
        if (!(animEventData == null))
        {
            animEventData.Initialize();
            AnimEventData.AnimData[] animations = animEventData.animations;
            int i = 0;
            for (int num = animations.Length; i < num; i++)
            {
                AnimEventData.EventData[] events = animations[i].events;
                int j = 0;
                for (int num2 = events.Length; j < num2; j++)
                {
                    AnimEventData.EventData eventData = events[j];
                    switch (eventData.id)
                    {
                    case AnimEventFormat.ID.EFFECT:
                    case AnimEventFormat.ID.EFFECT_ONESHOT:
                    case AnimEventFormat.ID.EFFECT_STATIC:
                    case AnimEventFormat.ID.EFFECT_LOOP_CUSTOM:
                    case AnimEventFormat.ID.CAMERA_EFFECT:
                    case AnimEventFormat.ID.EFFECT_SCALE_DEPEND_VALUE:
                    {
                        string text4 = eventData.stringArgs[0];
                        if (name_analyzer != null)
                        {
                            text4 = name_analyzer(text4);
                        }
                        if (!string.IsNullOrEmpty(text4))
                        {
                            CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, text4);
                        }
                        break;
                    }

                    case AnimEventFormat.ID.EFFECT_DEPEND_SP_ATTACK_TYPE:
                    {
                        int k = 1;
                        for (int num4 = eventData.stringArgs.Length; k < num4; k++)
                        {
                            string text7 = eventData.stringArgs[k];
                            if (name_analyzer != null && !string.IsNullOrEmpty(text7))
                            {
                                text7 = name_analyzer(text7);
                            }
                            if (!string.IsNullOrEmpty(text7))
                            {
                                CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, text7);
                            }
                        }
                        break;
                    }

                    case AnimEventFormat.ID.SE_ONESHOT:
                    case AnimEventFormat.ID.SE_LOOP_PLAY:
                        CacheSE(eventData.intArgs[0], null);
                        break;

                    case AnimEventFormat.ID.CONTINUS_ATTACK:
                    {
                        cntAtkDataList?.Add(eventData);
                        string text5 = eventData.stringArgs[2];
                        if (name_analyzer != null)
                        {
                            text5 = name_analyzer(text5);
                        }
                        if (!string.IsNullOrEmpty(text5))
                        {
                            CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, text5);
                        }
                        break;
                    }

                    case AnimEventFormat.ID.WEAKPOINT_ON:
                    {
                        Enemy.WEAK_STATE wEAK_STATE = (Enemy.WEAK_STATE)((eventData.intArgs.Length > 1) ? eventData.intArgs[1] : 0);
                        if (Enemy.IsWeakStateElementAttack(wEAK_STATE) || Enemy.IsWeakStateSkillAttack(wEAK_STATE) || Enemy.IsWeakStateHealAttack(wEAK_STATE) || Enemy.IsWeakStateCannonAttack(wEAK_STATE))
                        {
                            TargetMarker.EFFECT_TYPE eFFECT_TYPE = Enemy.WeakStateToEffectType(wEAK_STATE);
                            if (eFFECT_TYPE != TargetMarker.EFFECT_TYPE.NONE)
                            {
                                string           text2       = MonoBehaviourSingleton <InGameSettingsManager> .I.targetMarkerSettings.effectNames[(int)eFFECT_TYPE];
                                Enemy.WEAK_STATE wEAK_STATE2 = wEAK_STATE;
                                if (wEAK_STATE2 == Enemy.WEAK_STATE.WEAK_ELEMENT_ATTACK || wEAK_STATE2 == Enemy.WEAK_STATE.WEAK_ELEMENT_SKILL_ATTACK)
                                {
                                    int num3 = (eventData.intArgs.Length <= 2) ? (-1) : eventData.intArgs[2];
                                    if (num3 >= 0)
                                    {
                                        text2 += num3.ToString();
                                    }
                                }
                                CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, text2);
                            }
                        }
                        eventData.attackMode = Player.ATTACK_MODE.NONE;
                        string text3 = (eventData.stringArgs.Length <= 0) ? string.Empty : eventData.stringArgs[0];
                        if (!string.IsNullOrEmpty(text3))
                        {
                            if (!Enum.IsDefined(typeof(EQUIPMENT_TYPE), text3))
                            {
                                Log.Error("Undefined EQUIPMENT_TYPE name:" + text3);
                            }
                            else
                            {
                                EQUIPMENT_TYPE equipment_type = (EQUIPMENT_TYPE)(int)Enum.Parse(typeof(EQUIPMENT_TYPE), text3);
                                eventData.attackMode = Player.ConvertEquipmentTypeToAttackMode(equipment_type);
                            }
                        }
                        break;
                    }

                    case AnimEventFormat.ID.WEAKPOINT_ALL_ON:
                    {
                        eventData.attackMode = Player.ATTACK_MODE.NONE;
                        string text6 = (eventData.stringArgs.Length <= 0) ? string.Empty : eventData.stringArgs[0];
                        if (!string.IsNullOrEmpty(text6))
                        {
                            if (!Enum.IsDefined(typeof(EQUIPMENT_TYPE), text6))
                            {
                                Log.Error("Undefined EQUIPMENT_TYPE name:" + text6);
                            }
                            else
                            {
                                EQUIPMENT_TYPE equipment_type2 = (EQUIPMENT_TYPE)(int)Enum.Parse(typeof(EQUIPMENT_TYPE), text6);
                                eventData.attackMode = Player.ConvertEquipmentTypeToAttackMode(equipment_type2);
                            }
                        }
                        break;
                    }

                    case AnimEventFormat.ID.GENERATE_AEGIS:
                    {
                        string text = eventData.stringArgs[0];
                        if (!string.IsNullOrEmpty(text))
                        {
                            CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, text);
                        }
                        if (eventData.intArgs.Length >= 3 && eventData.intArgs[2] > 0)
                        {
                            CacheSE(eventData.intArgs[2], null);
                        }
                        if (eventData.intArgs.Length >= 4 && eventData.intArgs[3] > 0)
                        {
                            CacheSE(eventData.intArgs[3], null);
                        }
                        if (eventData.intArgs.Length >= 5 && eventData.intArgs[4] > 0)
                        {
                            CacheSE(eventData.intArgs[4], null);
                        }
                        break;
                    }
                    }
                }
            }
        }
    }
Exemplo n.º 9
0
 // Called when animation event happens
 public override void OnAnimEvent(AnimEventData data)
 {
 }
Exemplo n.º 10
0
 // Called when animation event happens
 public abstract void OnAnimEvent(AnimEventData data);
Exemplo n.º 11
0
    static AnimData SampleClip(GameObject go, AnimationClip clip)
    {
        //Debug.Log("Sample motion, Clip:" + clip.name + " GameObject:" + go.name);

        AnimData animData = new AnimData();

        animData.sampleDatas = new List <SampleData>();

        animData.frameRate = IM.Editor.Tools.Convert(clip.frameRate);
        animData.wrapMode  = clip.wrapMode;

        Dictionary <SampleNode, Transform> transforms = new Dictionary <SampleNode, Transform>();

        for (int i = 0; i < (int)SampleNode.Count; ++i)
        {
            string    nodeName  = NODE_NAMES[i];
            Transform transform = GameUtils.FindChildRecursive(go.transform, nodeName);
            transforms.Add((SampleNode)i, transform);
        }

        Transform root = transforms[SampleNode.Root];

        //Debug.Log(clip.averageDuration);
        for (IM.Number t = IM.Number.zero; ; t += SAMPLE_INTERVAL)
        {
            SampleData data = new SampleData();

            float time = Mathf.Min((float)t, clip.averageDuration);
            clip.SampleAnimation(go, time);
            data.time = IM.Editor.Tools.Convert(time);

            data.nodes = new Dictionary <SampleNode, SampleNodeData>();
            for (int i = 0; i < (int)SampleNode.Count; ++i)
            {
                SampleNode node      = (SampleNode)i;
                Transform  transform = transforms[node];
                Vector3    curPos    = transform.position;
                Quaternion curRot    = transform.rotation;

                SampleNodeData nodeData = new SampleNodeData();
                if (node == SampleNode.Root)    //Root节点采样相对于Player的位置
                {
                    nodeData.position  = IM.Editor.Tools.Convert(curPos);
                    nodeData.horiAngle = IM.Editor.Tools.Convert(curRot.eulerAngles.y);
                }
                else    //其他节点采样相对于Root的位置
                {
                    nodeData.position = IM.Editor.Tools.Convert(root.transform.InverseTransformPoint(transform.position));
                }
                //Debug.Log(string.Format("Sample, clip:{0} node:{1} time:{2} pos:{3} angle:{4}",
                //    clip.name, node, time, nodeData.position, nodeData.horiAngle));

                data.nodes.Add(node, nodeData);
            }

            animData.sampleDatas.Add(data);

            if ((float)t >= clip.averageDuration)
            {
                break;
            }
        }


        //Animation event
        animData.eventDatas = new List <AnimEventData>();
        AnimationEvent[] events = AnimationUtility.GetAnimationEvents(clip);
        for (int i = 0; i < events.Length; ++i)
        {
            AnimationEvent evt       = events[i];
            AnimEventData  eventData = new AnimEventData();
            eventData.funcName        = evt.functionName;
            eventData.time            = IM.Editor.Tools.Convert(evt.time);
            eventData.intParameter    = evt.intParameter;
            eventData.floatParameter  = IM.Editor.Tools.Convert(evt.floatParameter);
            eventData.stringParameter = evt.stringParameter;
            animData.eventDatas.Add(eventData);
            evt.messageOptions = SendMessageOptions.DontRequireReceiver;
        }
        AnimationUtility.SetAnimationEvents(clip, events);

        return(animData);
    }
Exemplo n.º 12
0
    public void ReadConfig()
    {
        if (isLoadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; }

        string text = ResourceLoadManager.Instance.GetConfigText(XML_ASSET_NAME);

        if (text == null)
        {
            ErrorDisplay.Instance.HandleLog("LoadConfig failed: " + XML_ASSET_NAME, "", LogType.Error);
            return;
        }

        datas.Clear();
        XmlDocument doc = new XmlDocument();

        doc.LoadXml(text);
        XmlNode root = doc.SelectSingleNode("AnimationSamples");

        foreach (XmlNode motion in root.SelectNodes("Animation"))
        {
            AnimData animData = new AnimData();
            string   name     = motion.Attributes["name"].Value;
            datas.Add(name, animData);

            animData.wrapMode  = (WrapMode)(int.Parse(motion.Attributes["wrapMode"].Value));
            animData.frameRate = IM.Number.Parse(motion.Attributes["frameRate"].Value);

            animData.sampleDatas = new List <SampleData>();
            foreach (XmlNode sample in motion.SelectNodes("Sample"))
            {
                IM.Number  time = IM.Number.Parse(sample.Attributes["time"].Value);
                SampleData data = new SampleData();
                data.time = time;
                animData.sampleDatas.Add(data);

                data.nodes = new Dictionary <SampleNode, SampleNodeData>();
                foreach (XmlNode node in sample.SelectNodes("Node"))
                {
                    SampleNodeData nodeData     = new SampleNodeData();
                    SampleNode     nodeName     = (SampleNode)(int.Parse(node.Attributes["name"].Value));
                    XmlAttribute   attrPosition = node.Attributes["position"];
                    if (attrPosition != null)
                    {
                        nodeData.position = IM.Vector3.Parse(attrPosition.Value);
                    }
                    XmlAttribute attrHoriAngle = node.Attributes["hori_angle"];
                    if (attrHoriAngle != null)
                    {
                        nodeData.horiAngle = IM.Number.Parse(attrHoriAngle.Value);
                    }
                    data.nodes.Add(nodeName, nodeData);
                }
            }
            animData.duration = animData.sampleDatas[animData.sampleDatas.Count - 1].time;

            animData.eventDatas = new List <AnimEventData>();
            foreach (XmlNode evt in motion.SelectNodes("Event"))
            {
                AnimEventData eventData = new AnimEventData();
                eventData.time     = IM.Number.Parse(evt.Attributes["time"].Value);
                eventData.funcName = evt.Attributes["func"].Value;
                XmlAttribute attrIntParam = evt.Attributes["int_param"];
                if (attrIntParam != null)
                {
                    eventData.intParameter = int.Parse(attrIntParam.Value);
                }
                XmlAttribute attrStringParam = evt.Attributes["string_param"];
                if (attrStringParam != null)
                {
                    eventData.stringParameter = attrStringParam.Value;
                }
                XmlAttribute attrFloatParam = evt.Attributes["float_param"];
                if (attrFloatParam != null)
                {
                    eventData.floatParameter = IM.Number.Parse(attrFloatParam.Value);
                }
                animData.eventDatas.Add(eventData);
            }
            //按事件时间排序
            animData.eventDatas.Sort((d1, d2) => d1.time < d2.time ? -1 : (d1.time > d2.time ? 1 : 0));
        }
    }
Exemplo n.º 13
0
    private void PreSetAnimationEventDataParamToEnemy(AnimEventData animEventData, Enemy enemy)
    {
        //IL_00f7: Unknown result type (might be due to invalid IL or missing references)
        //IL_0132: Unknown result type (might be due to invalid IL or missing references)
        if (!(animEventData == null))
        {
            AnimEventData.AnimData[] animations = animEventData.animations;
            if (animations != null)
            {
                int i = 0;
                for (int num = animations.Length; i < num; i++)
                {
                    AnimEventData.EventData[] events = animations[i].events;
                    if (events != null)
                    {
                        int j = 0;
                        for (int num2 = events.Length; j < num2; j++)
                        {
                            AnimEventData.EventData eventData = events[j];
                            if (eventData != null)
                            {
                                switch (eventData.id)
                                {
                                case AnimEventFormat.ID.MOVE_SIDEWAYS_LOOK_TARGET:
                                    if (eventData.floatArgs.Length >= 2)
                                    {
                                        enemy.moveAngle_deg      = eventData.floatArgs[0];
                                        enemy.moveAngleSpeed_deg = eventData.floatArgs[1];
                                    }
                                    break;

                                case AnimEventFormat.ID.MOVE_POINT_DATA:
                                    if (eventData.floatArgs.Length >= 2)
                                    {
                                        enemy.movePointPos = new Vector3(eventData.floatArgs[0], 0f, eventData.floatArgs[1]);
                                    }
                                    break;

                                case AnimEventFormat.ID.MOVE_LOOKAT_DATA:
                                    if (eventData.floatArgs.Length >= 3)
                                    {
                                        enemy.moveLookAtPos   = new Vector3(eventData.floatArgs[0], 0f, eventData.floatArgs[1]);
                                        enemy.moveLookAtAngle = eventData.floatArgs[2];
                                    }
                                    break;

                                case AnimEventFormat.ID.EFFECT:
                                    if (animations[i].name == "paralyze")
                                    {
                                        if (eventData.floatArgs.Length > 0)
                                        {
                                            enemy.paralyzeEffectScale = eventData.floatArgs[0];
                                        }
                                        if (eventData.stringArgs.Length > 0)
                                        {
                                            enemy.paralyzeEffectName = eventData.stringArgs[0];
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 14
0
    private IEnumerator DoLoad(int body_id, int anim_id, float scale, string base_effect, string base_effect_node, bool need_shadow, bool enable_light_probes, bool need_anim_event_res_cache, SHADER_TYPE shader_type, int layer, string foundation_name, bool need_stamp_effect, bool will_stock, OnCompleteLoad callback)
    {
        Enemy enemy = this.get_gameObject().GetComponent <Enemy>();

        if (enemy != null)
        {
            int id = enemy.id;
        }
        bodyID    = body_id;
        bodyScale = scale;
        bool is_boss = false;

        if (enemy != null)
        {
            is_boss = enemy.isBoss;
            if (enemy.controller != null)
            {
                enemy.controller.set_enabled(false);
            }
            if (enemy.packetReceiver != null)
            {
                enemy.packetReceiver.SetStopPacketUpdate(true);
            }
            enemy.OnLoadStart();
        }
        string    body_name = ResourceName.GetEnemyBody(body_id);
        string    mate_name = ResourceName.GetEnemyMaterial(body_id);
        string    anim_name = ResourceName.GetEnemyAnim(anim_id);
        Transform _this     = this.get_transform();

        isLoading = true;
        LoadingQueue load_queue = new LoadingQueue(this);
        LoadObject   lo_body    = load_queue.LoadAndInstantiate(RESOURCE_CATEGORY.ENEMY_MODEL, body_name);
        LoadObject   lo_mate    = (mate_name == null) ? null : load_queue.Load(RESOURCE_CATEGORY.ENEMY_MATERIAL, body_name, new string[1]
        {
            mate_name
        }, false);
        LoadObject lo_anim = load_queue.Load(RESOURCE_CATEGORY.ENEMY_ANIM, anim_name, new string[2]
        {
            anim_name + "Ctrl",
            anim_name + "Event"
        }, false);

        if (!string.IsNullOrEmpty(base_effect))
        {
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, base_effect);
        }
        LoadObject lo_foundation = null;

        if (!string.IsNullOrEmpty(foundation_name))
        {
            if (!MonoBehaviourSingleton <GlobalSettingsManager> .I.uiModelRendering.enableEnemyModelFoundationFromQuestStage)
            {
                foundation_name = "FST011";
            }
            lo_foundation = load_queue.LoadAndInstantiate(RESOURCE_CATEGORY.FOUNDATION_MODEL, foundation_name);
        }
        yield return((object)load_queue.Wait());

        body = lo_body.Realizes(_this, (layer != -1) ? layer : 11);
        if (layer == -1)
        {
            this.get_gameObject().set_layer(10);
        }
        body.set_localPosition(Vector3.get_zero());
        body.set_localRotation(Quaternion.get_identity());
        renderersBody = body.get_gameObject().GetComponentsInChildren <Renderer>();
        if (lo_mate != null && lo_mate.loadedObject != null && renderersBody.Length == 1)
        {
            Material mate = lo_mate.loadedObject as Material;
            if (mate != null)
            {
                renderersBody[0].set_sharedMaterial(mate);
            }
        }
        if (enemy != null)
        {
            enemy.body = body;
        }
        body.set_localScale(Vector3.Scale(body.get_localScale(), new Vector3(scale, scale, scale)));
        animator = body.get_gameObject().GetComponent <Animator>();
        if (animator != null && lo_anim.loadedObjects != null)
        {
            animator.set_runtimeAnimatorController(lo_anim.loadedObjects[0].obj);
            if (lo_anim.loadedObjects.Length >= 2 && lo_anim.loadedObjects[1] != null)
            {
                this.animEventData = (lo_anim.loadedObjects[1].obj as AnimEventData);
            }
            if (enemy != null)
            {
                body.get_gameObject().AddComponent <StageObjectProxy>().stageObject = enemy;
                enemy.animEventData = this.animEventData;
            }
        }
        if (!string.IsNullOrEmpty(base_effect))
        {
            string node_name = base_effect_node;
            if (string.IsNullOrEmpty(node_name))
            {
                node_name = "Root";
            }
            Transform node             = Utility.Find(body, node_name);
            Transform effect_transform = EffectManager.GetEffect(base_effect, node);
            if (effect_transform != null)
            {
                baseEffect = effect_transform;
                if (layer != -1)
                {
                    Utility.SetLayerWithChildren(effect_transform, layer);
                }
            }
        }
        if (shader_type == SHADER_TYPE.LIGHTWEIGHT)
        {
            ShaderGlobal.ChangeWantLightweightShader(renderersBody);
        }
        if (is_boss)
        {
            materialParamsList = new List <MaterialParams>();
            Shader.PropertyToID("_RimPower");
            Shader.PropertyToID("_RimWidth");
            Shader.PropertyToID("_Vanish_flag");
            Shader.PropertyToID("_Vanish_rate");
            Utility.MaterialForEach(renderersBody, delegate(Material material)
            {
                if (material != null)
                {
                    MaterialParams materialParams = new MaterialParams
                    {
                        material = material
                    };
                    if (materialParams.hasRimPower = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_POWER_003E__16))
                    {
                        materialParams.defaultRimPower = material.GetFloat(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_POWER_003E__16);
                    }
                    if (materialParams.hasRimWidth = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_WIDTH_003E__17))
                    {
                        materialParams.defaultRimWidth = material.GetFloat(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_WIDTH_003E__17);
                    }
                    materialParams.hasVanishFlag = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_VANISH_FLAG_003E__18);
                    materialParams.hasVanishRate = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_VANISH_RATE_003E__19);
                    ((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003C_003Ef__this.materialParamsList.Add(materialParams);
                }
            });
        }
        int l = 0;

        for (int k = renderersBody.Length; l < k; l++)
        {
            renderersBody[l].set_useLightProbes(enable_light_probes);
        }
        EnemyParam param = body.get_gameObject().GetComponent <EnemyParam>();

        body.get_gameObject().SetActive(false);
        if (need_anim_event_res_cache && animator != null && lo_anim.loadedObjects != null && lo_anim.loadedObjects[1] != null)
        {
            AnimEventData tmpAnimEventData = lo_anim.loadedObjects[1].obj as AnimEventData;
            if (tmpAnimEventData != null)
            {
                if (enemy == null)
                {
                    load_queue.CacheAnimDataUseResource(tmpAnimEventData, null, null);
                }
                else
                {
                    LoadingQueue  loadingQueue  = load_queue;
                    AnimEventData animEventData = tmpAnimEventData;
                    Enemy         enemy2        = enemy;
                    loadingQueue.CacheAnimDataUseResource(animEventData, ((Character)enemy2).EffectNameAnalyzer, enemy.continusAtkEventDataList);
                }
                PreSetAnimationEventDataParamToEnemy(tmpAnimEventData, enemy);
            }
        }
        AnimEventData.ResidentEffectData[] residentEffectList = null;
        if (this.animEventData != null)
        {
            residentEffectList = this.animEventData.residentEffectDataList;
            if (residentEffectList != null)
            {
                int numEffect3 = residentEffectList.Length;
                for (int ef3 = 0; ef3 < numEffect3; ef3++)
                {
                    if (!string.IsNullOrEmpty(residentEffectList[ef3].effectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, residentEffectList[ef3].effectName);
                    }
                }
            }
        }
        if (param != null)
        {
            if (enemy != null || need_stamp_effect)
            {
                StageObject.StampInfo[] stampInfos = param.stampInfos;
                foreach (StageObject.StampInfo info4 in stampInfos)
                {
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info4.effectName);
                }
            }
            if (param.isHide)
            {
                FieldMapTable.GatherPointViewTableData viewData = Singleton <FieldMapTable> .I.GetGatherPointViewData(param.gatherPointViewId);

                if (viewData != null)
                {
                    if (!string.IsNullOrEmpty(viewData.targetEffectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, viewData.targetEffectName);
                    }
                    if (!string.IsNullOrEmpty(viewData.gatherEffectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, viewData.gatherEffectName);
                    }
                }
            }
            SystemEffectSetting sysEffectSetting2 = param.residentEffectSetting;
            if (sysEffectSetting2 != null)
            {
                SystemEffectSetting.Data[] effectDataList = sysEffectSetting2.effectDataList;
                if (effectDataList != null)
                {
                    int numEffect2 = effectDataList.Length;
                    for (int ef2 = 0; ef2 < numEffect2; ef2++)
                    {
                        if (!string.IsNullOrEmpty(effectDataList[ef2].effectName))
                        {
                            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, effectDataList[ef2].effectName);
                        }
                    }
                }
            }
        }
        if (load_queue.IsLoading())
        {
            yield return((object)load_queue.Wait());
        }
        if (enemy != null)
        {
            if (param != null)
            {
                EnemyTable.EnemyData data           = enemy.enemyTableData;
                AttackHitInfo[]      attackHitInfos = param.attackHitInfos;
                foreach (AttackHitInfo temp_info in attackHitInfos)
                {
                    AttackHitInfo info = temp_info;
                    if (!string.IsNullOrEmpty(data.convertRegionKey))
                    {
                        string          convert_name          = info.name + "_" + data.convertRegionKey;
                        AttackHitInfo[] convertAttackHitInfos = param.convertAttackHitInfos;
                        foreach (AttackHitInfo convert_info in convertAttackHitInfos)
                        {
                            if (convert_info.name == convert_name)
                            {
                                info = convert_info;
                                break;
                            }
                        }
                    }
                    if (info.hitSEID != 0)
                    {
                        load_queue.CacheSE(info.hitSEID, null);
                    }
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info.hitEffectName);
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info.remainEffectName);
                    load_queue.CacheBulletDataUseResource(info.bulletData, null);
                    RestraintInfo restInfo = temp_info.restraintInfo;
                    if (restInfo.enable && !string.IsNullOrEmpty(restInfo.effectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, restInfo.effectName);
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_target_flick");
                        if (temp_info.toPlayer.reactionType != 0)
                        {
                            Log.Error(LOG.INGAME, "Can't use reactionType with RestraintInfo!! " + temp_info.name);
                        }
                    }
                    GrabInfo grabInfo = temp_info.grabInfo;
                    if (grabInfo != null && grabInfo.enable && temp_info.toPlayer.reactionType != 0)
                    {
                        Log.Error(LOG.INGAME, "Can't use reactionType with GrabInfo!! " + temp_info.name);
                    }
                    InkSplashInfo inkSplashInfo = temp_info.inkSplashInfo;
                    if (inkSplashInfo != null && inkSplashInfo.duration > 0f)
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_pl_blind_01");
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_pl_blind_02");
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_target_flick");
                    }
                }
                AttackContinuationInfo[] attackContinuationInfos = param.attackContinuationInfos;
                foreach (AttackContinuationInfo temp_info2 in attackContinuationInfos)
                {
                    AttackContinuationInfo info2 = temp_info2;
                    if (!string.IsNullOrEmpty(data.convertRegionKey))
                    {
                        string convert_name2 = info2.name + "_" + data.convertRegionKey;
                        AttackContinuationInfo[] convertAttackContinuationInfos = param.convertAttackContinuationInfos;
                        foreach (AttackContinuationInfo convert_info2 in convertAttackContinuationInfos)
                        {
                            if (convert_info2.name == convert_name2)
                            {
                                info2 = convert_info2;
                                break;
                            }
                        }
                    }
                    load_queue.CacheBulletDataUseResource(info2.bulletData, null);
                }
                Enemy.RegionInfo[] regionInfos = param.regionInfos;
                foreach (Enemy.RegionInfo temp_info3 in regionInfos)
                {
                    Enemy.RegionInfo info3 = temp_info3;
                    if (!string.IsNullOrEmpty(data.convertRegionKey))
                    {
                        string             convert_name3      = info3.name + "_" + data.convertRegionKey;
                        Enemy.RegionInfo[] convertRegionInfos = param.convertRegionInfos;
                        foreach (Enemy.RegionInfo convert_info3 in convertRegionInfos)
                        {
                            if (convert_info3.name == convert_name3)
                            {
                                info3 = convert_info3;
                                break;
                            }
                        }
                    }
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info3.breakEffect.effectName);
                }
                if (Singleton <EnemyHitMaterialTable> .IsValid())
                {
                    int j = 0;
                    for (int len2 = param.regionInfos.Length; j < len2 + 1; j++)
                    {
                        string hit_material_name = (j >= len2) ? param.baseHitMaterialName : param.regionInfos[j].hitMaterialName;
                        if (!string.IsNullOrEmpty(hit_material_name))
                        {
                            EnemyHitMaterialTable.MaterialData check_data = Singleton <EnemyHitMaterialTable> .I.GetData(hit_material_name);

                            if (check_data != null)
                            {
                                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, check_data.addEffectName);
                                int[] typeSEIDs = check_data.typeSEIDs;
                                foreach (int type_se_id in typeSEIDs)
                                {
                                    if (type_se_id != 0)
                                    {
                                        load_queue.CacheSE(type_se_id, null);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (MonoBehaviourSingleton <InGameSettingsManager> .IsValid())
            {
                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, MonoBehaviourSingleton <GlobalSettingsManager> .I.linkResources.enemyParalyzeHitEffectName);
                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, MonoBehaviourSingleton <GlobalSettingsManager> .I.linkResources.enemyPoisonHitEffectName);
            }
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_enm_shock_01");
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_enm_fire_01");
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_pl_movedown_01");
            EffectPlayProcessor processor = body.get_gameObject().GetComponent <EffectPlayProcessor>();
            if (processor != null && processor.effectSettings != null)
            {
                enemy.effectPlayProcessor = processor;
                int i = 0;
                for (int len = processor.effectSettings.Length; i < len; i++)
                {
                    if (!string.IsNullOrEmpty(processor.effectSettings[i].effectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, processor.effectSettings[i].effectName);
                    }
                }
            }
            if (load_queue.IsLoading())
            {
                yield return((object)load_queue.Wait());
            }
        }
        body.get_gameObject().SetActive(true);
        if (residentEffectList != null)
        {
            int numEffect = residentEffectList.Length;
            for (int ef = 0; ef < numEffect; ef++)
            {
                AnimEventData.ResidentEffectData effectData = residentEffectList[ef];
                if (!string.IsNullOrEmpty(effectData.effectName) && !string.IsNullOrEmpty(effectData.linkNodeName))
                {
                    Transform parentTrans = Utility.Find(body.get_transform(), effectData.linkNodeName);
                    if (parentTrans == null)
                    {
                        parentTrans = body.get_transform();
                    }
                    Transform effectTrans = EffectManager.GetEffect(effectData.effectName, parentTrans);
                    if (effectTrans != null)
                    {
                        if (layer != -1)
                        {
                            Utility.SetLayerWithChildren(effectTrans, layer);
                        }
                        Vector3 basisScale = effectTrans.get_localScale();
                        effectTrans.set_localScale(basisScale * effectData.scale);
                        effectTrans.set_localPosition(effectData.offsetPos);
                        effectTrans.set_localRotation(Quaternion.Euler(effectData.offsetRot));
                        ResidentEffectObject residentEffect = effectTrans.get_gameObject().AddComponent <ResidentEffectObject>();
                        residentEffect.Initialize(effectData);
                        if (enemy != null)
                        {
                            enemy.RegisterResidentEffect(residentEffect);
                        }
                    }
                }
            }
        }
        if (param != null)
        {
            SystemEffectSetting sysEffectSetting = param.residentEffectSetting;
            SysEffectCreate(enemy, layer, sysEffectSetting);
        }
        if (need_shadow && param != null && param.shadowSize > 0f)
        {
            shadow = MonoBehaviourSingleton <GlobalSettingsManager> .I.linkResources.CreateShadow(param.shadowSize, param.bodyRadius, bodyScale, true, _this, shader_type == SHADER_TYPE.LIGHTWEIGHT);
        }
        if (enemy != null)
        {
            if (param != null)
            {
                param.SetParam(enemy);
                Object.DestroyImmediate(param);
            }
            if (enemy.controller != null)
            {
                enemy.controller.set_enabled(true);
            }
            enemy.willStock = will_stock;
            enemy.OnLoadComplete();
            if (enemy.packetReceiver != null)
            {
                enemy.packetReceiver.SetStopPacketUpdate(false);
            }
        }
        callback?.Invoke(enemy);
        if (lo_foundation != null)
        {
            foundation = lo_foundation.Realizes(_this, layer);
            foundation.SetParent(_this.get_parent(), true);
        }
        isLoading = false;
    }
 public AnimEventProcessor(AnimEventData anim_event_data, Animator _animator, IAnimEvent _listener)
 {
     animEventData = anim_event_data;
     animator      = _animator;
     listener      = _listener;
 }
Exemplo n.º 16
0
 // Called when animation event happens
 public override void OnAnimEvent(AnimEventData data)
 {
     base.OnAnimEvent(data);
 }