예제 #1
0
파일: Init.cs 프로젝트: Tsmmmm/ECSDemo2D
    void Start()
    {
        Player player = EntityFactory.Create <Player, string>("model");

        Game.Scene.AddChild(player);
        InputComponent input = ComponentFactory.CreateWithEntity <InputComponent, string, string>(Game.Scene, "GameInputControl", "KeyBordControl");

        input.onStarted += (ctx) =>
        {
            player.GetComponent <Live2dComponent>().PlayAnimation("Walk");
        };

        input.onPerformed += (ctx) =>
        {
            player.GetComponent <Live2dComponent>().PlayAnimation("Run");
        };

        input.onCanceled += (ctx) =>
        {
            player.GetComponent <Live2dComponent>().PlayAnimation("Idle");
        };
    }