Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public override void OnStart()
        {
            Camera.Main.Position = Vector2.Zero;

            //检查资源文件数量
            Resource.Init();
            Debug.Log("查找目录Resouce,资源数量:" + Resource.Name_Path.Keys.Count);
            //开启贴图转换器 GDI渲染可用,使用贴图文件代替原字符显示
            ImageConvertor.Init();

            //创建角色
            SRPGAgent wizardAgent = GameObject.CreateWith <SRPGAgent>();

            wizardAgent.LocalPosition = new Vector2(12, 12);
            //创建系统监视器
            SystemUIFactroy.GetSystemInspector(new Vector2(28, 13));
            //创建迷宫地图
            var maze = MazeGeneration.GetMaze(21, 21, new RenderPoint("■", Color.White, Config.DefaultBackColor, (int)Layer.Environment));

            maze.Position = new Vector2(5, 5);
        }
Ejemplo n.º 2
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>();
        }