Example #1
0
    //某个角色开始传球
    //短传0,长传1
    public void beginPassBall(FBActor actor, FixVector2 passBallDirection, int index)
    {
        //Debuger.Log("beginPassBall...........");

        Fix64 maxR  = m_ball.owner.configuration.passBallMaxR[index];
        Fix64 minR  = m_ball.owner.configuration.passBallMinR[index];
        Fix64 angle = m_ball.owner.configuration.passBallFov[index];
        Fix64 bestR = m_ball.owner.configuration.passBallBestR[index];

        //没有键入方向,使用角色朝向
        if (passBallDirection == FixVector2.kZero)
        {
            passBallDirection = actor.direction;
        }

        FBActor target = findTarget(m_ball.owner, passBallDirection, index, (int)m_ball.owner.team, m_ball.owner);

        if (target != null)
        {
            passBallDirection = target.getPosition() - m_ball.owner.getPosition();
            passBallDirection = passBallDirection.normalized;
        }

        FixVector2 actorFaceDirection = getAjustedDirection(actor.direction, passBallDirection, actor.configuration.passBallAngleTorelance[index]);

        actor.doPassBall(index, actorFaceDirection);

        //保存传球对象
        passBallType   = index;
        passBallTarget = target;
        passBallDir    = passBallDirection;
    }