示例#1
0
 private void UpdateDndLayer()
 {
     if (KeyboardReader.GetClickedKeys().Contains(Keys.L))
     {
         DndItem.LayerDepth = Enum.GetValues(typeof(LayerDepth))
                              .Cast <LayerDepth>()
                              .Where(l => l != LayerDepth.None)
                              .ElementAt((int)DndItem.LayerDepth % 3);
     }
 }
示例#2
0
        public void Update(GameObject gameObject, GameTime gameTime)
        {
            Keys[] keys = KeyboardReader.GetClickedKeys();

            if (keys.Contains(Keys.W))
            {
                foreach (GameObject collisionObject in _collisionObjects)
                {
                    if (collisionObject.Bounds.Contains(gameObject.Bounds))
                    {
                        _gameplayManager.NextLevel();
                    }
                }
            }
        }
        public void Update(GameObject gameObject, GameTime gameTime)
        {
            Keys[] keys = KeyboardReader.GetClickedKeys();

            if (keys.Contains(Keys.W))
            {
                foreach (GameObject teleporterObject in _teleporterObjects)
                {
                    if (teleporterObject.Bounds.Contains(gameObject.Bounds))
                    {
                        GameObject[] teleporters = _teleporterObjects.Where(t => t != teleporterObject).ToArray();

                        if (teleporters.Length > 0)
                        {
                            GameObject teleporter = teleporters[Game1.Random.Next(0, teleporters.Length)];
                            gameObject.Position = teleporter.Position + (gameObject.Position - teleporterObject.Position);
                            break;
                        }
                    }
                }
            }
        }