Наследование: global::ProtoBuf.IExtensible
        internal static Msg_RC_NpcSkill BuildNpcSkillMessage(EntityInfo obj, int skillId)
        {
            MovementStateInfo msi = obj.GetMovementStateInfo();
            ScriptRuntime.Vector3 pos = msi.GetPosition3D();

            Msg_RC_NpcSkill msg = new Msg_RC_NpcSkill();
            msg.npc_id = obj.GetId();
            msg.skill_id = skillId;
            msg.stand_pos = ProtoHelper.EncodePosition2D(pos.X, pos.Z);
            msg.face_direction = ProtoHelper.EncodeFloat(msi.GetFaceDir());
            msg.target_id = obj.GetAiStateInfo().Target;

            return msg;
        }
Пример #2
0
        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            Scene scene = instance.Context as Scene;
            if (null != scene) {
                int unitId = m_UnitId.Value;
                int skillId = m_SkillId.Value;
                Dictionary<string, object> locals = new Dictionary<string, object>();
                for (int i = 0; i < m_Args.Count - 1; i += 2) {
                    string key = m_Args[i].Value as string;
                    object val = m_Args[i + 1].Value;
                    if (!string.IsNullOrEmpty(key)) {
                        locals.Add(key, val);
                    }
                }
                EntityInfo obj = scene.SceneContext.GetEntityByUnitId(unitId);
                if (null != obj) {
                    SkillInfo skillInfo = obj.GetSkillStateInfo().GetSkillInfoById(skillId);
                    if (null != skillInfo) {
                        if (scene.SkillSystem.StartSkill(obj.GetId(), skillInfo.ConfigData, 0, locals)) {
                            Msg_RC_NpcSkill skillBuilder = new Msg_RC_NpcSkill();
                            skillBuilder.npc_id = obj.GetId();
                            skillBuilder.skill_id = skillId;
                            float x = obj.GetMovementStateInfo().GetPosition3D().X;
                            float z = obj.GetMovementStateInfo().GetPosition3D().Z;
                            skillBuilder.stand_pos = ProtoHelper.EncodePosition2D(x, z);
                            skillBuilder.face_direction = ProtoHelper.EncodeFloat(obj.GetMovementStateInfo().GetFaceDir());

                            scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcSkill, skillBuilder);
                        }
                    }
                }
            }
            return false;
        }