public override void update(FBActor actor, Fix64 deltaTime)
        {
            if (actor.world.ball.owner != null)
            {
                //Debuger.Log("GetPassingBallWhenStand over except:" + actor.world.world.frameCount);
                actor.setToMovementState();
                return;
            }

            if (Movement.checkCatchingBall(actor))
            {
                //Debuger.Log("GetPassingBallWhenStand over headCathing:" + actor.world.world.frameCount);
                return;
            }

            actor.m_timer -= deltaTime;

            if (actor.m_timer <= Fix64.Zero)
            {
                //Debuger.Log("GetPassingBallWhenStand time over no cathing??????:" + actor.world.world.frameCount);

                actor.setToMovementState();

                return;
            }

            processRotation(actor, actor.m_stateVector, deltaTime * actor.m_configuration.m1_angularSpeed);
        }
        public override void update(FBActor actor, Fix64 deltaTime)
        {
            if (actor.world.ball.owner != null || !actor.world.ball.willBeCatched)
            {
                actor.setToMovementState();
                return;
            }

            actor.m_timer -= deltaTime;
            if (actor.m_timer <= Fix64.Zero)
            {
                //Debuger.Log("QuickGetPassingBall over get ball:" + actor.world.world.frameCount);
                actor.world.ball.transferTarget = actor;
                actor.setToMovementState();
                return;
            }
        }
Пример #3
0
 public override void update(FBActor actor, Fix64 deltaTime)
 {
     actor.m_timer -= deltaTime;
     if (actor.m_timer <= Fix64.Zero)
     {
         actor.setToMovementState();
     }
 }
Пример #4
0
        void _afterCatching(FBActor actor, Fix64 deltaTime)
        {
            actor.m_timer -= deltaTime;

            if (actor.m_timer <= Fix64.Zero)
            {
                actor.setToMovementState();
            }
        }
Пример #5
0
        void _beforeCatching(FBActor actor, Fix64 deltaTime)
        {
            if (actor.world.ball.owner != null || !actor.world.ball.willBeCatched)
            {
                actor.setToMovementState();
                //actor.m_nextState = Movement.instance;
                return;
            }

            actor.m_timer -= deltaTime;

            if (actor.m_timer <= actor.configuration.scb_catchingAniTime[0] && !actor.m_stateBool)
            {
                actor.m_stateBool = true;
                bool  ccw = false;
                Fix64 va  = FixVector2.cross(actor.m_direction, actor.m_stateVector);
                if (va == Fix64.Zero)
                {
                    ccw = actor.configuration.defautKickBallFoot == 0 ? true : false;
                }
                else
                {
                    ccw = va > Fix64.Zero;
                }
                actor.world.onActorStandCatchingBall(actor, ccw);
            }

            if (actor.m_timer <= Fix64.Zero)
            {
                actor.m_direction = actor.m_stateVector;
                actor.world.ball.transferTarget = actor;

                actor.m_stateSubState = (int)SubState.kAfterCatching;
                actor.m_timer         = actor.m_configuration.scb_lockTimeAfterCatching[0];

                return;
            }

            var cos   = FixVector2.dot(actor.m_stateVector, actor.m_direction);
            var sin   = FixVector2.cross(actor.m_stateVector, actor.m_direction);
            var angle = Fix64.Atan2(sin, cos) * actor.m_timer / actor.m_stateValue;

            cos = Fix64.Cos(angle);
            sin = Fix64.Sin(angle);
            actor.m_direction.x = FixVector2.dot(actor.m_stateVector, new FixVector2(cos, -sin));
            actor.m_direction.y = FixVector2.dot(actor.m_stateVector, new FixVector2(sin, cos));
        }
Пример #6
0
 public override void update(FBActor actor, Fix64 deltaTime)
 {
     actor.m_particle.dampingAcceleration = Fix64.Zero;
     if (actor.world.ball.owner == actor)
     {
         actor.m_particle.maxSpeed = actor.m_configuration.m1_maxSpeed_ball;
         actor.m_particle.addForce(actor.m_direction * actor.m_configuration.m1_moveForce_ball);
     }
     else
     {
         actor.m_particle.maxSpeed = actor.m_configuration.m1_maxSpeed;
         actor.m_particle.addForce(actor.m_direction * actor.m_configuration.m1_moveForce);
     }
     actor.m_timer -= deltaTime;
     if (actor.m_timer <= Fix64.Zero)
     {
         actor.setToMovementState();
         //actor.m_nextState = Movement.instance;
     }
 }
Пример #7
0
        public override void update(FBActor actor, Fix64 deltaTime)
        {
            if (Movement.checkCatchingBall(actor))
            {
                return;
            }

            actor.updateMovingState();

            if (actor.m_stateActor == null && actor.m_stateBall == null)
            {
                actor.m_RunTimeMovementState = null;
                actor.setToMovementState();
                return;
            }

            FixVector2 targetPosition = actor.m_stateActor != null?actor.m_stateActor.getPosition() : actor.m_stateBall.getPosition();

            //处理旋转
            var moveDirection = targetPosition - actor.getPosition();

            moveDirection.normalize();
            processRotation(actor, moveDirection, deltaTime * actor.m_configuration.m1_angularSpeed);

            // 如果不移动,则减速
            if (actor.m_movePower == Fix64.Zero)
            {
                actor.m_particle.dampingAcceleration =
                    actor.world.ball.owner != actor ?
                    actor.m_configuration.m1_stopDampingAcceleration :
                    actor.m_configuration.m1_stopDampingAcceleration_ball;
                return;
            }

            //处理位移
            actor.m_particle.dampingAcceleration = Fix64.Zero;
            actor.defendMoveDirection            = actor.getMoveDirection();
            actor.m_particle.maxSpeed            = actor.m_configuration.dm1_maxSpeed[(int)actor.defendMoveDirection - 1];
            actor.m_particle.addForce(actor.moveDirection * (actor.m_configuration.m1_moveForce * actor.m_movePower));
        }
Пример #8
0
        void _beforeCatching(FBActor actor, Fix64 deltaTime)
        {
            if (actor.world.ball.owner != null || !actor.world.ball.willBeCatched)
            {
                actor.setToMovementState();
                //actor.m_nextState = Movement.instance;
                return;
            }

            actor.m_timer -= deltaTime;

            if (actor.m_timer <= actor.configuration.scb_catchingAniTime[actor.m_stateDataIndex] && !actor.m_stateBool)
            {
                actor.m_stateBool = true;
                actor.world.onActorAirCatchingBall(actor, actor.m_stateDataIndex);
            }

            if (actor.m_timer <= Fix64.Zero)
            {
                actor.m_direction = actor.m_stateVector;
                actor.world.ball.transferTarget = actor;

                actor.m_stateSubState = (int)SubState.kAfterCatching;
                actor.m_timer         = actor.m_configuration.scb_lockTimeAfterCatching[actor.m_stateDataIndex];

                return;
            }

            var cos   = FixVector2.dot(actor.m_stateVector, actor.m_direction);
            var sin   = FixVector2.cross(actor.m_stateVector, actor.m_direction);
            var angle = Fix64.Atan2(sin, cos) * actor.m_timer / actor.m_stateValue;

            cos = Fix64.Cos(angle);
            sin = Fix64.Sin(angle);
            actor.m_direction.x = FixVector2.dot(actor.m_stateVector, new FixVector2(cos, -sin));
            actor.m_direction.y = FixVector2.dot(actor.m_stateVector, new FixVector2(sin, cos));
        }