Exemplo n.º 1
0
    public override void doAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        if (onGround)
        {
            return;
        }
        Vector3 pos = endPos;

        Vector3 pos0 = pos;

        float J2 = JumpTime * 2;

        if (curTime < 0)
        {
            return;
        }
        float t = curTime / JumpTime;
        float b = t - 1;
        float y = -b * b + 1;

        float h = jumpHeight * y;

        pos.y = beginPositon.y + h;

        pos += MoveDir * jumpSpeed * Time.deltaTime;
        if (upping && curTime > JumpTime)
        {
            upping = false;
            character.CrossFade(animHitFlyDown, 0.2f);
        }


        pos = information.tryMove(pos0, pos - pos0, false);
        character.SetCurPosition(pos);
    }
Exemplo n.º 2
0
 public override void endAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     if (!beBreak)
     {
         character.SetCurPosition(endPos);
     }
 }
Exemplo n.º 3
0
    public override bool NoOnGround(LCharacterInterface character, LChatacterInformationInterface information)
    {
        if (curTime <= JumpTime)
        {
            return(false);
        }
        Vector3 pos;

        if (!information.getGroundHight(character.GetCurPosition(), out pos))
        {
            Debug.LogError("has error");
            character.SetCurPosition(endPos);

            information.getGroundHight(endPos, out pos);
        }
        else
        {
            endPos = character.GetCurPosition();
        }

        float d = character.GetCurPosition().y - pos.y;

        onGround = d < 0.0000001f;
        if (onGround)
        {
            curTime = 0f;
        }
        return(false);
    }
Exemplo n.º 4
0
    public override void endAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        if (cdOnEnd)
        {
            if (cdState != CdState.HIT)
            {
                character.updateCDState(cdName, skillState);
            }
            var skillParams = character.GetSkillCDSkillParams(cdName);
            skillParams.isUsing = false;
        }

        for (int i = 0, c0 = objList.Length; i < c0; i++)
        {
            var o0 = objList[i];
            if (o0.objId != -1)
            {
                if (o0.type == 2 || o0.type == 3)
                {
                    if (null != o0.gameobject)
                    {
                        o0.gameobject.SetActive(false);
                    }
                }
                if (o0.bind == 1 && o0.gameobject != null)
                {
                    o0.gameobject.transform.parent = null;
                }
            }
        }
    }
Exemplo n.º 5
0
    public override bool isQualified(LCharacterAction curAction, LCharacterInterface character, LChatacterInformationInterface information)
    {
        var _param = character.GetSkillCDSkillParams(cdName);

        if (null == _param)
        {
            return(true);
        }
        else if (!_param.CanUse(skillState))
        {
            return(false);
        }

        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LCharacterInterface target;
            if (information.TryGetCharacter(targetId, out target))
            {
                if (null == target || target.IsDead())
                {
                    return(false);
                }
                var   selPos    = character.GetCurPosition();
                var   targetPos = target.GetCurPosition();
                float dis       = Vector3.Distance(selPos, targetPos);
                if (null != skillData && dis < skillData.skillRange)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 6
0
 public override void beginAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     state     = 1;
     jumpCount = 0;
     firFrame  = true;
     initJump(character, information);
 }
Exemplo n.º 7
0
    public override bool isFinish(LCharacterInterface character, LChatacterInformationInterface information)
    {
        float deltaTime = Time.deltaTime;

        if (air_delay > 0.00001f)
        {
            if (this.air_delay > deltaTime)
            {
                this.air_delay -= deltaTime;
                return(false);
            }
            else
            {
                deltaTime -= air_delay;
                air_delay  = 0f;
            }
        }
        curTime += deltaTime;
        if (onGround)
        {
            bool b = curTime > ctrl_time;

            return(b);
        }
        else
        {
            return(NoOnGround(character, information));
        }
    }
Exemplo n.º 8
0
    public override void doAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LCharacterInterface target;
            if (information.TryGetCharacter(targetId, out target))
            {
                if (null == target || target.IsDead())
                {
                    return;
                }
                var     selPos    = character.GetCurPosition();
                var     targetPos = target.GetCurPosition();
                Vector3 MoveDir   = targetPos - selPos;
                MoveDir.y = 0f;


                MoveDir.Normalize();
                Vector3 pos0 = MoveDir * Time.deltaTime * speed;
                Vector3 pos  = information.tryMove(character.GetCurPosition(), pos0, true);
                character.SetCurPosition(pos);
                character.SetCurForward(MoveDir);
            }
            //    LCharacterInterface target = information.GetCharacter(targetId);
        }
    }
Exemplo n.º 9
0
 public override void endAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     /*if (character.IsAI())
      * {
      *  Debug.Log("end hit at "+ curTime);
      * }*/
 }
Exemplo n.º 10
0
    public override bool isQualified(LCharacterAction curAction, LCharacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LCharacterInterface target;
            if (information.TryGetCharacter(targetId, out target))
            {
                if (null == target || target.IsDead())
                {
                    return(false);
                }
                var selPos = character.GetCurPosition();

                var targetPos = target.GetCurPosition();

                float f = Vector3.Distance(selPos, targetPos);
                if (f > mixDistance)
                {
                    return(true);
                }
            }
            //    LCharacterInterface target = information.GetCharacter(targetId);
        }
        return(false);
    }
Exemplo n.º 11
0
 public override void beginAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     //character.ResetAndPlay(animName);
     character.CrossFade(animName, 0.05f);
     character.SetAnimationLoop(animName, true);
     //Debug.LogError("play idle "+ animName);
     //character.Play(animName);
 }
Exemplo n.º 12
0
    public bool TryGetCharacter(int targetId, out LCharacterInterface chr)
    {
        bool b = charactersMap.TryGetValue(targetId, out chr);



        return(b);
    }
Exemplo n.º 13
0
 public override bool isFinish(LCharacterInterface character, LChatacterInformationInterface information)
 {
     curTime += Time.deltaTime;
     if (skillData != null && skillData.maxLength < curTime)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 14
0
 public override void initAirHit(LCharacterInterface character, LChatacterInformationInterface information)
 {
     base.initAirHit(character, information);
     curTime      = -hitDelta;
     beginPositon = character.GetCurPosition();
     character.SetCurForward(-MoveDir);
     upping  = true;
     beBreak = false;
     endPos  = character.GetCurPosition();
 }
Exemplo n.º 15
0
 public override void beginAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     initAirHit(character, information);
     if (effect_obj != null)
     {
         GameObject g = GameObject.Instantiate(effect_obj);
         g.transform.position = character.GetCurPosition();
         g.transform.forward  = -MoveDir;
     }
 }
Exemplo n.º 16
0
    public override bool isFinish(LCharacterInterface character, LChatacterInformationInterface information)
    {
        curTime += Time.deltaTime;

        if (curTime <= hit_back_time + ctrl_time)
        {
            return(false);
        }
        //Debug.Log("hit finish  at " + curTime);
        return(true);
    }
Exemplo n.º 17
0
    public void initJump(LCharacterInterface character, LChatacterInformationInterface information)
    {
        curTime = 0f;
        character.CrossFade(animName, 0.05f);
        //跳跃的方向
        Vector3 forward = character.GetGameForward();
        Vector3 left    = Vector3.Cross(forward, Vector3.up);

        MoveDir      = -character.GetCurXZForward();
        beginPositon = character.GetCurPosition();
    }
Exemplo n.º 18
0
    public void initJump(LCharacterInterface character, LChatacterInformationInterface information)
    {
        curTime = 0f;
        character.CrossFade(animName, 0.05f);
        //跳跃的方向
        Vector3 forward = character.GetGameForward( );
        Vector3 left    = Vector3.Cross(forward, Vector3.up);

        MoveDir      = (-left * VirtualInput.dir.x + forward * VirtualInput.dir.y).normalized;
        beginPositon = character.GetCurPosition();
    }
Exemplo n.º 19
0
    public override void initAirHit(LCharacterInterface character, LChatacterInformationInterface information)
    {
        base.initAirHit(character, information);
        curTime = -hitDelta;
        var fw = -MoveDir;

        fw.y = 0;
        fw.Normalize();
        character.SetCurForward(fw);
        upping = true;
        endPos = character.GetCurPosition();
    }
Exemplo n.º 20
0
    public override void doAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        if (onGround)
        {
            return;
        }

        var pos0 = character.GetCurPosition();
        var pos  = information.tryMove(pos0, MoveDir * Time.deltaTime, false);

        character.SetCurPosition(pos);
    }
Exemplo n.º 21
0
    void UpdateCharacterSelectyion(bool ageLimit)
    {
        var _param = character.GetSkillCDSkillParams(button.cdName);
        int _camp  = character.GetCamp();
        List <LCharacterInterface> _characters = CharacterBase.information.GetAllCharacters();
        Vector3             curPos             = character.GetCurPosition();
        float               maxDot             = 0.65f;
        LCharacterInterface selectCharacter    = null;

        for (int i = 0, _len = _characters.Count; i < _len; i++)
        {
            LCharacterInterface chr = _characters[i];
            if (chr.GetCamp() != _camp)
            {
                if (chr.IsDead())
                {
                    continue;
                }

                float distance = Vector3.Distance(chr.GetCurPosition(), curPos);
                if (distance < _param.skillRange)
                {
                    if (ageLimit)
                    {
                        Vector3 _forward = chr.GetCurPosition() - curPos;
                        _forward.y = 0;
                        _forward.Normalize();
                        float _ad = Vector3.Dot(_forward, fellowCharacter.forward);
                        if (_ad > maxDot)
                        {
                            selectCharacter = chr;
                        }
                    }
                    else
                    {
                        selectCharacter = chr;
                    }
                }
            }
        }
        if (null != selectCharacter)
        {
            character.SetTargetId(selectCharacter.GetId());
            if (!ageLimit)
            {
                Vector3 _forward = selectCharacter.GetCurPosition() - curPos;
                _forward.y = 0;
                _forward.Normalize();
                fellowCharacter.forward = _forward;
            }
            //fellowCharacter.forward =
        }
    }
Exemplo n.º 22
0
    public override bool isFinish(LCharacterInterface character, LChatacterInformationInterface information)
    {
        curTime += Time.deltaTime;

        if (curTime <= JumpTime * 2)
        {
            //Debug.LogError("not finish LCharacterTransfer curTime " + curTime + " JumpTime" + (JumpTime*2));
            return(false);
        }

        return(true);
    }
Exemplo n.º 23
0
    public override void endAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        isJumpping = false;

        Vector3 pos;

        if (!information.getGroundHight(endPositoin + Vector3.up, out pos))
        {
            Debug.LogError("has error");
            pos = character.GetCurPosition();
        }
        character.SetCurPosition(pos);
    }
Exemplo n.º 24
0
    public override void endAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        Vector3 pos;

        if (!information.getGroundHight(character.GetCurPosition(), out pos))
        {
            Debug.LogError("has error");
            pos = character.GetCurPosition();
        }

        character.SetCurPosition(pos);

        //Debug.LogError("end fall");
    }
Exemplo n.º 25
0
    public override bool isQualified(LCharacterAction curAction, LCharacterInterface character, LChatacterInformationInterface information)
    {
        Vector3 pos;

        if (!information.getGroundHight(character.GetCurPosition(), out pos))
        {
            Debug.LogError("has error on fall");
            pos = character.GetCurPosition();
        }

        bool inAir = character.GetCurPosition().y - pos.y > 0.01f;

        return(inAir);
    }
Exemplo n.º 26
0
    public override void beginAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        curTime = 0f;

        var _param = character.GetSkillCDSkillParams(cdName);

        if (null != _param)
        {
            skill_type = _param.type;
            if (skill_type == SkillParams.TYPE.DRAG_DIR)
            {
                skillDir = VirtualInput.skillDir;
                if (VirtualInput.skillDir != Vector3.zero)
                {
                    character.SetCurForward(skillDir);
                }
            }
            else if (skill_type == SkillParams.TYPE.DRAG_TARGET)
            {
                curTargetId = character.GetTargetId();
            }
        }
        beginPositon = baseGroundPos = character.GetCurPosition();

        targetPoint     = beginPositon + VirtualInput.skillDir;
        targetDir       = VirtualInput.skillDir.normalized;
        beginLocalRot   = character.GetCurLocalRot();
        beginLocalScale = character.GetCurLoaclScale();
        lastTime        = 0f;
        beginToTarget   = -1f;
        if (cdOnEnd)
        {
            var skillParams = character.GetSkillCDSkillParams(cdName);
            skillParams.isUsing = true;
        }
        else
        {
            if (cdState != CdState.HIT)
            {
                character.updateCDState(cdName, skillState);
            }
        }

        for (int i = 0, c0 = objList.Length; i < c0; i++)
        {
            var o0 = objList[i];
            o0.stopUpatePos = false;
            o0.isFlyTool    = false;
        }
    }
Exemplo n.º 27
0
 public override void doAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     if (curTime <= hit_back_time)
     {
         Vector3 dir = MoveDir * Time.deltaTime * hit_back_speed;
         Vector3 pos = information.tryMove(character.GetCurPosition(), dir, true);
         character.SetCurPosition(pos);
     }
     else
     {
         endPoition.y = character.GetCurPosition().y;;
         Vector3 pos = information.tryMove(endPoition, Vector3.zero, true);
     }
 }
Exemplo n.º 28
0
 public override bool OnTrigger(LCharacterColliderData cdata, Collider other, LCharacterInterface character, LChatacterInformationInterface information)
 {
     if (cdata.type == "tra")
     {
         LCharacterTransferData data = cdata.getData <LCharacterTransferData>();
         jumpSpeed    = data.speed;
         jumpHeight   = data.height;
         beginPositon = character.GetCurPosition();
         endPositoin  = data.target.position;
         //Debug.LogError("beginPositon 0" + beginPositon);
         return(true);
     }
     return(false);
 }
Exemplo n.º 29
0
    public static void SetRolePos(float curTime, ObjectContain contain, LCharacterInterface character, LChatacterInformationInterface information,
                                  ref Vector3 beginGroundLinePos,
                                  Vector3 beginLocalScale,
                                  Quaternion beginLocalRot,
                                  bool fixBeginPos = true)
    {
        if (null != contain.gameobject)
        {
            //初始位置
            var oldPos = contain.gameobject.transform.position;
            contain.gameobject.transform.position      = beginGroundLinePos;
            contain.gameobject.transform.localScale    = beginLocalScale;
            contain.gameobject.transform.localRotation = beginLocalRot;

            //位置转向缩放
            contain.gameobject.transform.position       = contain.gameobject.transform.localToWorldMatrix.MultiplyPoint(contain.pos);
            contain.gameobject.transform.localRotation *= contain.rot;
            contain.gameobject.transform.localScale     = MathfHelper.Vector3Mul(beginLocalScale, contain.scale);


            //旧技能位置在水平线上的位置.
            var old_h_pos = oldPos;
            old_h_pos.y = beginGroundLinePos.y;

            //新技能位置在水平线上的位置
            var new_h_pos = contain.gameobject.transform.position;
            new_h_pos.y = beginGroundLinePos.y;
            var _dir = new_h_pos - old_h_pos;

            if (fixBeginPos)
            {
                //技能贴地运动
                var new_h_pos1 = information.tryMove(old_h_pos, _dir, true);
                var _delta     = new_h_pos1 - new_h_pos;

                beginGroundLinePos = new Vector3(beginGroundLinePos.x + _delta.x, new_h_pos1.y, beginGroundLinePos.z + _delta.y);//修正技能水平线高度

                contain.gameobject.transform.position = new Vector3(new_h_pos1.x, contain.gameobject.transform.position.y, new_h_pos1.z);
            }
            else
            {
                //技能贴地运动
                new_h_pos          = information.tryMove(old_h_pos, _dir, true);
                beginGroundLinePos = new Vector3(beginGroundLinePos.x, new_h_pos.y, beginGroundLinePos.z);//修正技能水平线高度

                contain.gameobject.transform.position = new Vector3(new_h_pos.x, contain.gameobject.transform.position.y, new_h_pos.z);
            }
        }
    }
Exemplo n.º 30
0
    public override void beginAction(LCharacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();
        LCharacterInterface c;

        if (information.TryGetCharacter(targetId, out c))
        {
            var dir = c.GetCurPosition() - character.GetCurPosition();
            dir.y = 0;
            dir.Normalize();
            character.SetCurForward(dir);
        }

        base.beginAction(character, information);
    }