示例#1
0
        public override void enter(FBActor actor)
        {
            if (actor.m_stateInt != (int)BallDetachType_Attacked.None)
            {
                FixVector2 velocity = actor.direction * (actor.particle.velocity.length + actor.configuration.ballDetachSpeedAttacked[(int)actor.m_stateInt]);
                FixVector3 position = actor.getBallPosition((BallDetachType_Attacked)actor.m_stateInt);
                actor.world.ball.freeByAttacked(position, velocity, Fix64.Zero);
                actor.world.ball.setSampleType(FBBall.SampleType.TimeSlerp, actor.configuration.ballDetachSlerpTimeAttacked[actor.m_stateInt]);
            }


            FixVector2 dir = (actor.getPosition() - actor.m_stateActor.getPosition()).normalized;

            actor.m_stateVector = dir * actor.m_stateActor.configuration.bst1_initialSpeed;

            if (actor.configuration.st_beAttackedFaceBackoff == 1)
            {
                actor.direction = dir;
            }
            else
            {
                actor.direction = -dir;
            }


            actor.m_stateSubState = (int)SubState.kDampingToZero;
            actor.m_timer         = actor.m_stateActor.configuration.bst1_dampingToZeroTime;

            //持球队员被攻击
            if (actor.m_stateInt != (int)BallDetachType_Attacked.None)
            {
                actor.world.fbGame.lerpToTimeScale(
                    ConstTable.ActorAttackedSlowPlaySpeed,
                    ConstTable.ActorAttackedSlowPlayTime,
                    ConstTable.ActorAttackedResetTime,
                    () => { actor.world.onBeginHit(actor.m_stateActor.id, actor.id); },
                    () => { actor.world.onEndHit(); },
                    () => { actor.world.onHitCompleted(); }
                    );
            }

            actor.world.onBeSlidDropBallBegin(actor, true);
        }
示例#2
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));
    }
示例#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());
    }