Exemplo n.º 1
0
        private void CreateSquirrel(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity child = Entity.CreateEntity("Squirrel", "Child", trans);

            child.RegisterComponent(new C_Switch3());
            child.RegisterComponent(new C_CharaState());
            child.RegisterComponent(new C_ChildState());
            C_BezierPoint bezier = new C_BezierPoint();

            child.RegisterComponent(bezier);
            BezierStage.AddBezierData(bezier);
            //child.RegisterComponent(new C_DrawDebugMessage(bezier));
            child.RegisterComponent(new C_EntityDeadCheck());
            child.RegisterComponent(new C_Energy("", 10, 90));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(80, 60), 14);

            drawComp.AddAnim("Run", new AnimData(7, 7, 0.08f, "A_Squirrel_Run"));
            drawComp.AddAnim("Eat", new AnimData(1, 1, 1f, "A_Squirrel_Eat"));
            drawComp.AddAnim("Catch", new AnimData(1, 1, 1f, "A_Squirrel_Catch"));
            child.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Run");

            child.RegisterComponent(new C_UpdateSquirrelState(gameDevice));
        }
Exemplo n.º 2
0
        public void CreatPlayer()
        {
            //生成地を決める
            Transform2D trans = new Transform2D();

            trans.Position = new Vector2(500, 100);

            //実体生成
            Entity player = Entity.CreateEntity("Player", "Player", trans);

            //機能登録(順序注意 - 関連性ある)
            player.RegisterComponent(new C_Switch3());
            player.RegisterComponent(new C_CharaState());
            C_BezierPoint bezier = new C_BezierPoint();

            player.RegisterComponent(bezier);
            BezierStage.AddBezierData(bezier);
            player.RegisterComponent(new C_EntityDeadCheck());
            player.RegisterComponent(new C_PlayerState());
            player.RegisterComponent(new C_DrawRouteEffect());
            //player.RegisterComponent(new C_DrawLocus());
            player.RegisterComponent(new C_DrawDebugMessage(gameDevice, bezier));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(Vector2.One * 256, 16);

            drawComp.AddAnim("Idle", new AnimData(1, 1, 1, "A_Player_Idle"));
            drawComp.AddAnim("Walk", new AnimData(4, 4, 0.12f, "A_Player_Walk"));
            drawComp.AddAnim("Jump", new AnimData(2, 3, 0.1f, "A_Player_Jump", false));
            drawComp.AddAnim("Run", new AnimData(13, 4, 0.05f, "A_Player_Run"));
            drawComp.AddAnim("Attack", new AnimData(1, 1, 1, "A_Player_Attack"));
            player.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Idle");

            player.RegisterComponent(new C_Energy("Bar", 10, 270));
            player.RegisterComponent(new C_UpdatePlayerState(gameDevice));
        }