Esempio n. 1
0
    public override bool isFinish(LChatacterInterface character, LChatacterInformationInterface information)
    {
        var  pos   = information.getGroundHight(character.GetCurPosition());
        bool inAir = character.GetCurPosition().y - pos.y > 0.01f;

        return(!inAir);
    }
Esempio n. 2
0
 public void initJump(LChatacterInterface character, LChatacterInformationInterface information)
 {
     curTime = -hitDelta;
     character.CrossFade(animName);
     beginPositon = character.GetCurPosition();
     character.SetCurForward(-MoveDir);
 }
Esempio n. 3
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;
                }
            }
        }
    }
Esempio n. 4
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);
    }
Esempio n. 5
0
 public override void endAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     if (!beBreak)
     {
         character.SetCurPosition(endPos);
     }
 }
Esempio n. 6
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        Vector3 pos  = character.GetCurPosition();
        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 (curTime > JumpTime * 2)
         * {
         *  Vector3 gh = information.getGroundHight(pos);
         *  //Debug.LogError("pos.y =  " + pos.y + " g "+gh.y + " " + (gh.y <= pos.y));
         *
         * }*/
        pos = information.tryMove(pos0, pos - pos0, false);


        character.SetCurPosition(pos);
    }
Esempio n. 7
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);
    }
Esempio n. 8
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));
        }
    }
Esempio n. 9
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);
        }
    }
Esempio n. 10
0
 public override void beginAction(LCharacterInterface character, LChatacterInformationInterface information)
 {
     state     = 1;
     jumpCount = 0;
     firFrame  = true;
     initJump(character, information);
 }
Esempio n. 11
0
 public override void endAction(LChatacterInterface character, LChatacterInformationInterface information)
 {
     /*if (character.IsAI())
      * {
      *  Debug.Log("end hit at "+ curTime);
      * }*/
 }
Esempio n. 12
0
    public override bool isFinish(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(true);
                }
                var selPos = character.GetCurPosition();

                var targetPos = target.GetCurPosition();

                float f = Vector3.Distance(selPos, targetPos);
                if (f < mixDistance)
                {
                    return(true);
                }
                return(false);
            }
        }
        return(true);
    }
Esempio n. 13
0
    public override void endAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        var pos = information.getGroundHight(character.GetCurPosition());

        character.SetCurPosition(pos);

        //Debug.LogError("end fall");
    }
Esempio n. 14
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);
 }
Esempio n. 15
0
 public override bool isFinish(LCharacterInterface character, LChatacterInformationInterface information)
 {
     curTime += Time.deltaTime;
     if (skillData != null && skillData.maxLength < curTime)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 16
0
 public override void beginAction(LChatacterInterface character, LChatacterInformationInterface information)
 {
     initJump(character, information);
     if (effect_obj != null)
     {
         GameObject g = GameObject.Instantiate(effect_obj);
         g.transform.position = beginPositon;
         g.transform.forward  = -MoveDir;
     }
 }
Esempio n. 17
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();
 }
Esempio 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();
    }
Esempio n. 19
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();
    }
Esempio n. 20
0
    public override bool isFinish(LChatacterInterface character, LChatacterInformationInterface information)
    {
        curTime += Time.deltaTime;

        if (curTime <= hit_back_time + ctrl_time)
        {
            return(false);
        }
        //Debug.Log("hit finish  at " + curTime);
        return(true);
    }
Esempio n. 21
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);
    }
Esempio n. 22
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();
    }
Esempio n. 23
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);
    }
Esempio n. 24
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);
    }
Esempio n. 25
0
    public override bool isFinish(LChatacterInterface character, LChatacterInformationInterface information)
    {
        curTime += Time.deltaTime;
        if (curTime <= JumpTime)
        {
            return(false);
        }
        var   pos   = information.getGroundHight(character.GetCurPosition());
        float d     = character.GetCurPosition().y - pos.y;
        bool  inAir = d > 0.001f;

        return(!inAir);
    }
Esempio n. 26
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        var  pos0  = character.GetCurPosition();
        var  pos   = information.getGroundHight(pos0);
        bool inAir = pos0.y - pos.y > 0.01f;

        if (inAir)
        {
            pos0.y -= fallSpeed * Time.deltaTime;
            pos0.y  = pos0.y > pos.y ? pos0.y : pos.y;
            character.SetCurPosition(pos0);
        }
    }
Esempio n. 27
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;
        }
    }
Esempio n. 28
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");
    }
Esempio n. 29
0
    public override bool isFinish(LCharacterInterface character, LChatacterInformationInterface information)
    {
        Vector3 pos;

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

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

        return(!inAir);
    }
Esempio n. 30
0
    public override void beginAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();
        var c        = information.GetCharacter(targetId);

        if (c != null)
        {
            var dir = c.GetCurPosition() - character.GetCurPosition();
            dir.y = 0;
            dir.Normalize();
            character.SetCurForward(dir);
        }
        base.beginAction(character, information);
    }