Exemple #1
0
        protected override void Load(ScriptableData.FunctionData funcData)
        {
            ScriptableData.CallData callData = funcData.Call;
            if (null != callData)
            {
                Load(callData);

                for (int i = 0; i < funcData.Statements.Count; i++)
                {
                    ScriptableData.CallData stCall = funcData.Statements[i] as ScriptableData.CallData;
                    if (null != stCall)
                    {
                        string id = stCall.GetId();
                        if (id == "stateimpact")
                        {
                            StateImpact stateimpact = TriggerUtil.ParseStateImpact(stCall);
                            m_StateImpacts[stateimpact.m_State] = stateimpact;
                        }
                        else if (id == "showtip")
                        {
                            m_IsShowTip = true;
                            m_ShowTime  = long.Parse(stCall.GetParamId(0));
                            if (stCall.GetParamNum() >= 4)
                            {
                                float r = float.Parse(stCall.GetParamId(1));
                                float g = float.Parse(stCall.GetParamId(2));
                                float b = float.Parse(stCall.GetParamId(3));
                                m_Color = new UnityEngine.Color(r, g, b, 1);
                            }
                        }
                    }
                }

                /*
                 * foreach (ScriptableData.ISyntaxComponent statement in funcData.Statements) {
                 * ScriptableData.CallData stCall = statement as ScriptableData.CallData;
                 * if (null != stCall) {
                 *  string id = stCall.GetId();
                 *  if (id == "stateimpact") {
                 *    StateImpact stateimpact = TriggerUtil.ParseStateImpact(stCall);
                 *    m_StateImpacts[stateimpact.m_State] = stateimpact;
                 *  } else if (id == "showtip") {
                 *    m_IsShowTip = true;
                 *    m_ShowTime = long.Parse(stCall.GetParamId(0));
                 *    if (stCall.GetParamNum() >= 4) {
                 *      float r = float.Parse(stCall.GetParamId(1));
                 *      float g = float.Parse(stCall.GetParamId(2));
                 *      float b = float.Parse(stCall.GetParamId(3));
                 *      m_Color = new Color(r, g, b, 1);
                 *    }
                 *  }
                 * }
                 * }*/
            }
        }
        public static StateImpact ParseStateImpact(ScriptableData.CallData stCall)
        {
            StateImpact stateimpact = new StateImpact();

            stateimpact.m_State = GetBeHitStateFromStr(stCall.GetParamId(0));
            for (int i = 1; i < stCall.GetParamNum(); i = i + 2)
            {
                ImpactData im = new ImpactData();
                im.ImpactId = int.Parse(stCall.GetParamId(i));
                if (stCall.GetParamNum() > i + 1)
                {
                    im.RemainTime = int.Parse(stCall.GetParamId(i + 1));
                }
                else
                {
                    im.RemainTime = -1;
                }
                stateimpact.m_Impacts.Add(im);
            }
            return(stateimpact);
        }
Exemple #3
0
        public void SendImpactToObject(GameObject source, GameObject target, Dictionary <BeHitState, StateImpact> stateimpacts, int skillid, long hit_count_id)
        {
            if (stateimpacts == null)
            {
                return;
            }
            if (IsUserStandUp(target))
            {
                return;
            }
            BeHitState  state       = GetBeHitState(target);
            StateImpact stateimpact = null;

            if (!stateimpacts.TryGetValue(state, out stateimpact))
            {
                stateimpacts.TryGetValue(BeHitState.kDefault, out stateimpact);
            }
            if (stateimpact == null)
            {
                return;
            }
            int        final_skill_id = -1;
            GameObject damageOwner    = TriggerUtil.GetFinalOwner(source, skillid, out final_skill_id);

            //Debug.Log("------------send impact to object " + target.name);
            for (int i = 0; i < stateimpact.m_Impacts.Count; i++)
            {
                LogicSystem.NotifyGfxHitTarget(damageOwner, stateimpact.m_Impacts[i].ImpactId, target, 1, final_skill_id,
                                               stateimpact.m_Impacts[i].RemainTime, source.transform.position,
                                               TriggerUtil.GetObjFaceDir(source), hit_count_id);
            }

            /*
             * foreach (ImpactData im in stateimpact.m_Impacts) {
             * LogicSystem.NotifyGfxHitTarget(damageOwner, im.ImpactId, target, 1, final_skill_id,
             *                                        im.RemainTime, source.transform.position,
             *                                        TriggerUtil.GetObjFaceDir(source), hit_count_id);
             * }*/
        }
        private void LoadStateImpactConfig(ScriptableData.CallData stCall)
        {
            StateImpact stateimpact = TriggerUtil.ParseStateImpact(stCall);

            m_StateImpacts[stateimpact.m_State] = stateimpact;
        }