示例#1
0
    public void setupFBGame(ulong tableId, uint mapID)
    {
        LogicEvent.add("onChangeCampState", this, "onChangeCampState");

        frameSync = new FrameSync();
        frameSync.addLogicUpdator(this);
        frameSync.frameSyncEventHandler = this;

        this.tableId = tableId;

        fbWorld            = new FBWorld(this);
        fbWorld.randomSeed = 100;

        var worldConfig = new FBWorld.Configuration();
        var btConfig    = new FBWorld.BTConfiguration(worldConfig.worldSize);

        fbWorld.setup(worldConfig, btConfig);
        matchTimer = Fix64.Zero;
        ////创建球
        createBall();

        fbWorld.onGoal += goal;

        onFBGameCreated();
    }
示例#2
0
文件: FBBall.cs 项目: CookiRui/script
    //public void moveToward(FixVector2 velocity, Fix64 flyVelocity, bool pass)
    //{
    //    m_willBeCatched = false;
    //    m_particle.clearCollidedEventFlag();
    //    m_particle.velocity = velocity;
    //    m_particle.dampingAcceleration_land = landDampingAcceleration;
    //    m_particle.dampingAcceleration_air = airDampingAcceleration;
    //    m_particle.landingDamping = landingDamping;
    //    m_particle.angularVelocity = Fix64.Zero;
    //    m_particle.fly(Fix64.Zero, flyVelocity, gravity);
    //    kickIsPass = pass;
    //}

    //public void moveToward(FixVector2 velocity, Fix64 angularVelocity, Fix64 flyVelocity, bool pass)
    //{
    //    m_willBeCatched = false;
    //    m_particle.clearCollidedEventFlag();
    //    m_particle.velocity = velocity;
    //    m_particle.dampingAcceleration_land = landDampingAcceleration;
    //    m_particle.dampingAcceleration_air = airDampingAcceleration;
    //    m_particle.landingDamping = landingDamping;
    //    m_particle.angularVelocity = angularVelocity;
    //    m_particle.fly(Fix64.Zero, flyVelocity, gravity);
    //    kickIsPass = pass;
    //}

    public FBBall(Configuration config, FBWorld.Configuration worldConfig)
    {
        m_configuration               = config;
        m_particle                    = new NewBallParticle();
        m_particle.radius             = config.radius;
        m_particle.linearDamping_land = config.linearDamping_land;
        m_particle.linearDamping_air  = config.linearDamping_air;
        m_particle.landHitDamping     = config.landHitVerticleDamping;
        m_particle.ceilHitDamping     = worldConfig.ballCollisionRestitution[4];
        m_particle.ceilHeight         = worldConfig.doorHeight;
        m_particle.angularDamping     = config.angularDamping;
        m_particle.gravity            = config.gravity;
        m_particle.tag                = this;
        energy = config.getEnergy(0);
        m_particle.onLanded += (times, preHeightVelocity) =>
        {
            world.onBallLanded(m_particle.position, ballState == BallState.PassBall, times, get3DVelocity(), preHeightVelocity);
            ballState = BallState.Free;
        };
    }