Esempio n. 1
0
        /// <summary>
        /// Render's the mesh with the specified render technique
        /// </summary>
        /// <param name="RenderTechnique"></param>
        public override void RenderMesh(string RenderTechnique)
        {
            //Set the Selection Colour based off of Selection State
            switch (SelectionState)
            {
            case vxEnumSelectionState.Selected:
                EmissiveColour = Color.DarkOrange;
                break;

            case vxEnumSelectionState.Hover:
                EmissiveColour = Color.DeepSkyBlue;
                break;

            case vxEnumSelectionState.Unseleced:
                EmissiveColour = Color.Black;
                break;
            }

            //Reset Selection state if it's only hovered
            if (SelectionState == vxEnumSelectionState.Hover)
            {
                SelectionState = vxEnumSelectionState.Unseleced;
            }

            //Render through the base class
            base.RenderMesh(RenderTechnique);
        }
Esempio n. 2
0
        /// <summary>
        /// Applies a simple rotation to the ship and animates position based
        /// on simple linear motion physics.
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            if (PhysicsSkin_Main != null)
            {
                BoundingBox = PhysicsSkin_Main.BoundingBox;
            }

            if (SelectionState == vxEnumSelectionState.Hover && vxEngine.InputManager.IsNewMouseButtonPress(MouseButtons.LeftButton))
            {
                SelectionState = vxEnumSelectionState.Selected;
            }


            if (SelectionState == vxEnumSelectionState.Selected &&
                PreviousSelectionState != vxEnumSelectionState.Selected)
            {
                // Raise the 'SelectionStateSelected' event.
                if (SelectionStateSelected != null)
                {
                    SelectionStateSelected(this, new EventArgs());
                }
            }

            if (SelectionState == vxEnumSelectionState.Hover &&
                PreviousSelectionState == vxEnumSelectionState.Unseleced)
            {
                // Raise the 'SelectionStateHovered' event.
                if (SelectionStateHovered != null)
                {
                    SelectionStateHovered(this, new EventArgs());
                }
            }

            if (PreviousSelectionState == vxEnumSelectionState.Hover &&
                SelectionState == vxEnumSelectionState.Unseleced)
            {
                // Raise the 'SelectionStateUnSelected' event.
                if (SelectionStateUnSelected != null)
                {
                    SelectionStateUnSelected(this, new EventArgs());
                }
            }

            PreviousSelectionState = SelectionState;

            base.Update(gameTime);
        }