Exemple #1
0
    protected new void Update()
    {
        base.Update();
        if (IsActor)
        {
            return;
        }
        List <AbilityResultInfo> unFinishedAbilityResultList = actorInfo.unFinishedAbilityResultList;

        if (unFinishedAbilityResultList.Count > 0)
        {
            AbilityResultInfo hasFinishedInstance = null;
            for (int i = 0; i < unFinishedAbilityResultList.Count; i++)
            {
                AbilityResultInfo info = unFinishedAbilityResultList[i];
                if (info.NeedShow)
                {
                    info.Show(this);
                }
                else if (info.HasFinished && info.HasMoveFinished)
                {
                    hasFinishedInstance = info;
                }
            }
            if (hasFinishedInstance != null)
            {
                unFinishedAbilityResultList.Remove(hasFinishedInstance);
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// 从对象池中取出漂浮文字对象 by吴江
    /// </summary>
    /// <param name="_pos"></param>
    /// <param name="_rot"></param>
    /// <returns></returns>
    public StateTexter SpawnStateTexter(AbilityResultInfo _info)
    {
        //if (!SystemSettingMng.ShowStateTexts) return null;
        StateTexter stateTexter = stateTexterPool.Request();

        stateTexter.OnSpawned(_info);
        return(stateTexter);
    }
Exemple #3
0
 /// <summary>
 /// 客户端通知使用技能 by吴江
 /// </summary>
 /// <param name="_info"></param>
 public void UseAbility(AbilityResultInfo _instance)
 {
     if (_instance.NeedMove)
     {
         waitForActMoveAbilityList.Add(new AbilityMoveData(_instance, this.gameObject));
         stateMachine.Send((int)EventType.ABILITYMOVE);
     }
 }
Exemple #4
0
    public virtual void BeHit(AbilityResultInfo _info)
    {
        if (animFSM != null)
        {
            animFSM.BeRigidity(_info.curRigidityTime);
            if (!isDead)
            {
                switch (_info.DefType)
                {
                case DefResultType.DEF_SORT_KICK2:
                    animFSM.BeKickDown(_info.curMoveTime, _info.curRigidityTime);
                    break;

                case DefResultType.DEF_SORT_KICK:
                    animFSM.BeKickFly(_info.curMoveTime, _info.curRigidityTime);
                    break;

                default:
                    animFSM.BeHit(0.3f, 1.0f, _info.curDefAnimation);
                    break;
                }
            }
        }
//        if (_info.UserActor == GameCenter.curMainPlayer || this == GameCenter.curMainPlayer)
//        {
//            MainPlayerFocus = !isDead;
//        }
//        if (headTextCtrl != null && !IsActor && MainPlayerFocus)
//        {
//            if (isDead)
//            {
//                headTextCtrl.HideBlood();
//            }
//            else
//            {
//                headTextCtrl.SetBlood(actorInfo.MaxHP <= 0 ? 0 : (actorInfo.CurHP + _info.TotalDamage - _info.HasShowDamage) / (float)actorInfo.MaxHP, IsFriend);
//            }
//        }
        if (fxCtrl != null)
        {
            if (this.transform.position == _info.UserActor.transform.position)
            {
                fxCtrl.DoDefEffectFixedPosition(_info.curDefEffect, _info.curDefTime, Vector3.one, Quaternion.identity, HitPoint);
            }
            else
            {
                fxCtrl.DoDefEffectFixedPosition(_info.curDefEffect, _info.curDefTime, Vector3.one, Quaternion.LookRotation(this.transform.position - _info.UserActor.transform.position), HitPoint);
            }
        }
        if (moveFSM != null)
        {
            if (_info.curRigidityTime > 0)
            {
                moveFSM.StopMovingTo();
            }
            moveFSM.UseAbility(_info);
        }
    }
Exemple #5
0
 public AbilityMoveData(AbilityResultInfo _data, GameObject _user)
 {
     moveType       = _data.NeedMove ? SelfShiftType.DIRECTION : SelfShiftType.NO;
     isForce        = true;
     user           = _user;
     AbilityDestPos = ActorMoveFSM.LineCast(_data.curDestPos, true);
     direction      = _data.Dir;
     rushHoldTime   = _data.curMoveTime;
     if (_data.target != null)
     {
         target = _data.target.gameObject;
     }
     faceToPos = _data.UserActor.transform.position;
 }
Exemple #6
0
    public override void BeHit(AbilityResultInfo _info)
    {
        if (isDummy || !inited)
        {
            return;
        }
        if (animFSM != null)
        {
            animFSM.BeRigidity(_info.curRigidityTime);
            if (!isDead)
            {
                switch (_info.DefType)
                {
                case DefResultType.DEF_SORT_KICK2:
                    animFSM.BeKickDown(_info.curMoveTime, _info.curRigidityTime);
                    break;

                case DefResultType.DEF_SORT_KICK:
                    animFSM.BeKickFly(_info.curMoveTime, _info.curRigidityTime);
                    break;

                default:
                    animFSM.BeHit(0.3f, 1.0f, _info.curDefAnimation);
                    break;
                }
            }
        }
        if (headTextCtrl != null && !IsActor)
        {
            if (isDead || !MainPlayerFocus)
            {
                //headTextCtrl.HideBlood();
            }
            else
            {
                //headTextCtrl.SetBlood(actorInfo.MaxHP <= 0 ? 0 : (actorInfo.CurHP + _info.TotalDamage - _info.HasShowDamage) / (float)actorInfo.MaxHP, IsFriend);
                //headTextCtrl.SetBloodEnable(actorInfo.OwnerID <= 0 || actorInfo.OwnerID == GameCenter.curMainPlayer.id);
            }
        }
        if (fxCtrl != null)
        {
            if (this.transform.position == _info.UserActor.transform.position)
            {
                fxCtrl.DoDefEffectFixedPosition(_info.curDefEffect, _info.curDefTime, Vector3.one, Quaternion.identity, HitPoint);
            }
            else
            {
                fxCtrl.DoDefEffectFixedPosition(_info.curDefEffect, _info.curDefTime, Vector3.one, Quaternion.LookRotation(this.transform.position - _info.UserActor.transform.position), HitPoint);
            }
        }
        if (moveFSM != null)
        {
            if (_info.curRigidityTime > 0)
            {
                moveFSM.StopMovingTo();
            }
            moveFSM.UseAbility(_info);
        }

        if (_info.UserActor == GameCenter.curMainPlayer && rendererCtrl != null && !rendererCtrl.ArmorDirty && rendererCtrl.PendingArmors == 0)
        {
            rendererCtrl.Blink(Shader.Find("Unlit/Transparent Cutout/Rim"), Color.white, 0.5f);
        }
    }
Exemple #7
0
    public void OnSpawned(AbilityResultInfo _info)
    {
        textJumpPathList.Clear();
        if (_info.UserActor == null || _info.TargetActor == null)
        {
            ReturnBySelf();
            return;
        }
        HeadTextCtrl textCtrl = _info.TargetActor.GetHeadTextCtrl();

        if (textCtrl == null || textCtrl.TextParent == null)
        {
            ReturnBySelf();
            return;
        }
        //是否自己受伤
        //RelationType relation = ConfigMng.Instance.GetRelationType(GameCenter.curMainPlayer.Camp, _info.TargetActor.Camp, GameCenter.curGameStage.SceneType);
        bool isFriend = _info.TargetActor.id == GameCenter.curMainPlayer.id;        // || relation == RelationType.NO_ATTAK;
        //是否是自己宠物攻击的
        bool isPetAttack = (_info.UserActor == null || GameCenter.curMainEntourage == null)?false:(_info.UserActor.id == GameCenter.curMainEntourage.id);

        int     nextDepth = NGUITools.CalculateNextDepth(textCtrl.TextParent);
        Vector3 fromPos   = textCtrl.TextParent.transform.position;
        Vector3 vol       = fromPos - _info.UserActor.transform.position;

        vol = isFriend ? new Vector3(vol.x * fixedFriendRotation.x, vol.y * fixedFriendRotation.y + vol.z * fixedFriendRotation.x)
            : new Vector3(vol.x * fixedEnemyRotation.x, vol.y * fixedEnemyRotation.y + vol.z * fixedEnemyRotation.x);
        Vector3 toPos = fromPos + vol.normalized * 2.0f;


        UILabel lb   = this.gameObject.GetComponent <UILabel>();
        string  text = string.Empty;
        UIFont  font = null;
        //       Color color = Color.white;
        Vector3 localScale = Vector3.zero;

        if (lb != null)
        {
            lb.transform.parent = textCtrl.TextParent.transform;
            lb.gameObject.SetMaskLayer(textCtrl.TextParent.layer);
            lb.transform.localPosition = Vector3.zero;
            switch (_info.AttackType)
            {
            case AttackResultType.ATT_SORT_DODGE:
                text = "s";
                font = isFriend ? textCtrl.font_get_dmg : textCtrl.font_dmg;
                if (isPetAttack)
                {
                    font = textCtrl.font_pet_dmg;
                }
                break;

            case AttackResultType.ATT_SORT_HIGHDEF:
                //text = _info.curDamage > 0 ? "d-" + _info.curDamage.ToString() : "m";
                text = "d-" + _info.curDamage.ToString();
                font = isFriend ? textCtrl.font_get_dmg : textCtrl.font_dmg;
                if (isPetAttack)
                {
                    font = textCtrl.font_pet_dmg;
                }
                break;

            case AttackResultType.ATT_SORT_CRIT:
                if (_info.DefType == DefResultType.DEF_SORT_TREAT)
                {
                    //text = _info.curDamage > 0 ? "b+" + _info.curDamage.ToString() : "m";
                    text = "b+" + _info.curDamage.ToString();
                    font = isFriend ? textCtrl.zl_font : textCtrl.zl_font;
                    if (isPetAttack)
                    {
                        font = textCtrl.font_pet_dmg;
                    }
                }
                else
                {
                    //text = _info.curDamage > 0 ? "b-"+_info.curDamage.ToString() : "m";
                    text = "b-" + _info.curDamage.ToString();
                    font = isFriend ? textCtrl.font_get_dmg : textCtrl.bj_font;
                    if (isPetAttack)
                    {
                        font = textCtrl.font_pet_dmg;
                    }
                    if (isFriend)
                    {
                        textJumpPathList.Add(new TextJumpPath(0.05f, Vector3.Lerp(fromPos, toPos, 0.2f), new Vector3(0.5f, 0.4f, 0f)));
                        textJumpPathList.Add(new TextJumpPath(0.1f, Vector3.Lerp(fromPos, toPos, 0.4f), new Vector3(1f, 0.9f, 0f)));
                        textJumpPathList.Add(new TextJumpPath(0.8f, Vector3.Lerp(fromPos, toPos, 0.6f), new Vector3(1f, 0.9f, 0f)));
                    }
                    else
                    {
                        textJumpPathList.Add(new TextJumpPath(0.15f, Vector3.Lerp(fromPos, toPos, 0.2f), new Vector3(0.8f, 1.2f, 0f)));
                        textJumpPathList.Add(new TextJumpPath(0.25f, Vector3.Lerp(fromPos, toPos, 0.4f), new Vector3(0.8f, 0.7f, 0f)));
                        textJumpPathList.Add(new TextJumpPath(0.9f, Vector3.Lerp(fromPos, toPos, 0.6f), new Vector3(0.7f, 0.5f, 0f)));
                    }
                    textJumpPathList.Add(new TextJumpPath(1.0f, Vector3.Lerp(fromPos, toPos, 1.0f), new Vector3(0.1f, 0.08f, 0f)));
                }
                break;

            case AttackResultType.ATT_SORT_LUCKY_HIT:
                text = isFriend?("bxy-" + _info.curDamage):("xy-" + _info.curDamage);
                font = isFriend ? textCtrl.font_get_dmg : textCtrl.xy_font;
                if (isPetAttack)
                {
                    font = textCtrl.font_pet_dmg;
                }
                if (isFriend)
                {
                    textJumpPathList.Add(new TextJumpPath(0.05f, Vector3.Lerp(fromPos, toPos, 0.2f), new Vector3(0.4f, 0.3f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.1f, Vector3.Lerp(fromPos, toPos, 0.4f), new Vector3(0.8f, 0.6f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.8f, Vector3.Lerp(fromPos, toPos, 0.6f), new Vector3(0.8f, 0.6f, 0f)));
                }
                else
                {
                    textJumpPathList.Add(new TextJumpPath(0.15f, Vector3.Lerp(fromPos, toPos, 0.2f), new Vector3(1.4f, 1.1f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.25f, Vector3.Lerp(fromPos, toPos, 0.4f), new Vector3(0.7f, 0.6f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.9f, Vector3.Lerp(fromPos, toPos, 0.6f), new Vector3(0.6f, 0.4f, 0f)));
                }
                textJumpPathList.Add(new TextJumpPath(1.0f, Vector3.Lerp(fromPos, toPos, 1.0f), new Vector3(0.1f, 0.08f, 0f)));
                break;

            default:
                switch (_info.DefType)
                {
                case DefResultType.DEF_SORT_TREAT:
                    if (_info.curDamage == 0)
                    {
                        text = string.Empty;
                    }
                    else
                    {
                        text = "+ " + _info.curDamage.ToString();
                    }
                    font = textCtrl.zl_font;
                    break;

                case DefResultType.DEF_SORT_STIFLE:
                    text = "-" + _info.curDamage.ToString();
                    //font = textCtrl.font_dmg;
                    font = isFriend ? textCtrl.font_get_dmg : textCtrl.font_dmg;
                    break;

                case DefResultType.DEF_SORT_NOKICK:
                    text = "-" + _info.curDamage.ToString();
                    //font = textCtrl.font_dmg;
                    font    = isFriend ? textCtrl.font_get_dmg : textCtrl.font_dmg;
                    fromPos = toPos;
                    textJumpPathList.Add(new TextJumpPath(0.2f, Vector3.Lerp(fromPos, toPos, 0.8f), new Vector3(0.6f, 0.4f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.6f, Vector3.Lerp(fromPos, toPos, 0.8f), new Vector3(0.8f, 0.6f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.2f, toPos, new Vector3(0.80f, 0.8f, 0f)));
                    break;

                case DefResultType.DEF_SORT_NOKICKDOWN:
                    text = "-" + _info.curDamage.ToString();
                    //font = textCtrl.font_dmg;
                    font    = isFriend ? textCtrl.font_get_dmg : textCtrl.font_dmg;
                    fromPos = toPos;
                    textJumpPathList.Add(new TextJumpPath(0.2f, Vector3.Lerp(fromPos, toPos, 0.8f), new Vector3(0.6f, 0.4f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.6f, Vector3.Lerp(fromPos, toPos, 0.8f), new Vector3(0.8f, 0.6f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.2f, toPos, new Vector3(0.8f, 0.8f, 0f)));
                    break;

                default:
                    //text = _info.curDamage > 0 ? "-"+_info.curDamage.ToString() : "m";
                    text = "-" + _info.curDamage.ToString();
                    font = isFriend ? textCtrl.font_get_dmg : textCtrl.font_dmg;
                    if (isPetAttack)
                    {
                        font = textCtrl.font_pet_dmg;
                    }
                    break;
                }
                break;
            }
            if (isFriend)
            {
                //color = Color.red;
            }
            if (textJumpPathList.Count == 0)
            {
                if (isFriend)
                {
                    textJumpPathList.Add(new TextJumpPath(0.05f, Vector3.Lerp(fromPos, toPos, 0.2f), new Vector3(0.3f, 0.25f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.1f, Vector3.Lerp(fromPos, toPos, 0.4f), new Vector3(0.9f, 0.7f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.8f, Vector3.Lerp(fromPos, toPos, 0.6f), new Vector3(0.9f, 0.7f, 0f)));
                }
                else
                {
                    textJumpPathList.Add(new TextJumpPath(0.15f, Vector3.Lerp(fromPos, toPos, 0.2f), new Vector3(1.5f, 1.2f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.25f, Vector3.Lerp(fromPos, toPos, 0.4f), new Vector3(0.8f, 0.65f, 0f)));
                    textJumpPathList.Add(new TextJumpPath(0.9f, Vector3.Lerp(fromPos, toPos, 0.6f), new Vector3(0.7f, 0.55f, 0f)));
                }
                textJumpPathList.Add(new TextJumpPath(1.0f, Vector3.Lerp(fromPos, toPos, 1.0f), new Vector3(0.1f, 0.08f, 0f)));
                //textJumpPathList.Add(new TextJumpPath(0.1f, toPos, new Vector3(0.5f, 0.5f, 0.6f)));
            }
            this.gameObject.transform.localScale = localScale;
            if (font != null)
            {
                lb.bitmapFont = font;
                // lb.transform.localScale = new Vector3(font.defaultSize, font.defaultSize, 1f);
            }
            else
            {
                GameSys.LogError(_info.AttackType + " , " + _info.DefType + ConfigMng.Instance.GetUItext(192));
            }
            lb.text            = text;
            lb.depth           = nextDepth;
            lb.pivot           = UILabel.Pivot.Center;
            lb.supportEncoding = true;
            lb.symbolStyle     = NGUIText.SymbolStyle.Normal;
            lb.fontSize        = 1;

            //lb.color = color;  字集自带颜色,则不设置颜色 by邓成
        }
        NewStepInit();

        base.OnSpawned();
    }