コード例 #1
0
ファイル: TestGameplayContext.cs プロジェクト: kjin/Ribbons
        public override void Initialize()
        {
            world = new World(new Vector2(0, WorldConstants.GRAVITY));
            player = new Player(world, new Vector2(5, 5));
            forceController = new ForceController(InputController, player);
            //ribbon = RibbonFactory.Get(world, ribbonStorage);

            transform = new GameplayTransform(new Vector2(5, 5), 1f);

            ground = new List<Ground>();
            List<Vector2> rectangle = new List<Vector2>();
            rectangle.Add(new Vector2(-3,0));
            rectangle.Add(new Vector2(15,0));
            rectangle.Add(new Vector2(15,2));
            rectangle.Add(new Vector2(-3,2));
            PolygonF polygon;
            polygon.points = rectangle;
            ground.Add(new Ground(world, polygon, GroundType.Ground));

            RibbonStorage ribbonStorage = new RibbonStorage();
            List<Vector2> path = new List<Vector2>();
            path.Add(new Vector2(-5, 3));
            path.Add(new Vector2(17, 3));
            ribbonStorage.Path = path;
            ribbonStorage.Start = 5;
            ribbonStorage.End = 10;

            ribbon = RibbonFactory.Get(world, ribbonStorage);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: kjin/Ribbons
        private bool OnLandingCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            UserData userData = (UserData)fixtureB.UserData;
            if (userData.thing is IRibbonSpeed)
            {
                ribbon = ((IRibbonSpeed)userData.thing).GetRibbon();
            }

            return true;
        }