internal static void AdjustCharacterPosition(int id, float x, float z, double time, float dir)
        {
            CharacterInfo info = WorldSystem.Instance.GetCharacterById(id);

            if (null != info)
            {
                MovementStateInfo msi = info.GetMovementStateInfo();
                if (time < 1000)
                {
                    Vector3 pos      = msi.GetPosition3D();
                    double  speed    = info.GetActualProperty().MoveSpeed;
                    double  distance = (speed * time) / 1000;
                    double  len      = pos.Length();
                    float   nz       = (float)(z + distance * Math.Cos(dir));
                    float   nx       = (float)(x + distance * Math.Sin(dir));
                    float   dx       = nx - pos.X;
                    float   dz       = nz - pos.Z;
                    float   distSqr  = dx * dx + dz * dz;
                    if (distSqr > 0)
                    {
                        msi.SetPosition2D(x, z);

                        CharacterView view = EntityManager.Instance.GetCharacterViewById(info.GetId());
                        if (null != view)
                        {
                            GfxSystem.UpdateGameObjectLocalPosition2D(view.Actor, x, z);
                        }

                        //LogSystem.Debug("PositionController start, id:{0} dx:{1} dz:{2} time:{3}, just move to pos", id, dx, dz, time);
                    }
                    else
                    {
                        CharacterView view = EntityManager.Instance.GetCharacterViewById(info.GetId());
                        if (null != view)
                        {
                            lock (GfxSystem.SyncLock)
                            {
                                view.ObjectInfo.AdjustDx  = dx;
                                view.ObjectInfo.AdjustDz  = dz;
                                view.ObjectInfo.CurTime   = 0.0f;
                                view.ObjectInfo.TotalTime = 0.5f;
                            }
                        }
                        //LogSystem.Debug("PositionController start, id:{0} dx:{1} dz:{2} time:{3}", id, dx, dz, time);
                    }
                }
                else
                {
                    msi.SetPosition2D(x, z);

                    CharacterView view = EntityManager.Instance.GetCharacterViewById(info.GetId());
                    if (null != view)
                    {
                        GfxSystem.UpdateGameObjectLocalPosition2D(view.Actor, x, z);
                    }

                    //LogSystem.Debug("PositionController just move to pos, id:{0} x:{1} z:{2}", id, x, z);
                }
            }
        }
Пример #2
0
        public void OnGfxStopSkill(int id, int skillId)
        {
            CharacterInfo charObj = WorldSystem.Instance.GetCharacterById(id);

            if (null != charObj)
            {
                if ((WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene()) && skillId != charObj.Combat2IdleSkill)
                {
                    if (charObj.GetId() == WorldSystem.Instance.PlayerSelfId || charObj.OwnerId == WorldSystem.Instance.PlayerSelfId)
                    {
                        //LogSystem.Debug("---ongfxstopskill id={0}, skillid=", id, skillId);
                        Network.NetworkSystem.Instance.SyncPlayerStopSkill(charObj, skillId);
                    }
                }
                if (skillId == charObj.Combat2IdleSkill)
                {
                    CharacterView userview = EntityManager.Instance.GetCharacterViewById(id);
                    if (userview != null)
                    {
                        userview.OnCombat2IdleSkillOver();
                    }
                }
                SkillInfo skillInfo = charObj.GetSkillStateInfo().GetSkillInfoById(skillId);
                if (null != skillInfo)
                {
                    skillInfo.IsSkillActivated = false;
                    //LogSystem.Debug("-----OnGfxStopSkill " + skillId);
                }
            }
        }
Пример #3
0
        private void OnNpcMeetEnemy(NpcInfo npc, Animation_Type animType)
        {
            CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());

            if (null != view)
            {
                GfxSystem.SendMessage(view.Actor, "OnEventMeetEnemy", null);
            }
            ImpactSystem.Instance.SendImpactToCharacter(npc, npc.GetMeetEnemyImpact(), npc.GetId(), -1, -1, npc.GetMovementStateInfo().GetPosition3D(), npc.GetMovementStateInfo().GetFaceDir());
        }
Пример #4
0
        internal CharacterView GetCharacterViewById(int objId)
        {
            CharacterView view = GetUserViewById(objId);

            if (null == view)
            {
                view = GetNpcViewById(objId);
            }
            return(view);
        }
Пример #5
0
        internal bool IsVisible(int objId)
        {
            bool          ret  = false;
            CharacterView view = GetCharacterViewById(objId);

            if (null != view)
            {
                ret = view.Visible;
            }
            return(ret);
        }
        public override bool StopSkill(SkillNode node, int breaktype)
        {
            if (!IsSkillActive(node))
            {
                return(true);
            }
            bool   isinterrupt;
            string skillmessage;

            if (!IsSkillCanBreak(node, breaktype, out isinterrupt, out skillmessage))
            {
                return(false);
            }
            CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());

            if (view != null)
            {
                if (!string.IsNullOrEmpty(skillmessage))
                {
                    GfxSystem.QueueGfxAction(m_GfxSkillSystem.SendMessage, view.Actor, node.SkillId, skillmessage);
                    return(false);
                }
                //技能打断时逻辑层处理状态(包括技能激活状态与移动控制状态)并通知服务器,Gfx层不再处理状态
                if (isinterrupt)
                {
                    m_Owner.GetMovementStateInfo().IsSkillMoving = false;
                    view.ObjectInfo.IsSkillGfxMoveControl   = false;
                    view.ObjectInfo.IsSkillGfxRotateControl = false;
                    view.ObjectInfo.IsSkillGfxAnimation     = false;
                    SkillInfo skillInfo = m_Owner.GetSkillStateInfo().GetSkillInfoById(node.SkillId);
                    if (null != skillInfo)
                    {
                        skillInfo.IsSkillActivated = false;
                        //LogSystem.Debug("---------StopSkill " + node.SkillId);
                    }
                    if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
                    {
                        if (m_Owner.GetId() == WorldSystem.Instance.PlayerSelfId || m_Owner.OwnerId == WorldSystem.Instance.PlayerSelfId)
                        {
                            Network.NetworkSystem.Instance.SyncGfxMoveControlStop(m_Owner, node.SkillId, true);
                            Network.NetworkSystem.Instance.SyncPlayerStopSkill(m_Owner, node.SkillId);
                        }
                    }
                }
                //通知Gfx停止技能
                GfxSystem.QueueGfxAction(m_GfxSkillSystem.StopSkill, view.Actor, isinterrupt);
                SimulateStopSkill(m_Owner);
            }
            return(true);
        }
Пример #7
0
        private void OnDropoutPlayEffect(UserInfo user, NpcInfo npc, string effect, string path, int dropType, int dropNum)
        {
            CharacterView view = EntityManager.Instance.GetCharacterViewById(user.GetId());

            if (null != view)
            {
                if (!String.IsNullOrEmpty(effect))
                {
                    GfxSystem.CreateAndAttachGameObject(effect, view.Actor, path, 1.0f);
                }
                GfxSystem.PlaySound(view.Actor, "Sound/Scene/UI_UP_PickupMoney", user.GetMovementStateInfo().GetFaceDir());
            }
            Network.NetworkSystem.Instance.SyncPickUpNpc(npc);
        }
Пример #8
0
 private void Release()
 {
     if (ObjectInfo.SummonOwnerActorId > 0)
     {
         CharacterInfo owner = WorldSystem.Instance.GetCharacterById(m_Npc.SummonOwnerId);
         if (owner != null)
         {
             owner.GetSkillStateInfo().RecyleSummonObject(m_Npc);
         }
         CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(m_Npc.SummonOwnerId);
         if (owner_view != null)
         {
             owner_view.ObjectInfo.Summons.Remove(Actor);
         }
     }
 }
        public override void ForceInterruptCurSkill()
        {
            //LogSystem.Debug("----forceInterruptCurskill! " + m_Owner.GetId());
            CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());

            if (null != view)
            {
                m_Owner.GetMovementStateInfo().IsSkillMoving = false;
                view.ObjectInfo.IsSkillGfxMoveControl   = false;
                view.ObjectInfo.IsSkillGfxRotateControl = false;
                view.ObjectInfo.IsSkillGfxAnimation     = false;
                SkillInfo skill_info = m_Owner.GetSkillStateInfo().GetCurSkillInfo();
                if (skill_info != null)
                {
                    if (skill_info.IsSkillActivated)
                    {
                        if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
                        {
                            if (m_Owner.GetId() == WorldSystem.Instance.PlayerSelfId || m_Owner.OwnerId == WorldSystem.Instance.PlayerSelfId)
                            {
                                Network.NetworkSystem.Instance.SyncGfxMoveControlStop(m_Owner, skill_info.SkillId, true);
                                Network.NetworkSystem.Instance.SyncPlayerStopSkill(m_Owner, skill_info.SkillId);
                            }
                        }
                        skill_info.IsInterrupted = true;
                        if (m_WaiteSkillBuffer.Count > 0)
                        {
                            SkillNode last      = m_WaiteSkillBuffer[m_WaiteSkillBuffer.Count - 1];
                            SkillInfo last_info = m_Owner.GetSkillStateInfo().GetSkillInfoById(last.SkillId);
                            m_WaiteSkillBuffer.Clear();
                            if (last_info != null && last_info.ConfigData.CanStartWhenStiffness)
                            {
                                m_WaiteSkillBuffer.Add(last);
                            }
                        }
                    }
                    skill_info.IsSkillActivated = false;
                    LogSystem.Debug("skill force interrupted " + skill_info.SkillId);
                }
                GfxSystem.QueueGfxAction(m_GfxSkillSystem.StopSkill, view.Actor, true);
                SimulateStopSkill(m_Owner);
            }
        }
Пример #10
0
        protected void SimulateMove()
        {
            if (!m_Npc.IsSimulateMove)
            {
                return;
            }
            if (m_Npc.SummonOwnerId < 0)
            {
                return;
            }
            CharacterInfo owner = WorldSystem.Instance.GetCharacterById(m_Npc.SummonOwnerId);

            if (owner == null)
            {
                return;
            }
            CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(m_Npc.SummonOwnerId);

            if (owner_view == null)
            {
                return;
            }
            MovementStateInfo msi     = m_Npc.GetMovementStateInfo();
            MovementStateInfo sim_msi = owner.GetMovementStateInfo();

            m_Npc.GetActualProperty().SetMoveSpeed(Operate_Type.OT_Absolute, owner.GetActualProperty().MoveSpeed);
            m_Npc.VelocityCoefficient = owner.VelocityCoefficient;
            if (owner_view.ObjectInfo.IsGfxMoveControl)
            {
                msi.IsMoving = false;
            }
            else
            {
                msi.IsMoving = sim_msi.IsMoving;
            }
            msi.SetFaceDir(sim_msi.GetFaceDir());
            msi.SetWantFaceDir(sim_msi.GetWantFaceDir());
            msi.SetMoveDir(sim_msi.GetMoveDir());
        }
Пример #11
0
        public void OnGfxSimulateMove(int id)
        {
            NpcInfo npc = WorldSystem.Instance.GetCharacterById(id) as NpcInfo;

            if (npc == null)
            {
                return;
            }
            if (npc.SummonOwnerId < 0)
            {
                return;
            }
            CharacterInfo owner = WorldSystem.Instance.GetCharacterById(npc.SummonOwnerId);

            if (owner == null)
            {
                return;
            }
            CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(npc.SummonOwnerId);

            if (owner_view == null)
            {
                return;
            }
            npc.GetActualProperty().SetMoveSpeed(Operate_Type.OT_Absolute, owner.GetActualProperty().MoveSpeed);
            npc.VelocityCoefficient    = owner.VelocityCoefficient;
            npc.Combat2IdleSkill       = owner.Combat2IdleSkill;
            npc.Combat2IdleTime        = owner.Combat2IdleTime;
            npc.Idle2CombatWeaponMoves = owner.Idle2CombatWeaponMoves;
            List <SkillInfo> skills = owner.GetSkillStateInfo().GetAllSkill();

            npc.GetSkillStateInfo().AddSkill(new SkillInfo(npc.Combat2IdleSkill));
            foreach (SkillInfo si in skills)
            {
                npc.GetSkillStateInfo().AddSkill(new SkillInfo(si.SkillId));
            }
            npc.SkillController.Init();
            npc.IsSimulateMove = true;
        }
Пример #12
0
        protected void SimulateState()
        {
            CharacterInfo owner = WorldSystem.Instance.GetCharacterById(m_Npc.SummonOwnerId);

            if (owner == null)
            {
                return;
            }
            CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(m_Npc.SummonOwnerId);

            if (owner_view == null)
            {
                return;
            }
            if (m_IsCombatState != owner_view.IsCombatState)
            {
                if (!m_IsCombatState)
                {
                    EnterCombatState();
                }
            }
        }
        public override bool StartSkill(SkillNode node)
        {
            if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
            {
                if (m_Owner.GetId() == WorldSystem.Instance.PlayerSelfId || m_Owner.OwnerId == WorldSystem.Instance.PlayerSelfId)
                {
                    Network.NetworkSystem.Instance.SyncPlayerSkill(m_Owner, node.SkillId);
                }
            }
            else
            {
                if (!MakeSkillCost(node))
                {
                    return(false);
                }
            }
            m_Owner.ResetCross2StandRunTime();
            m_Owner.GetSkillStateInfo().SetCurSkillInfo(node.SkillId);
            SkillInfo cur_skill = m_Owner.GetSkillStateInfo().GetCurSkillInfo();

            if (null == cur_skill)
            {
                LogSystem.Error("----------SkillError: {0} set cur skill {1} failed! it's not exist", m_Owner.GetId(), node.SkillId);
                return(false);
            }
            cur_skill.IsSkillActivated = true;
            cur_skill.IsInterrupted    = false;
            cur_skill.StartTime        = TimeUtility.GetLocalMilliseconds() / 1000.0f;
            UpdateSkillCD(node);
            //LogSystem.Debug("---start skill at {0}--{1}", cur_skill.SkillId, cur_skill.StartTime);
            CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());

            if (view != null)
            {
                GfxSystem.QueueGfxAction(m_GfxSkillSystem.StartSkill, view.Actor, node.SkillId, m_Owner.GetMovementStateInfo().GetWantFaceDir());
            }
            SimulateStartSkill(m_Owner, node.SkillId);
            return(true);
        }
        public override bool ForceStartSkill(int skillid)
        {
            m_Owner.GetSkillStateInfo().SetCurSkillInfo(skillid);
            SkillInfo cur_skill = m_Owner.GetSkillStateInfo().GetCurSkillInfo();

            if (null == cur_skill)
            {
                LogSystem.Error("----------ForceStartSkillError: {0} set cur skill {1} failed! it's not exist", m_Owner.GetId(), skillid);
                return(false);
            }
            if (cur_skill.SkillId != skillid)
            {
                LogSystem.Debug("----------ForceStartSkillError: {0} set cur skill {1} failed! it's {2}", m_Owner.GetId(), skillid, cur_skill.SkillId);
                return(false);
            }
            if (null != cur_skill)
            {
                cur_skill.IsSkillActivated = true;
                cur_skill.IsInterrupted    = false;
                cur_skill.StartTime        = TimeUtility.GetLocalMilliseconds() / 1000.0f;
                //LogSystem.Debug("---force start skill at {0}--{1}", cur_skill.SkillId, cur_skill.StartTime);
                CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());
                if (view != null)
                {
                    GfxSystem.QueueGfxAction(m_GfxSkillSystem.StartSkill, view.Actor, skillid, m_Owner.GetMovementStateInfo().GetWantFaceDir());
                }
            }
            else
            {
                List <SkillInfo> skills = m_Owner.GetSkillStateInfo().GetAllSkill();
                LogSystem.Error("Can't find skill {0}, obj has {1} skills", skillid, skills.Count);
                foreach (SkillInfo info in skills)
                {
                    LogSystem.Error("\tskill {0}", info.SkillId);
                }
            }
            SimulateStartSkill(m_Owner, skillid);
            return(true);
        }
Пример #15
0
        private void UpdateMoveState(UserInfo playerself, Vector3 targetpos, float towards)
        {
            CharacterView view = EntityManager.Instance.GetUserViewById(playerself.GetId());

            if (view != null && view.ObjectInfo.IsGfxMoveControl && Geometry.IsSamePoint(Vector3.Zero, targetpos))
            {
                //LogSystem.Debug("UpdateMoveState IsGfxMoveControl : {0} , targetpos : {1}", view.ObjectInfo.IsGfxMoveControl, targetpos.ToString());
                return;
            }
            PlayerMovement.Motion m = Geometry.IsSamePoint(Vector3.Zero, targetpos) ? PlayerMovement.Motion.Stop : PlayerMovement.Motion.Moving;
            pm_.JoyStickMotionChanged = pm_.JoyStickMotionStatus != m || !Geometry.IsSameFloat(m_lastDir, towards);
            pm_.JoyStickMotionStatus  = m;
            pm_.MoveDir = towards;
            if (Geometry.IsSamePoint(Vector3.Zero, targetpos))
            {
                pm_.JoyStickMotionStatus = PlayerMovement.Motion.Stop;
                m_IsJoystickControl      = false;
            }
            else
            {
                m_IsJoystickControl = true;
            }
        }
Пример #16
0
        private void SummonPartner(int key_code, int what)
        {
            RoleInfo roleself = LobbyClient.Instance.CurrentRole;

            if (null == roleself)
            {
                return;
            }
            UserInfo playerself = WorldSystem.Instance.GetPlayerSelf();

            if (null == playerself)
            {
                return;
            }
            ///
            if ((int)Keyboard.Event.Up == what)
            {
                // summonpartner
                PartnerInfo partnerInfo = roleself.PartnerStateInfo.GetActivePartner();
                if (null != partnerInfo)
                {
                    Data_Unit data = new Data_Unit();
                    data.m_Id         = -1;
                    data.m_LinkId     = partnerInfo.LinkId;
                    data.m_CampId     = playerself.GetCampId();
                    data.m_Pos        = playerself.GetMovementStateInfo().GetPosition3D();
                    data.m_RotAngle   = 0;
                    data.m_AiLogic    = partnerInfo.GetAiLogic();
                    data.m_AiParam[0] = "";
                    data.m_AiParam[1] = "";
                    data.m_AiParam[2] = partnerInfo.GetAiParam().ToString();
                    data.m_IsEnable   = true;
                    NpcInfo npc = WorldSystem.Instance.NpcManager.AddNpc(data);
                    if (null != npc)
                    {
                        AppendAttributeConfig aac       = AppendAttributeConfigProvider.Instance.GetDataById(partnerInfo.GetAppendAttrConfigId());
                        float inheritAttackAttrPercent  = partnerInfo.GetInheritAttackAttrPercent();
                        float inheritDefenceAttrPercent = partnerInfo.GetInheritDefenceAttrPercent();
                        if (null != aac)
                        {
                            // attack
                            npc.GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().AttackBase *inheritAttackAttrPercent));
                            npc.GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonDamage *inheritAttackAttrPercent);
                            // defence
                            npc.GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().HpMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().EnergyMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().ADefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().MDefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonERD *inheritDefenceAttrPercent);
                            // reset hp & energy
                            npc.SetHp(Operate_Type.OT_Absolute, npc.GetActualProperty().HpMax);
                            npc.SetEnergy(Operate_Type.OT_Absolute, npc.GetActualProperty().EnergyMax);
                        }
                        npc.SetAIEnable(true);
                        npc.GetSkillStateInfo().RemoveAllSkill();
                        npc.BornTime = TimeUtility.GetServerMilliseconds();
                        List <int> skillList = partnerInfo.GetSkillList();
                        if (null != skillList)
                        {
                            for (int i = 0; i < skillList.Count; ++i)
                            {
                                SkillInfo skillInfo = new SkillInfo(skillList[i]);
                                npc.GetSkillStateInfo().AddSkill(skillInfo);
                            }
                        }
                        npc.SkillController  = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance);
                        npc.OwnerId          = playerself.GetId();
                        playerself.PartnerId = npc.GetId();
                        EntityManager.Instance.CreateNpcView(npc.GetId());
                        if (partnerInfo.BornSkill > 0)
                        {
                            SkillInfo skillInfo = new SkillInfo(partnerInfo.BornSkill);
                            npc.GetSkillStateInfo().AddSkill(skillInfo);
                            npc.SkillController.ForceStartSkill(partnerInfo.BornSkill);
                        }
                        CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());
                        if (null != view)
                        {
                            GfxSystem.SetLayer(view.Actor, "PhysicObj");
                        }
                    }
                }
            }
        }
Пример #17
0
        public static NpcInfo SummonNpc(int id, int owner_id, int owner_skillid, int npc_type_id,
                                        string modelPrefab, int skillid,
                                        int ailogicid, bool followsummonerdead,
                                        float x, float y, float z, string aiparamstr, int signforskill, bool isSimulate = false,
                                        bool is_start_skill = true)
        {
            CharacterInfo charObj = WorldSystem.Instance.GetCharacterById(owner_id);

            if (charObj == null)
            {
                return(null);
            }
            Data_Unit data = new Data_Unit();

            data.m_Id       = -1;
            data.m_LinkId   = npc_type_id;
            data.m_CampId   = charObj.GetCampId();
            data.m_IsEnable = true;
            data.m_Pos      = new Vector3(x, y, z);
            data.m_RotAngle = 0;
            data.m_AiLogic  = ailogicid;
            if (!string.IsNullOrEmpty(aiparamstr))
            {
                string[] strarry = aiparamstr.Split(new char[] { ',' }, 8);
                int      i       = 0;
                foreach (string str in strarry)
                {
                    data.m_AiParam[i++] = str;
                }
            }
            NpcInfo npc;

            if (id <= 0)
            {
                npc = WorldSystem.Instance.NpcManager.AddNpc(data);
            }
            else
            {
                npc = WorldSystem.Instance.NpcManager.AddNpc(id, data);
            }
            if (WorldSystem.Instance.IsExpeditionScene() || WorldSystem.Instance.IsMultiPveScene())
            {
                float             fightscore = 0;
                CharacterProperty info       = charObj.GetActualProperty();
                if (null != info)
                {
                    CharacterProperty base_info                  = charObj.GetBaseProperty();
                    float             assit_critical_pow         = (null != base_info ? info.CriticalPow - base_info.CriticalPow : info.CriticalPow);
                    float             assit_critical_backhit_pow = (null != base_info ? info.CriticalBackHitPow - base_info.CriticalBackHitPow : info.CriticalBackHitPow);
                    float             assit_critical_crack_pow   = (null != base_info ? info.CriticalCrackPow - base_info.CriticalCrackPow : info.CriticalCrackPow);
                    fightscore = AttributeScoreConfigProvider.Instance.CalcAttributeScore(info.HpMax,
                                                                                          info.EnergyMax, info.AttackBase, info.ADefenceBase, info.MDefenceBase, info.Critical,
                                                                                          assit_critical_pow, assit_critical_backhit_pow, assit_critical_crack_pow, info.FireDamage,
                                                                                          info.IceDamage, info.PoisonDamage, info.FireERD, info.IceERD, info.PoisonERD) + charObj.GetSkillStateInfo().GetSkillAppendScore();
                }
                WorldSystem.Instance.AdditionNpcAttr(npc, Mathf.FloorToInt(fightscore));
            }
            if (!string.IsNullOrEmpty(modelPrefab))
            {
                npc.SetModel(modelPrefab);
            }
            npc.FollowSummonerDead = followsummonerdead;
            SkillInfo skillinfo = new SkillInfo(skillid);

            npc.GetSkillStateInfo().AddSkill(skillinfo);
            npc.SkillController = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance);
            npc.GetMovementStateInfo().SetPosition(data.m_Pos);
            npc.SummonOwnerId = charObj.GetId();
            npc.SignForSkill  = signforskill;
            EntityManager.Instance.CreateNpcView(npc.GetId());
            charObj.GetSkillStateInfo().AddSummonObject(npc);
            NpcView       npcview    = EntityManager.Instance.GetNpcViewById(npc.GetId());
            CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(charObj.GetId());

            npcview.ObjectInfo.SummonOwnerActorId = owner_view.Actor;
            npcview.ObjectInfo.SummonOwnerSkillId = owner_skillid;
            npcview.ObjectInfo.SignForSkill       = signforskill;
            npcview.ObjectInfo.IsSimulate         = isSimulate;
            if (ailogicid > 0)
            {
                npcview.ObjectInfo.IsSummonWithAI = true;
            }
            //LogSystem.Debug("---summon npc: issimulate=" + isSimulate);
            owner_view.ObjectInfo.Summons.Add(npcview.Actor);

            if (is_start_skill)
            {
                npc.SkillController.ForceStartSkill(skillid);
            }
            //LogSystem.Debug("---create summon npc over!");
            return(npc);
        }
Пример #18
0
 private void TouchHandle(int what, GestureArgs e)
 {
     try
     {
         UserInfo playerself = WorldSystem.Instance.GetPlayerSelf();
         if (null == playerself || null == e)
         {
             return;
         }
         CharacterView view = EntityManager.Instance.GetUserViewById(playerself.GetId());
         if (null != playerself.SkillController &&
             playerself.SkillController.GetSkillControlMode() != SkillControlMode.kTouch)
         {
             return;
         }
         if ((int)TouchEvent.Cesture == what)
         {
             string ename = e.name;
             if (GestureEvent.OnSingleTap.ToString() == ename)
             {
                 if (EnableMoveInput)
                 {
                     if (WorldSystem.Instance.IsPureClientScene() || WorldSystem.Instance.IsPveScene())
                     {
                         if (e.selectedObjID < 0)
                         {
                             playerself.SkillController.AddBreakSkillTask();
                             if (InputType.Touch == e.inputType)
                             {
                                 FindPath(new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ));
                             }
                             else if (InputType.Joystick == e.inputType)
                             {
                                 UpdateMoveState(playerself, new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ), e.towards);
                             }
                             UpdateTowards(playerself, e.towards);
                         }
                         else
                         {
                             Combat(playerself, e.selectedObjID, e.attackRange);
                         }
                         m_lastSelectObjId = e.selectedObjID;
                         ///
                         // GfxSystem.PublishGfxEvent("Op_InputEffect", "Input", GestureEvent.OnSingleTap, e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ, e.selectedObjID < 0 ? false : true, true);
                     }
                     else if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
                     {
                         if (e.selectedObjID < 0)
                         {
                             if (InputType.Touch == e.inputType)
                             {
                                 NetworkSystem.Instance.SyncPlayerMoveToPos(new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ));
                             }
                             else if (InputType.Joystick == e.inputType)
                             {
                                 UpdateMoveState(playerself, new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ), e.towards);
                                 playerself.SkillController.AddBreakSkillTask();
                             }
                         }
                         else
                         {
                             NetworkSystem.Instance.SyncPlayerMoveToAttack(e.selectedObjID, e.attackRange);
                         }
                     }
                 }
             }
             else if (GestureEvent.OnFingerMove.ToString() == ename)
             {
                 if (EnableMoveInput)
                 {
                     if (view.ObjectInfo.IsGfxMoveControl && !view.ObjectInfo.IsGfxRotateControl)
                     {
                         UpdateTowards(playerself, e.towards);
                     }
                 }
             }
             else if (GestureEvent.OnSkillStart.ToString() == ename)
             {
                 if (null != playerself)
                 {
                     UserAiStateInfo info = playerself.GetAiStateInfo();
                     if ((int)AiStateId.Move == info.CurState)
                     {
                         StopFindPath(playerself, info);
                     }
                 }
             }
             else if (GestureEvent.OnEasyGesture.ToString() == ename)
             {
                 Vector3 targetpos = new Vector3(e.startGamePosX, e.startGamePosY, e.startGamePosZ);
                 if (Vector3.Zero != targetpos)
                 {
                     PushSkill(playerself, targetpos, e.attackRange);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }