Exemplo n.º 1
0
        public KinectBody2D(KinectInputManager kinectInputManager)
        {
//            position = Vector2.zero;
            joints = new Dictionary <Kinect.JointType, Vector2>();

            this.kinectInputManager = kinectInputManager;
        }
Exemplo n.º 2
0
        public BandMaster(): base()
        {
            Content.RootDirectory = "Content";

            // Services
            
            GraphicsDeviceManager graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth = width;

            graphics.IsFullScreen = true;

            IManageInput inputManager;
            try
            {
                inputManager = new KinectInputManager(this);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message.ToString());
                inputManager = new AlternativeInputManager(this);
            }

            inputManager.OnExit += OnExit;

            Components.Add(inputManager);
            Services.AddService(typeof(IManageInput), inputManager);

            Midi.Player player = new Midi.Player(this);
            Components.Add(player);
            Services.AddService(typeof(Midi.Player), player);

            AudioFx fx = new AudioFx(this);
            Components.Add(fx);
            Services.AddService(typeof(AudioFx), fx);

            Helpers.Game = this;

            // Game modes

            Play = new Logic.BandMasterMode(this);
            Pause = new Logic.PauseMenuMode(this);
            Menu = new Logic.MainMenuMode(this);
            Tutorial = new Logic.TutorialMode(this);
            HighScore = new Logic.HighScoreMode(this);

            Components.Add(Play);
            Components.Add(Pause);
            Components.Add(Menu);
            Components.Add(Tutorial);
            Components.Add(HighScore);
            
            // Graphics
            Graphics.SplashText splasher = new Graphics.SplashText(this);
            Components.Add(splasher);
            Services.AddService(typeof(Graphics.SplashText), splasher);

            Graphics.FlyingNotes notes = new Graphics.FlyingNotes(this);
            Components.Add(notes);
            Services.AddService(typeof(Graphics.FlyingNotes), notes);

            Components.Add(new Graphics.HandVisualizer(this));

            Components.Add(new Graphics.Stage(this));
        }
Exemplo n.º 3
0
 public KinectDebug(Game game, KinectInputManager input) : base(game)
 {
     this.input = input;
     this.DrawOrder = 1120;
 }
Exemplo n.º 4
0
//// FULL BODY - MID


    void Update()
    {
//TODO: should be done in "Start" (?)
        if (BodySourceManager == null)
        {
            return;
        }

//TODO: should be done in "Start" (?)
        _BodyManager = BodySourceManager.GetComponent <KinectInputManager>();
        if (_BodyManager == null)
        {
            return;
        }

        Kinect.Body[] data = _BodyManager.GetBodyData();
        if (data == null)
        {
            return;
        }

        List <ulong> trackedIds = new List <ulong>();

        foreach (var body in data)
        {
            if (body == null)
            {
                continue;
            }

            if (body.IsTracked)
            {
                trackedIds.Add(body.TrackingId);
            }
        }

        List <ulong> knownIds = new List <ulong>(_Bodies.Keys);

        // First delete untracked bodies
        foreach (ulong trackingId in knownIds)
        {
            if (!trackedIds.Contains(trackingId))
            {
//TODO!
                head.parent = null;
                Destroy(_Bodies[trackingId]);
                _Bodies.Remove(trackingId);
            }
        }

        foreach (var body in data)
        {
            if (body == null)
            {
                continue;
            }

            if (body.IsTracked)
            {
                if (!_Bodies.ContainsKey(body.TrackingId))
                {
                    _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId);
                }

                RefreshBodyObject(body, _Bodies[body.TrackingId]);
            }
        }
    }