Ejemplo n.º 1
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();
    }
Ejemplo n.º 2
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);
    }