示例#1
0
        /// <summary>
        /// 在场景中创建对象
        /// </summary>
        public override void OnStart()
        {
            //主角位于原点
            GameObject player = TPSFactroy.CreateStandardPlayer("吊", new Vector2(0, 0));

            GameObject.CreateWith <CameraController>().followTrans = player;
            player.AddComponent <Shooter>();

            //创建迷宫地图 位于第三象限
            var maze = MazeGeneration.GetMaze(21, 21, new RenderPoint("■", Color.White, Config.DefaultBackColor, (int)Layer.Environment));

            maze.Position = new Vector2(-25, -25);

            //俄罗斯方块位于第一象限
            for (int x = 5; x < 20; x += 5)
            {
                for (int y = 5; y < 20; y += 5)
                {
                    TPSFactroy.CreateBox(new Vector2(x, y));
                }
            }

            //系统指示器 位于右上角
            SystemUIFactroy.GetSystemInspector();

            //左侧的三个UI组件
            TPSFactroy.CreateTestLable(new Vector2(0, 26));

            ListBox gunBox = UIFactroy.CreateListBox(new Vector2(0, 15), 5, 10);

            gunBox.AddComponent <GunBox>();

            var gunUI = UIFactroy.CreateTextBox(new Vector2(0, 21), 3, 10);

            gunUI.AddComponent <GunUI>();
        }