public void TerrainSelectionUpdate(TerrainSelectionUpdateArgs args)
 {
     if (OnTerrainSelectionUpdate != null)
     {
         OnTerrainSelectionUpdate.Invoke(null, args);
     }
 }
示例#2
0
        /// <summary>
        /// The selection on the terrain was updated.
        /// </summary>
        /// <param name="args"></param>
        public void SelectionUpdateTerrain(TerrainSelectionUpdateArgs args)
        {
            _lastTerrainLocation = args;

            foreach (var controller in _currentStateControllers)
            {
                controller.TerrainSelectionUpdate(args);
            }
        }
示例#3
0
 /// <summary>
 /// Event handler for selection updates on the terrain.
 /// </summary>
 /// <param name="sender">not used.</param>
 /// <param name="args">The terrain selection update args.</param>
 private void PlacementUpdate(object sender, TerrainSelectionUpdateArgs args)
 {
     if (args.SelectionLocation != Point3.Null)
     {
         _cursors.Place(args.SelectionLocation);
         _cursors.SetMaterials(GetValidTerrainUnderMouse());
     }
     else
     {
         _cursors.Deactivate();
     }
 }
        /// <summary>
        /// Update the cursor selection.
        /// </summary>
        /// <param name="sender">Not used.</param>
        /// <param name="args">The terrain selection arguments.</param>
        private void SelectionUpdate(object sender, TerrainSelectionUpdateArgs args)
        {
            if (args.SelectionLocation != Point3.Null)
            {
                if (!_cursor.IsActive)
                {
                    _cursor.Activate();
                }

                _cursor.Place(args.SelectionLocation.x, args.SelectionLocation.z);
            }
            else
            {
                if (_cursor.IsActive)
                {
                    _cursor.Deactivate();
                }
            }
        }
示例#5
0
        /// <summary>
        /// Event handler for selection updates on the terrain.
        /// </summary>
        /// <param name="sender">not used.</param>
        /// <param name="args">The terrain selection update args.</param>
        private void PlacementUpdate(object sender, TerrainSelectionUpdateArgs args)
        {
            if (args.SelectionLocation != Point3.Null)
            {
                int lengthX = Math.Abs(_pathStart.x - args.SelectionLocation.x);
                int lengthZ = Math.Abs(_pathStart.z - args.SelectionLocation.z);

                // I'm trying to force people to snap to the grid more often than not
                if (lengthX > lengthZ)
                {
                    _pathEnd = new Point3(args.SelectionLocation.x, args.SelectionLocation.y, _pathStart.z);
                }
                else
                {
                    _pathEnd = new Point3(_pathStart.x, args.SelectionLocation.y, args.SelectionLocation.z);
                }
            }
            else
            {
                // snap to the extreme option if moused out of bounds
                if (_pathEnd.x < _pathStart.x)
                {
                    _pathEnd = new Point3(0, _pathEnd.y, _pathEnd.z);
                }
                else if (_pathEnd.x > _pathStart.x)
                {
                    _pathEnd = new Point3(_terrain.CountX - 1, _pathEnd.y, _pathEnd.z);
                }
                else if (_pathEnd.y < _pathStart.y)
                {
                    _pathEnd = new Point3(_pathEnd.x, _pathEnd.y, 0);
                }
                else if (_pathEnd.y > _pathStart.y)
                {
                    _pathEnd = new Point3(_pathEnd.x, _pathEnd.y, _terrain.CountZ - 1);
                }
            }

            _cursors.Place(_pathStart, _pathEnd, IsValidTerrainAlongLine());
        }
        /// <summary>
        /// Event handler for selection updates on the terrain.
        /// </summary>
        /// <param name="sender">not used.</param>
        /// <param name="args">The terrain selection update args.</param>
        private void PlacementUpdate(object sender, TerrainSelectionUpdateArgs args)
        {
            if (args.SelectionLocation != Point3.Null)
            {
                if (!_cursor.IsActive)
                {
                    _cursor.Activate();
                }

                _cursor.Place(args.SelectionLocation.x, args.SelectionLocation.z);
                _cursor.SetMaterial(
                    IsValidTerrain() ?
                    _validMaterial :
                    _invalidMaterial);
            }
            else
            {
                if (_cursor.IsActive)
                {
                    _cursor.Deactivate();
                }
            }
        }