예제 #1
0
        public static void UnitTest()
        {
            TestGame.StartTest("SceneData 载入测试 F1-Terrain F2-TiledTerrain",
                null,
                delegate
                {
                    SceneMgr.Instance.ChangeScene("TestSceneYard");
                },
                delegate
                {
                    if(InputKeyboards.isKeyJustPress(Keys.F1))
                    {
                        SceneMgr.Instance.ChangeScene("TestSceneYard");

                        Vector2 roleSize = new Vector2(32, 48);
                        float runforce = 1000.0f;
                        float jumpforce = 3000.0f;
                        float maxRunForce = 50;
                        Role role = new Role("./Roles/soldier", roleSize, 10, 32, 48, 17, runforce, jumpforce, maxRunForce);
                        role.Position = new Vector2(400, 100);
                        role.origin = new Vector2(16, 24);
                        role.animSeqList.Add(new AnimItem.AnimSequence("Free", 40, 6, 8, true, true));
                        role.animSeqList.Add(new AnimItem.AnimSequence("Running", 0, 8, 8, true, true));
                        role.animSeqList.Add(new AnimItem.AnimSequence("Jumping", 8, 9, 4, true, false));
                        role.animSeqList.Add(new AnimItem.AnimSequence("UsingItem", 17, 8, 7, true, false));
                        role.animSeqList.Add(new AnimItem.AnimSequence("UsingGun", 24, 13, 12, true, false));
                        role.animSeqList.Add(new AnimItem.AnimSequence("UsingHook", 37, 1, 8, true, false));
                        role.PlaySeq("Free");
                        SceneMgr.Instance.AddItem(role);
                    }
                    else if (InputKeyboards.isKeyJustPress(Keys.F2))
                    {
                        SceneMgr.Instance.ChangeScene("TestSceneRoom");

                        Vector2 roleSize = new Vector2(32, 48);
                        float runforce = 1000.0f;
                        float jumpforce = 3000.0f;
                        float maxRunForce = 50;
                        Role role = new Role("./Roles/soldier", roleSize, 10, 32, 48, 17, runforce, jumpforce, maxRunForce);
                        role.Position = new Vector2(400, 100);
                        role.origin = new Vector2(16, 24);
                        role.animSeqList.Add(new AnimItem.AnimSequence("Free", 40, 6, 8, true, true));
                        role.animSeqList.Add(new AnimItem.AnimSequence("Running", 0, 8, 8, true, true));
                        role.animSeqList.Add(new AnimItem.AnimSequence("Jumping", 8, 9, 4, true, false));
                        role.animSeqList.Add(new AnimItem.AnimSequence("UsingItem", 17, 8, 7, true, false));
                        role.animSeqList.Add(new AnimItem.AnimSequence("UsingGun", 24, 13, 12, true, false));
                        role.animSeqList.Add(new AnimItem.AnimSequence("UsingHook", 37, 1, 8, true, false));
                        role.PlaySeq("Free");
                        SceneMgr.Instance.AddItem(role);
                    }
                },
                delegate
                {
                }
            );
        }
예제 #2
0
        public new static void UnitTest()
        {
            Role role = null;
            TestGame.StartTest(
                "角色测试",
                null,
                delegate
                {
                    Vector2 itemSize = Vector2.Zero;

                    itemSize = new Vector2(800,100);
                    Terrain rectG = new Terrain("GameandMe", itemSize, 1);
                    rectG.Position = new Vector2(400, 500);
                    rectG.origin = new Vector2(100,100);
                    SceneMgr.Instance.AddItem(rectG);

                    itemSize = new Vector2(200, 10);
                    rectG = new Terrain("GameandMe",itemSize,1);
                    rectG.Position = new Vector2(400, 430);
                    rectG.Rotation = 0.1f;
                    rectG.origin = new Vector2(100, 100);
                    SceneMgr.Instance.AddItem(rectG);

                    itemSize = new Vector2(100,600);
                    rectG = new Terrain("GameandMe",itemSize,1);
                    rectG.Position = new Vector2(50, 600);
                    rectG.origin = new Vector2(50, 300);
                    SceneMgr.Instance.AddItem(rectG);

                    itemSize = new Vector2(100, 600);
                    rectG = new Terrain("GameandMe",itemSize,1);
                    rectG.Position = new Vector2(750, 600);
                    rectG.origin = new Vector2(50, 300);
                    SceneMgr.Instance.AddItem(rectG);

                    itemSize = new Vector2(32, 48);
                    float runforce = 1000.0f;
                    float jumpforce = 3000.0f;
                    float maxRunSpeed = 50;
                    role = new Role("Roles/soldier", itemSize, 10, 32, 48, 17, runforce, jumpforce, maxRunSpeed);
                    role.Position = new Vector2(400, 100);
                    role.origin = new Vector2(16, 24);
                    role.animSeqList.Add(new AnimSequence("Free", 40, 6, 8, true, true));
                    role.animSeqList.Add(new AnimSequence("Running", 0, 8, 8, true, true));
                    role.animSeqList.Add(new AnimSequence("Jumping", 8, 9, 4, true, false));
                    role.animSeqList.Add(new AnimSequence("UsingItem", 17, 8, 7, true, false));
                    role.animSeqList.Add(new AnimSequence("UsingGun", 24, 13, 12, true, false));
                    role.animSeqList.Add(new AnimSequence("UsingHook", 37, 1, 8, true, false));
                    role.PlaySeq("Free");
                    SceneMgr.Instance.AddItem(role);
                },
                delegate
                {
                },
                delegate
                {
                    Painter.DrawBegin();
                    Painter.DrawLine("人物状态"+role.RoleState.ToString(),Vector2.Zero);
                    Painter.DrawEnd();
                }
                );
        }
예제 #3
0
        /// <summary>
        /// 清空场景
        /// </summary>
        public void ResetScene()
        {
            // 重置物理模拟环境
            PhysicsSys.Instance.PhysicsSimulator.Clear();
            // 重置摄像机...

            // 清空ItemMgr
            ClearItemList(); // 过期..
            backgroundMgr = null;
            terrainMgr = null;
            actItemMgr = null;
            role = null;
            forgroundMgr = null;
            
        }