Пример #1
0
        public override void OnEnter(Buff _ownerBuff)
        {
            base.OnEnter(_ownerBuff);

            skillIndex = -1;

            //     owner.BreakSkillWhenHit(ownerBuff.skillID);

            //玩家不可以操作方向
            owner.ReqirueCanNotBeControlledByInput();
            FroceToNormalAttack();
            tag = owner.ForbidToUseSkill();
            ActorAgent aa = owner.GetComponent <ActorAgent>();

            if (aa != null)
            {
                if (aa.enabled == true)
                {
                    aa.enabled = false;
                    hasAI      = true;
                }
                else
                {
                    hasAI = false;
                }
            }
        }
Пример #2
0
        public override void OnExit()
        {
            base.OnExit();
            owner.AllowToUseSkill(tag);

            //恢复玩家操作方向
            owner.ReleaseCanNotBeControlledByInput();

            if (hasAI)
            {
                ActorAgent aa = owner.GetComponent <ActorAgent>();
                if (aa != null)
                {
                    aa.enabled = true;
                }
            }
        }
Пример #3
0
        // Use this for initialization
        void Start()
        {
            CancelInvoke("Start");
            ////
            //m_skillBase = this.transform.root.gameObject.GetComponent<SkillBase>();
            if (m_skillBase == null || m_skillBase.m_actor == null)
            {
                return;
            }

            // 普通分身不产生分身
            if (m_skillBase.m_actor.m_bSummonMonster)
            {
                return;
            }

            // 是否删除之前召唤的生物
            if (m_summonDesc.killBefore == 1)
            {
                if (m_skillBase.m_actor.m_skillSummonList == null)
                {
                    m_skillBase.m_actor.m_skillSummonList = new List <ActorObj.SummonData>();
                }

                int index = 0;
                while (true)
                {
                    if (m_skillBase.m_actor.m_skillSummonList.Count <= index)
                    {
                        break;
                    }
                    ActorObj.SummonData summon = m_skillBase.m_actor.m_skillSummonList[index];
                    if (m_skillBase.m_actor.m_skillSummonList[index].SummonID == m_summonDesc.npcID)
                    {
                        OnSummonDeath(m_skillBase.m_actor.m_skillSummonList[index].entityid);
                        m_skillBase.m_actor.m_skillSummonList.Remove(summon);
                    }
                    else
                    {
                        index++;
                    }
                }
            }

            Vector3 origin = m_skillBase.m_actor.transform.position;


            int POS_TYPE_TARGET = 6;

            for (int i = 0; i < m_summonDesc.npcCount; i++)
            {
                Vector3 summonPos = GetSummonPos(m_skillBase.m_actor.transform, i);

                if (m_summonDesc.npcPosType == POS_TYPE_TARGET) //召唤位置在敌方脚下
                {
                    ActorObj actorObj = m_skillBase.m_actor.GetAttackObj();

                    if (actorObj == null)
                    {
                        actorObj = m_skillBase.m_hitActor;
                    }
                    else
                    {
                        return;
                    }

                    summonPos = actorObj.transform.position;
                }
                else
                {
                    summonPos = GetSummonPos(m_skillBase.m_actor.transform, i);
                }


                if (summonPos != Vector3.zero)
                {
                    // 是否有障碍
                    Vector3 bornPos = BaseTool.instance.GetWallHitPoint(origin, summonPos);
                    // 地面高度
                    bornPos = BaseTool.instance.GetGroundPoint(bornPos);
                    // 载入
                    GameObject obj = null;

                    if (m_summonDesc.summonType == 2)
                    {
                        CoreEntry.gObjPoolMgr.PushToPool(m_skillBase.m_actor.resid); // 加到对象池子里
                        CoreEntry.gGameMgr.SpawnMonster(m_skillBase.m_actor.resid, bornPos, out obj);
                    }
                    else
                    {
                        CoreEntry.gObjPoolMgr.PushToPool(m_summonDesc.npcID); // 加到内存池子里
                        CoreEntry.gGameMgr.SpawnMonster(m_summonDesc.npcID, bornPos, out obj);
                    }

                    obj.transform.localRotation = m_skillBase.m_actor.transform.localRotation;

                    ActorObj summonActorbase = obj.GetComponent <ActorObj>();
                    if (m_summonDesc.killBefore == 1)
                    {
                        ActorObj.SummonData data = new ActorObj.SummonData();
                        data.SummonID     = m_summonDesc.npcID;
                        data.entityid     = summonActorbase.entityid;
                        data.lifeTime     = m_summonDesc.lifeTime;
                        data.deadthToKill = m_summonDesc.deadthToKill;
                        data.startTime    = Time.time;
                        m_skillBase.m_actor.m_skillSummonList.Add(data);
                    }

                    summonActorbase.m_bSummonMonster = true; // 召唤生物标记

                    if (m_skillBase.m_actor.mActorType == ActorType.AT_PVP_PLAYER)
                    {
                        summonActorbase.mActorType = m_skillBase.m_actor.mActorType;
                    }

                    if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
                    {
                        summonActorbase.TeamType = 1;
                    }
                    else
                    {
                        summonActorbase.TeamType = 3;
                    }

                    if (summonActorbase.mActorType == ActorType.AT_BOSS)
                    {
                        summonActorbase.mActorType = ActorType.AT_AVATAR;
                    }

                    // 1.属性从召唤者继承*表里设置的属性百分比
                    if (m_summonDesc.summonType == 1)
                    {
                        // m_skillBase.m_actor.mBaseAttr.SummonTo(summonActorbase.mBaseAttr);
                        summonActorbase.curHp = summonActorbase.mBaseAttr.MaxHP;

                        // 重置AI
                        Destroy(summonActorbase.GetComponent <ActorAgent>());
                        ActorAgent actorAgent = null;
                        if (m_summonDesc.followMe)
                        {
                            actorAgent = summonActorbase.gameObject.AddComponent <PlayerAgent>();
                        }


                        ActorObj actorobj = summonActorbase.GetComponent <ActorObj>();

                        actorAgent.enabled = true;
                        actorobj.enabled   = true;
                        //summonActorbase.actorCreatureInfo.battleSpeed = m_skillBase.m_actor.actorCreatureInfo.battleSpeed;
                        //summonActorbase.mBaseAttr.Speed = summonActorbase.actorCreatureInfo.battleSpeed;
                        actorobj.SetSpeed(summonActorbase.mBaseAttr.Speed);
                    }
                    else
                    // 2.属性从召唤者继承*表里设置的属性百分比 模型外观变成召唤者
                    if (m_summonDesc.summonType == 2)
                    {
                        // 设置当前血量百分比
                        BaseAttr newCardAttr = new BaseAttr();
                        summonActorbase.mBaseAttr = newCardAttr;
                        summonActorbase.mBaseAttr = newCardAttr;
                        // m_skillBase.m_actor.mBaseAttr.SummonTo(summonActorbase.mBaseAttr);
                        float fHpRatio = (float)m_skillBase.m_actor.curHp / (float)m_skillBase.m_actor.mBaseAttr.MaxHP;
                        summonActorbase.curHp = (int)(summonActorbase.mBaseAttr.MaxHP * fHpRatio);
                        //
                        //MonsterHeath monsterHeath = summonActorbase.GetComponent<MonsterHeath>();
                        //if (monsterHeath != null)
                        //    monsterHeath.ResetHp(summonActorbase.mBaseAttr.MaxHP);
                        //PlayerHeath  playerHeath  = summonActorbase.GetComponent<PlayerHeath>();
                        //if (playerHeath != null)
                        //    playerHeath.OnResetHP();

                        // 重置AI
                        Destroy(summonActorbase.GetComponent <ActorAgent>());

                        ActorAgent actorAgent = null;
                        if (m_summonDesc.followMe)
                        {
                            actorAgent = summonActorbase.gameObject.AddComponent <PlayerAgent>();
                        }

                        // 设置速度
                        if (actorAgent != null)
                        {
                            actorAgent.enabled = true;
                            ActorObj actorobj = summonActorbase.GetComponent <ActorObj>();
                            actorobj.enabled = true;

                            //summonActorbase.actorCreatureInfo.battleSpeed = m_skillBase.m_actor.actorCreatureInfo.battleSpeed;
                            //summonActorbase.mBaseAttr.Speed = summonActorbase.actorCreatureInfo.battleSpeed;
                            actorobj.SetSpeed(summonActorbase.mBaseAttr.Speed);
                        }

                        // 颜色
                        Color color = new Color(67f / 255f, 146f / 255f, 223f / 255f, 205f / 255f);
                        summonActorbase.SetMaterialColor("DZSMobile/CharacterColor", "_BobyColor", color);
                        //summonActorbase.NoRecoverShader();

                        summonActorbase.m_bNoDieAction = true; // 不播放死亡动作
                    }

                    //
                    if (m_summonDesc.buffID != 0)
                    {
                        //         summonActorbase.Addbuff(m_summonDesc.buffID, m_skillBase.m_actor, 0);
                    }
                }
            }
        }