示例#1
0
        private void AddObstacle(Obstacle o)
        {
            HookPointBody b;
            //////////////////////////
            //Create the Obstacle Body
            //////////////////////////
            /////////////////////////////////
            //Set points at queue postion 
            /////////////////////////////////
            b = new HookPointBody(World, o.initialPosition, o._hookPointBodyType);

            CircleShape CircleShape = new CircleShape(1f, 1f);
            //Vertices varray = new Vertices(10);
            //CircleShape CircleShape = new PolygonShape(varray, 1f);
            Fixture fixture = b.CreateFixture(CircleShape);
            fixture.Body.BodyType = BodyType.Kinematic;

            ///////////////////////////////////////
            //Set the created body of our hookpoint
            ///////////////////////////////////////
            o._hookPointBody = b;

            ///////////////////////////////
            //Add hookpoints to our manager
            ///////////////////////////////
            hookpointmanager.AddObstacle(o);
        }
示例#2
0
 public void SetBody(HookPointBody body)
 {
     _hookPointBody = body;
 }
示例#3
0
        private void AddHookPoint(HookPoint hookpoint)
        {
            HookPointBody b;
            if (StageManager.IsFirstStage())
            {
                /////////////////////////////////
                //Set points at start position
                //for first stage
                /////////////////////////////////
                b = new HookPointBody(World, hookpoint.StartingPositon, hookpoint._hookPointBodyType);
            }
            else
            {
                /////////////////////////////////
                //Set points at queue postion 
                /////////////////////////////////
                b = new HookPointBody(World, hookpoint.initialPosition, hookpoint._hookPointBodyType);
            }
            CircleShape CircleShape = new CircleShape(1f, 1f);
            //Vertices varray = new Vertices(10);
            //CircleShape CircleShape = new PolygonShape(varray, 1f);
            Fixture fixture = b.CreateFixture(CircleShape);
            fixture.Body.BodyType = BodyType.Kinematic;
            /////////////////////////////////////////
            //Check if our type should collide with
            //the swinger
            /////////////////////////////////////////
            if (b._hookPointBodyType != HookPointBodyType.Bullet)
            {
                //Ignor collison
                fixture.IgnoreCollisionWith(swinger);                
            }

            ///////////////////////////////////////
            //Set the created body of our hookpoint
            ///////////////////////////////////////
            hookpoint._hookPointBody = b;

            if (StageManager.IsFirstStage())
            {
                /////////////////////////////
                //first stage has no incoming
                //hookpoints, they are already
                //set
                /////////////////////////////
                hookpoint._isIncoming = false;
            }
            else
            {
                /////////////////////////////
                //set incoming to true
                /////////////////////////////
                hookpoint.SetIncoming();

            }

            ///////////////////////////////
            //Add hookpoints to our manager
            ///////////////////////////////
            hookpointmanager.AddHookPoint(hookpoint);
        }