예제 #1
0
        // TODO ajouter un PlayerBundle ou un PlayerInfo ou un truc dans ce genre
        public SpacePlayer(PlayerIndex playerIndex, SpaceShipDescription description)
            : base()
        {
            AssetName = description.AssetName;

            _playerIndex = playerIndex;

            _shipSpeed = description.ShipSpeed;

            _playerProfile = new PlayerProfile(String.Format("Player {0}", ((int)playerIndex) + 1), (int)playerIndex);

            _firstWeaponType  = (WeaponType)description.PrimaryWeaponId;
            _secondWeaponType = (WeaponType)description.SecondaryWeaponId;

            _bonusLevel = BonusLevel.None;

            VelocityMax       = 0.95f;
            ForceInsideScreen = true;

            _live = 3;

            // TODO : case
            _shields = new YnSprite("Ship/Shield/Shields");

            _weaponManager              = new WeaponManager(this);
            _weaponManager.Initialized  = true;
            _weaponManager.AssetsLoaded = true;

            LayerDepth = 0.4f;

            _playerTouchedTimer            = new YnTimer(1500, 0);
            _playerTouchedTimer.Completed += _playerTouchedTimer_Completed;

#if COMPLETE
            kinect = KinectSensorController.Instance;

            if (_playerIndex == PlayerIndex.One)
            {
                _kinectPlayerIndex = KinectPlayerIndex.One;
            }

            else if (_playerIndex == PlayerIndex.Two)
            {
                _kinectPlayerIndex = KinectPlayerIndex.Two;
            }
#endif

            LoadContent();
        }
예제 #2
0
        protected bool _kinectValidedAction;            // Indique si l'item a été validé après le temps d'activation
#endif
        /// <summary>
        /// Représente un écran de menu standard avec un titre et des items
        /// </summary>
        public BaseMenu(string title, int numItems)
            : base("basemenu", true)
        {
            // 1 - Le titre
            _title       = new YnText("Fonts/Menu", title);
            _title.Color = Color.GhostWhite;
            _title.Scale = new Vector2(1.5f, 1.5f);
            Add(_title);

            string pointerAssetName = Assets.MouseCursor;

#if COMPLETE
            kinect = KinectSensorController.Instance;

            _lastKinectPosition = Vector3.Zero;

            // Aucune action validée pour le moment
            _kinectValidedAction = false;

            // Evenements kinect
            _timerKinectOver            = new YnTimer(KinectTimerDuration, 0);
            _timerKinectOver.Completed += new EventHandler <EventArgs>(_timerKinectOver_Completed);
            _timerKinectOver.ReStarted += new EventHandler <EventArgs>(_timerKinectOver_ReStarted);

            _transitionKinectOver = new YnTransition(KinectTimerDuration);

            if (kinect.IsAvailable)
            {
                pointerAssetName = Assets.KinectCursor;
            }
#endif

            items = new List <MenuItem>(numItems);

            // Le curseur de souris/Kinect
            _handSelector = new YnEntity(pointerAssetName);
        }