Ejemplo n.º 1
0
 public void initJump(LChatacterInterface character, LChatacterInformationInterface information)
 {
     curTime = -hitDelta;
     character.CrossFade(animName);
     beginPositon = character.GetCurPosition();
     character.SetCurForward(-MoveDir);
 }
Ejemplo n.º 2
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);
        }
    }
Ejemplo n.º 3
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);
    }
Ejemplo n.º 4
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();
    }
Ejemplo n.º 5
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);
    }