Ejemplo n.º 1
0
    public void onServerFrameInputEvent(ServerFrameInputEvent inputEvent)
    {
        FBActor logicActor = actor;

        //aiTakeOver(inputEvent.isAITakeOver);

        //处于接球状态或者AI状态下不做任何处理
        if (inputEvent.isAITakeOver)
        {
            return;
        }

        FixVector2 moveDirection = FixVector2.kZero;

        if (inputEvent.angle != short.MinValue)
        {
            Fix64 radian = (Fix64)inputEvent.angle * Fix64.Pi / (Fix64)180;
            moveDirection.x = Fix64.Cos(radian);
            moveDirection.y = Fix64.Sin(radian);
            logicActor.move(moveDirection);
        }
        else
        {
            logicActor.stop();
        }


        if (inputEvent.keys[0] == 1)
        {
            if (world.ball.hasOwner)
            {
                if (logicActor.isCtrlBall())
                {
                    //自己控球,进行射门
                    world.beginCheckShootBall(moveDirection);
                }
                else if (logicActor.isMateCtrlBall())
                {
                    //队友控球,进行铲球?
                    world.doSliding(logicActor);
                }
                else
                {
                    //对手控球,进行铲球
                    //logicActor.doSliding();
                    world.doSliding(logicActor);
                }
            }
            else
            {
                //没有人控球,进行铲球
                if (ConstTable.DebugStateAction == 0)
                {
                    //logicActor.doSliding();
                    world.doSliding(logicActor);
                }
                else if (ConstTable.DebugStateAction == 1)
                {
                    logicActor.doTigerCatchingBall();
                }
                else if (ConstTable.DebugStateAction == 3)
                {
                    world.doSkill(logicActor, 0);
                }
            }
        }
        else if (inputEvent.keys[0] == 2)
        {
            if (world.ball.hasOwner)
            {
                if (logicActor.isCtrlBall())
                {
                    world.endCheckShootBall();
                }
            }
            else
            {
            }
        }
        else
        {
        }

        if (inputEvent.keys[1] == 1)
        {
            if (world.ball.hasOwner)
            {
                if (logicActor.isCtrlBall())
                {
                    //自己控球,进行传球
                    logicActor.beginCheckPassBall();
                }
            }
        }
        else if (inputEvent.keys[1] == 2)//j//传球弹起
        {
            if (world.ball.hasOwner)
            {
                if (logicActor.isCtrlBall())
                {
                    logicActor.endCheckPassBall(moveDirection);
                }
                else if (logicActor.isMateCtrlBall())
                {
                    //队友控球,进行要球
                    world.onAskBall(logicActor);
                }
                else
                {
                    //对手控球,进行嘲讽
                    world.onRidicule(logicActor);
                }
            }
            else
            {
                if (world.ball.kicker == null)
                {
                    //没有人控球
                    world.onShowOff(logicActor);
                }
                else if (logicActor.isMateCtrlBall())
                {
                    //队友控球,进行要球
                    world.onAskBall(logicActor);
                }
                else
                {
                    //对手控球,进行嘲讽
                    world.onRidicule(logicActor);
                }
            }
        }
        else
        {
        }
    }