Exemplo n.º 1
0
    FixVector3 getActorShootOutPosition(FBActor actor, ShootType shootType)
    {
        BallDetachType bt = BallDetachType.NormalShoot;

        if (shootType == ShootType.Normal)
        {
            bt = BallDetachType.NormalShoot;
        }
        else if (shootType == ShootType.Power)
        {
            bt = BallDetachType.PowerShoot;
        }
        else if (shootType == ShootType.Super)
        {
            bt = BallDetachType.SuperShoot;
        }
        else if (shootType == ShootType.Killer)
        {
            bt = BallDetachType.KillerShoot;
        }
        return(actor.getBallPosition(bt));
    }
Exemplo n.º 2
0
    public FixVector3 getBallPosition(BallDetachType type)
    {
        var ballPos = calculateRelativePosition(configuration.ballDetachPositions[(int)type]);

        return(ballPos);
    }
Exemplo n.º 3
0
    void passBallOut()
    {
        var            owner             = m_ball.owner;
        bool           fly               = passBallType == 1;
        BallDetachType bt                = passBallType == 1 ? BallDetachType.LongPass : BallDetachType.ShortPass;
        FixVector3     ballStartPosition = owner.getBallPosition(bt);
        FixVector2     frontPosition     = new FixVector2(ballStartPosition.x, ballStartPosition.z);

        FBActor target = passBallTarget;

        if (target == null)
        {
            //Debuger.Log("PassingBall no target");
            Fix64 passSpeed     = owner.configuration.passingBallSpeedWhenNoTarget[passBallType];
            Fix64 verticleSpeed = owner.configuration.passingBallVerticleSpeedWhenNoTarget[passBallType];
            m_ball.freeByKick(ballStartPosition, (FixVector2)passBallDir * passSpeed, verticleSpeed, true);
        }
        else
        {
            //长传
            if (fly)
            {
                if (checkSlowGetPassingBall(owner, target, 1))
                {
                    FixVector3 targetBallP        = target.getBallPosition(BallAttachType.Long_StandGetPassingBall);
                    var        targetBallPosition = new FixVector2(targetBallP.x, targetBallP.z);

                    //Debuger.Log("Long PassingBall slow get begin");

                    FixVector2 distance = frontPosition - targetBallPosition;

                    Fix64 s = distance.length;
                    Fix64 t = calculateSlowShortPassBallTime(s);

                    //m_ball.freeByLongPass(targetBallPosition, target.configuration.ccb_ballHeight, t);
                    m_ball.freeByLongPass(ballStartPosition, targetBallPosition, targetBallP.y, t);
                    target.doGetPassingBallWhenStand(t, distance / s);
                }
                else if (checkQuickGetPassingBall(owner, target, 1))
                {
                    FixVector3 targetBallP        = target.getBallPosition(BallAttachType.Long_RuningGetPasssingBall);
                    var        targetBallPosition = new FixVector2(targetBallP.x, targetBallP.z);

                    Debuger.Log("Long PassingBall quick get begin");

                    Fix64 t = ((target.getPosition() - frontPosition).length + ConstTable.GetLongPasingBall_K1[1]) * ConstTable.GetLongPasingBall_K2[1];

                    targetBallPosition = targetBallPosition + target.particle.velocity * t;

                    m_ball.freeByLongPass(ballStartPosition, targetBallPosition, targetBallP.y, t);

                    target.doGetPassingBallWhenMoving(t);
                }
                else
                {
                    //Debuger.Log("Long PassingBall Failed");
                }
            }
            else
            {
                if (checkSlowGetPassingBall(owner, target, 0))
                {
                    FixVector3 targetBallP        = target.getBallPosition(BallAttachType.Long_StandGetPassingBall);
                    var        targetBallPosition = new FixVector2(targetBallP.x, targetBallP.z);

                    //Debuger.Log("short PassingBall slow get begin");

                    FixVector2 distance = frontPosition - targetBallPosition;

                    Fix64 s = distance.length;
                    Fix64 t = calculateSlowShortPassBallTime(s);
                    target.doGetPassingBallWhenStand(t, distance / s);

                    Fix64 t1 = t * ConstTable.GetShortPasingBall_K4[0];
                    Fix64 t2 = t * (Fix64.One - ConstTable.GetShortPasingBall_K4[0]);
                    m_ball.freeByNormalPass(ballStartPosition, targetBallPosition, t1, t2);
                }
                else if (checkQuickGetPassingBall(owner, target, 0))
                {
                    FixVector3 targetBallP        = target.getBallPosition(BallAttachType.Long_StandGetPassingBall);
                    var        targetBallPosition = new FixVector2(targetBallP.x, targetBallP.z);

                    //Debuger.Log("short PassingBall quitk get begin");

                    Fix64 t = ((target.getPosition() - frontPosition).length + ConstTable.GetShortPasingBall_K2[1]) * ConstTable.GetShortPasingBall_K3[1];

                    targetBallPosition = targetBallPosition + target.particle.velocity * t;

                    Fix64 t1 = t * ConstTable.GetShortPasingBall_K4[1];
                    Fix64 t2 = t * (Fix64.One - ConstTable.GetShortPasingBall_K4[1]);

                    target.doGetPassingBallWhenMoving(t1 + t2);
                    m_ball.freeByNormalPass(ballStartPosition, targetBallPosition, t1, t2);
                }
                else
                {
                    //Debuger.Log("short PassingBall Failed");
                }
            }
        }
        m_ball.increaseEnergy(fly ? owner.configuration.longPassEnergy : owner.configuration.shortPassEnergy);
        onPassBallOut(owner, m_ball.get3DVelocity());
    }