Пример #1
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LChatacterInterface target = information.GetCharacter(targetId);

            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);
        }
    }
Пример #2
0
    public override bool isQualified(LChatacterAction curAction, LChatacterInterface character, LChatacterInformationInterface information)
    {
        var  pos   = information.getGroundHight(character.GetCurPosition());
        bool inAir = character.GetCurPosition().y - pos.y > 0.01f;

        return(inAir);
    }
Пример #3
0
    public override bool isQualified(LChatacterAction curAction, LChatacterInterface character, LChatacterInformationInterface information)
    {
        if (VirtualInput.buttons[(int)button])
        {
            var  pos   = information.getGroundHight(character.GetCurPosition());
            bool inAir = character.GetCurPosition().y - pos.y > 0.001f;

            return(!inAir);
        }

        return(false);
    }
Пример #4
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);
    }
Пример #5
0
 public override void doAction(LChatacterInterface 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);
     }
 }
Пример #6
0
    public override bool isQualified(LChatacterAction curAction, LChatacterInterface character, LChatacterInformationInterface information)
    {
        if (!character.CanUsedSkill(cdName, skillState))
        {
            return(false);
        }
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LChatacterInterface target = information.GetCharacter(targetId);

            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);
    }
Пример #7
0
    public override bool isFinish(LChatacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LChatacterInterface target = information.GetCharacter(targetId);

            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);
    }
Пример #8
0
 public void initJump(LChatacterInterface character, LChatacterInformationInterface information)
 {
     curTime = -hitDelta;
     character.CrossFade(animName);
     beginPositon = character.GetCurPosition();
     character.SetCurForward(-MoveDir);
 }
Пример #9
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);
    }
Пример #10
0
    public override void endAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        var pos = information.getGroundHight(character.GetCurPosition());

        character.SetCurPosition(pos);

        //Debug.LogError("end fall");
    }
Пример #11
0
 public override bool OnTrigger(LCharacterColliderData cdata, Collider other, LChatacterInterface 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;
         return(true);
     }
     return(false);
 }
Пример #12
0
    public void initJump(LChatacterInterface character, LChatacterInformationInterface information)
    {
        curTime = 0f;
        character.CrossFade(animName);
        //跳跃的方向
        Vector3 forward;

        character.GetForward(out forward);
        Vector3 left = Vector3.Cross(forward, Vector3.up);

        MoveDir      = (left * VirtualInput.dir.x + forward * VirtualInput.dir.y).normalized;
        beginPositon = character.GetCurPosition();
    }
Пример #13
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);
        }
    }
Пример #14
0
    public override bool isQualified(LChatacterAction curAction, LChatacterInterface character, LChatacterInformationInterface information)
    {
        var  pos0  = character.GetCurPosition();
        var  pos   = information.getGroundHight(pos0);
        bool inAir = pos0.y - pos.y > 0.01f;

        if (VirtualInput.buttons[(int)button] && (!isOnGround || !inAir) && character.CanUsedSkill(cdName, skillState))
        {
            return(true);
        }

        return(false);
    }
Пример #15
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);
    }
Пример #16
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        Vector3 pos  = character.GetCurPosition();
        Vector3 pos0 = pos;
        float   t    = curTime / JumpTime;
        float   b    = t - 1;
        float   y    = -b * b + 1;

        float h = jumpHeight * y;


        pos  = Vector3.Lerp(beginPositon, endPositoin, t * 0.5f);
        pos += new Vector3(0f, h, 0f);
        character.SetCurPosition(pos);
    }
Пример #17
0
    public void initJump(LChatacterInterface character, LChatacterInformationInterface information)
    {
        curTime = 0f;
        character.CrossFade(animName);

        Vector3 dir    = endPositoin - beginPositon;
        float   length = Vector3.Distance(endPositoin, beginPositon);
        //跳跃的方向
        Vector3 forward = dir;

        forward.y = 0;
        forward.Normalize();
        character.SetCurForward(forward);

        JumpTime     = length * 0.5f / jumpSpeed;
        beginPositon = character.GetCurPosition();
    }
Пример #18
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        Vector3 forward;

        character.GetForward(out forward);
        Vector3 left    = Vector3.Cross(forward, Vector3.up);
        Vector3 MoveDir = (left * VirtualInput.dir.x + forward * VirtualInput.dir.y).normalized;
        Vector3 dir     = MoveDir * Time.deltaTime * speed;
        Vector3 basePos = character.GetCurPosition();
        Vector3 pos     = information.tryMove(basePos, dir, true);

        if (basePos.y - pos.y > 0.5f)
        {
            pos = information.tryMove(basePos, dir, true);
        }
        character.SetCurPosition(pos);
        character.SetCurForward(MoveDir);
    }
Пример #19
0
    public override void beginAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        curTime = 0f;
        //character.CrossFade(animName);
        character.ResetAndPlay(animName);
        //character.Play(animName);
        //Debug.Log("play "+ animName);
        beginPositon = character.GetCurPosition();
        endPoition   = beginPositon += MoveDir * hit_back_time * hit_back_speed;
        if (effect_obj != null)
        {
            GameObject g = GlobalEffectPool.Instacne().pools.GetObject(effect_obj);
            g.transform.position = beginPositon;
            g.transform.forward  = -MoveDir;
            AutoReleaseEffect eff = g.AddComponent <AutoReleaseEffect>();
            g.SetActive(true);
        }


        //effectId =
    }
Пример #20
0
    public override void beginAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        curTime         = 0f;
        beginPositon    = baseGroundPos = character.GetCurPosition();
        beginLocalRot   = character.GetCurLocalRot();
        beginLocalScale = character.GetCurLoaclScale();
        lastTime        = 0f;


        /*for (int i = 0, c0 = objList.Length; i < c0; i++)
         * {
         *  var o0 = objList[i];
         *  if (o0.type == 1  )
         *  {
         *      if (null != o0.baseGameObject)
         *      {
         *          Debug.LogError("bg "+o0.baseGameObject + " g "+o0.gameobject );
         *      }
         *  }
         * }*/

        //Debug.Log("begin skill");
    }
Пример #21
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        if (!firFrame && jumpCount < maxJumpCount && VirtualInput.IsButtonDown(button))
        {
            jumpCount++;
            initJump(character, information);
        }
        firFrame = false;


        Vector3 pos  = character.GetCurPosition();
        Vector3 pos0 = pos;
        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;
        pos  = information.tryMove(pos0, pos - pos0, false);
        character.SetCurPosition(pos);
    }