コード例 #1
0
        //释放技能
        public virtual void OnEntityReleaseSkill()
        {
            SkillManagerConfig skillManagerConfig = ConfigReader.GetSkillManagerCfg(EntitySkillID);

            if (skillManagerConfig == null)
            {
                return;
            }
            //吸附技能   实际上是配置文件中的  bIsConsumeSkill
            if (skillManagerConfig.isAbsorb == 1)
            {
                //删除已有的相同特效
                foreach (Transform child in RealEntity.objAttackPoint)
                {
                    if (child.name.Contains(skillManagerConfig.absorbRes))
                    {
                        int offset = child.name.IndexOf('_');
                        if (offset != 0)
                        {
                            string name = child.name.Substring(offset + 1);
                            int    id   = Convert.ToInt32(name);
                            EffectManager.Instance.DestroyEffect(id);
                        }
                    }
                }

                //创建吸附技能效果
                string       absortActPath     = "effect/soul_act/" + skillManagerConfig.absorbRes;
                NormalEffect absortSkillEffect = EffectManager.Instance.CreateNormalEffect(absortActPath, RealEntity.objAttackPoint.gameObject);

                if (absortSkillEffect != null)
                {
                    Quaternion rt = Quaternion.LookRotation(EntityFSMDirection);
                }
                objTransform.rotation = Quaternion.LookRotation(EntityFSMDirection);
            }
            else
            {
                if (skillManagerConfig.isNormalAttack == 1) //判断是否是普通攻击
                {
                    RealEntity.PlayeAttackAnimation();      //播放攻击动画
                }
                else//技能攻击
                {
                    RealEntity.PlayerAnimation(skillManagerConfig.rAnimation);//播放释放技能动画
                    //如果此动画不是循环模式
                    if (RealEntity.GetComponent <Animation>()[skillManagerConfig.rAnimation] != null && RealEntity.GetComponent <Animation>()[skillManagerConfig.rAnimation].wrapMode != WrapMode.Loop)
                    {
                        RealEntity.CrossFadeSqu("free");                                      //淡入free动画
                    }
                    HolyTech.Effect.EffectManager.playSkillReleaseSound(this, EntitySkillID); //播放技能释放的声音
                }

                float distance = GetDistanceToPos(EntityFSMPosition);//有什么用?
                if (entityType != EntityType.Building)
                {
                    objTransform.rotation = Quaternion.LookRotation(EntityFSMDirection);
                }
            }
        }
コード例 #2
0
    public virtual void OnFreeState()
    {
        if (RealEntity == null)
        {
            return;
        }
        if (!mHasLifeBar)
        {
            this.heroLife.SetActive(true);
            mHasLifeBar = true;
        }

        Vector2 serverPos2D = new Vector2(m_pcGOSSI.sServerBeginPos.x, m_pcGOSSI.sServerBeginPos.z);
        Vector2 objPos2D    = new Vector2(objTransform.position.x, objTransform.position.z);

        float fDistToServerPos = Vector2.Distance(serverPos2D, objPos2D);

        if (fDistToServerPos > 10)                                               //因为服务器可能对玩家的位置会有调整,所以调整位置
        {
            objTransform.position = m_pcGOSSI.sServerBeginPos;                   //按服务器的位置设置
            objTransform.rotation = Quaternion.LookRotation(EntityFSMDirection); //方向调整。
            //RealEntity.GetComponent<Animation>().Play("free");
        }
        RealEntity.GetComponent <Animation>().Play("free");
    }
コード例 #3
0
    public virtual void OnEntityReleaseSkill()
    {
        SkillManagerConfig skillManagerConfig = ConfigReader.GetSkillManagerCfg(EntitySkillID);
        Animation          ani = RealEntity.GetComponent <Animation>();

        if (skillManagerConfig.isNormalAttack == 1)//判断是否是普通攻击
        {
            ani.Play("attack");
        }
        else//技能攻击
        {
            ani.Play(skillManagerConfig.rAnimation.ToString());//播放释放技能动画
            //如果此动画不是循环模式
            if (RealEntity.GetComponent <Animation>()[skillManagerConfig.rAnimation] != null && RealEntity.GetComponent <Animation>()[skillManagerConfig.rAnimation].wrapMode != WrapMode.Loop)
            {
                ani.CrossFadeQueued("free");//淡入free动画
            }
        }
        objTransform.rotation = Quaternion.LookRotation(EntityFSMDirection);
    }
コード例 #4
0
        //完成技能后 LastingSkill
        public virtual void OnEntityLastingSkill()
        {
            SkillManagerConfig skillManagerConfig = ConfigReader.GetSkillManagerCfg(EntitySkillID);

            if (skillManagerConfig == null)
            {
                return;
            }

            RealEntity.PlayerAnimation(skillManagerConfig.rAnimation);//播放攻击动画

            ////如果此动画不是循环模式
            if (RealEntity.GetComponent <Animation>()[skillManagerConfig.rAnimation] != null && RealEntity.GetComponent <Animation>()[skillManagerConfig.rAnimation].wrapMode != WrapMode.Loop)
            {
                RealEntity.CrossFadeSqu("free");//淡入free动画
            }

            float distance = GetDistanceToPos(EntityFSMPosition);//有什么用?

            if (entityType != EntityType.Building)
            {
                objTransform.rotation = Quaternion.LookRotation(EntityFSMDirection);
            }
        }
コード例 #5
0
        //
        public void initAreaCircle()
        {
            //if (SceneGuideTaskManager.Instance().IsNewsGuide() == SceneGuideTaskManager.SceneGuideType.NoGuide)
            //    return;
            if (RealEntity == null)
            {
                return;
            }

            if (CircleArea == null)
            {
                string path = GameConstDefine.LoadGameOtherEffectPath;
                //GameObject obj = Resources.Load(path + "guangquan_fanwei") as GameObject;
                ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(path + "guangquan_fanwei", ResourceType.PREFAB);
                GameObject   obj     = objUnit.Asset as GameObject;

                if (obj == null)
                {
                    GameMethod.DebugError("CircleArea obj null");
                    return;
                }

                //root = GameObject.Instantiate (obj) as GameObject;
                CircleArea = GameObject.Instantiate(obj) as GameObject;
                CircleArea.transform.parent   = RealEntity.GetTransform();
                CircleArea.transform.position = RealEntity.GetTransform().position + new Vector3(0.0f, 0.2f, 0.0f);
                EventCenter.AddListener(EGameEvent.eGameEvent_LocalPlayerRange, UpdataRange);
                CircleArea.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f));
            }
            CapsuleCollider capsule = RealEntity.GetComponent <CapsuleCollider>();

            if (capsule)
            {
                capsule.enabled = false;
            }
        }