コード例 #1
0
        public override void enter(FBActor actor)
        {
            actor.m_stateSubState = (int)SubState.kBeforePassing;
            actor.m_timer         = actor.m_configuration.pb_beforePassingTime[actor.m_stateDataIndex];
            var   cos = FixVector2.dot(actor.m_direction, actor.m_stateVector);
            Fix64 ralativeDirection = Fix64.Zero;

            if (cos < Fix64.One)
            {
                var sin = Fix64.Sqrt(Fix64.One - cos * cos);

                ralativeDirection = FixVector2.cross(actor.m_direction, actor.m_stateVector);
                if (ralativeDirection >= Fix64.Zero)
                {
                    sin = -sin;
                }
                actor.m_stateValue = Fix64.Atan2(sin, cos);
            }
            else
            {
                actor.m_stateValue = Fix64.Zero;
            }

            int passBallFoot = actor.getKickBallFoot(actor.m_stateVector, actor.m_direction);

            actor.world.onPassBallBegin(actor, actor.m_stateDataIndex == 0, passBallFoot == 1);
        }