Exemplo n.º 1
0
    private void AddPlayer()
    {
        playerID = Game.EntityManager.CreateEntity();

        var inputBlock = new ActionComponent();

        inputBlock.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, inputBlock);

        var form = new FormComponent();

        form.InitComponent(playerID, new Vector3(0, 50, 0), "Player", "");
        Game.EntityManager.AddComponent(playerID, form);

        var animComp = new AnimationComponent();

        animComp.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, animComp);

        var move = new MovementComponent();

        move.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, move);

        var crouch = new CrouchComponent();

        crouch.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, crouch);

        var run = new RunComponent();

        run.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, run);

        var jump = new JumpComponent();

        jump.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, jump);

        var skill = new SkillComponent();

        skill.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, skill);

        var health = new HealthComponent()
        {
            Damage = 0, DeathType = HealthComponent.DeathTypes.LifeEnded, HP_Max = 50
        };

        health.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, health);

        var menuOptions = new MenuComponent();

        menuOptions.InitComponent(null);
        menuOptions.InitComponent(playerID, "Menu");
        Game.EntityManager.AddComponent(playerID, menuOptions);
    }