Includes:
CamMovementBehavior.cs FormationSwitches.cs GridObjectCreation.cs SelectionBehavior.cs MultiSelectToggle.cs PathFinder.cs ObjectCreationGUIController.cs SelectionToggle.cs UpdatePositionToggle.cs ControlObjHandler.cs NPCHandler.cs CreatureHandler.cs SelectedIndicatorBehavior.cs GridGenerator.cs GridRenderer.cs GridObject.cs ScrollBarEssentials.cs HealthSystem.cs TimerBarSystem.cs WorkerClass.cs SimpleShackHandler.cs
Updates:
[8/19/13] v1.62
-
Made the UpdatePositionToggle class it's own File
-
The GridGenerator now contains a preview feature when selected in scene view
-
Added Function: CalculateParticularPath in PathFinder
-
When accessing the path finder you can now simply just get the desired calculated path
-
When in Observer Creation Mode
-
Worker objects will now move to the location where building
-
It now takes time to build a GridObject
-
When in RTS Mode
-
Control Objects will no longer stack ontop of each other when moving to a location
-
The Control Objects will fill up the adjacent Grid Squares
-
A lot of other minor code fixes
[5/21/13] v1.6
-
Added GridObjectCreation system
-
Contains two different building methods
-
ObjectCreationGUIController
-
Attaches to the Main Camera for allowing variable declarations for the GridObjectCreation system
-
GridObjectCreation Class
-
Handles the Grid Object Creation of GridObject objects
-
This class is also used for handling the options of ControlObjects when in the Observer build method
-
GridObject Class
-
Control Objects that are used for within the Observer method need their own separate class
-
Added TimerBarSystem
-
Utilizes the ScrollBarEssentials class for use of a timed based Game Bar System
-
This is currently used only for the Master build method, however the next update will include timed based building within the Observer method
-
Changed the structure of the scripts folder within the Unity Inspector - More organized
-
Separated a function in GridGenerator for calculating a particular area of the Grid
-
Added a previously selected List return typed function to MultiSelectToggle
-
Added a previously selected Transform return typed function to SelectionBehavior
[3/22/13] v1.52
-
Separated MovementSelectionBehavior.cs into two separate scripts
-
If a GridSquare is now selected for path finding that can't be reached, the closest GridSquare will be chosen instead
-
Added a HealthSystem utilizing my Game Bar Creation System's ScrollBarEssentials class
-
This will display health above the Control Object
-
Added a Indicator Toggle draw calls to draw a selected square object around the Control Objects when selected
-
Fixed a couple bugs with multi selection
-
Added the option to have or not have a mouse cursor texture or mouse scroll direction texture
-
New Options in the Inspector tab for the ControlObjHandler
[2/25/13] v1.51
-
Changed Terrain
-
Added Mouse Scrolling
-
Custom Mouse Cursor
-
Custom Mouse Move Directions
-
Enable Mouse Scroll Field
-
Screen Movement Buffer Field
[2/19/13] v1.5
[1/25/13] v1.4
-
Added a sloped Platform .fbx model, included with a uv texture map
-
Added a GridGenerator
-
The GridGenerator.cs script will generate a grid a long the xz plane with various attributes
-
Includes an Ignore Mask, ignoring particular objects within that Layer; exlusion from raycast
-
Sloped Objects need to be parallel to either the x or z axis for this to work properly
-
Changed camera behavior
-
Made it so the main camera will always rotate around a fixed point
-
updated zooming in and out, which the min and max zoom values can be changed in the Main Camera inspector
-
Added "Ignore Mask" option in the MovementSelectionBehavior.cs script.
-
This tells the camera not to include these objects in a raycast to determine it's rotate point
[12/19/12] v1.311
[5/9/2012] v1.3
-
Added a toggle for choosing either RTS or DungeonCrawler specific
-
Added a multi-selection system for the RTS specific side
-
This comes with the standard drag and drop of a rectangle to select the ControlObjs, you can change the color of it in the main scripts settings. (MultiSelectMaterial)
-
You can also add into the multi-selection by holding down the Left Alt Key by default, this can also be changed.
-
Removed the toggle_light functionality when selecting something, but changed it to a plane with a texture splat onto it called: SelectedIndicator.
-
If you need this again please let me know, or re-add it in yourself by comparing the past version with this version in terms of the toggle_light attached to the prefabs.
[3/30/2012] v1.2
-
Added a Light Toggle for selecting a new move to position
-
Added Rotation of Camera using Q and E
-
Added Snap to Active ControlObject around a Circle when the Follow Toggle key is active
Description:
The purpose of the MovementSelectionBehavior script is to allow the end-user to control a camera object where that user can select controllable objects to interact with. Such that the end-user can also select creature objects and npc objects to interact with the Transform variable: active_object. The main aspect I can't stress enough is that the script arguments of the camera for the values (Control_asset_name, Npc_asset_name, and Creature_asset_name) need to be the name of the prefab within your Hierarchy.
The GridGenerator generates a grid a long the xz plane, it starts at an initial point placed typically inside an empty prefab with the GridGenerator.cs script attached. The GridMaterial attached to the GridGenerator is used for rendering the grid with a particular color (This requires a Mesh Renderer).
The GridGenerator's variables allow you to:
-
set an ignore mask which tells the generator to ignore a particular layer
-
Rows and Columns set the size of the grid
-
Grid Width and Depth set the size of an individual gridsquare
-
Grid Height sets the max height of the generator, this is a very important variable
-
When generating, a ray is cast from this height down sculpting the grid
-
Hollow areas aren't support (YET) such as tunnels, but I've been contemplating that aspect
-
Min Slope and Max Slope Angle sets the range for detecting a sloped path
-
Make sure to set leeway
-
Such as: the provided platform contains a 30 degree slope, but the default generator goes to 35 degrees
-
Grid Quad Size sets the amount of GridGenerator.GridSquare Objects are contained within one GridGenerator.GridSquareQuadrant
-
Rigidity allows for bumpiness of terrain
-
Angular Rigidity allows for bumpiness of sloped terrain
The PathFinder implements the A* Pathfinding system for use mainly with the GridGenerator. The PathFinder can either calculate the Path between two GridGenerator.GridSquare objects or between a Unity3D Transform and it's initial and final GridGenerator.GridSquare.
-
In the default system the calculation occurs in the MovementSelectionBehavior class. When a Control Object is selected and a valid Grid Square is determined with the left mouse button, the path is calculated and the selected object(s) move to the calculated position.
The GridObjectCreation system also utilizes the GridGenerator.GridSquare objects. Which the system is initialized through attaching the ObjectCreationGUIController to the main camera.
The ObjectCreationGUIController variables allow you to:
-
Set the number of Rows and Columns make up the Object Creation system
-
Attach your world's GridGenerator for use of reference
-
Set the icon gfx that make up the Object Creation system
-
The amount of icon gfx that will display is: Rows * Columns
-
By default each frame is 50 x 50 pixels
-
Set the Creation Timer Values amount for how long it takes to build a particular GridObject
-
The size of this should also be: Rows * Columns
-
Set the Creation Object's GridObject prefabs that will be built for each option chosen
-
Size is also: Rows * Columns
-
The layer to ignore when in the process of creating a new GridObject
-
Set the type of Creation Method that is used
-
Master Method - The player (you) is responsible for all object creation
-
Observer Method - The ControlObjHandler WorkerClass is responsible for creating new objects
-
The material that is used for rendering the Grid Squares bellow a GridObject
Controls:
If at anytime you are toggled with a ControlObj and you press a toggle_key (spacebar by default) the camera will begin following that control object. This toggle_key can be edited within the camera object, the CamMovementBehavior script.
MouseDrag/LeftAlt: Adds ControlObj's to the multi-selection
LeftMouseClicks: When a ControlObj is selected will initiate path calculation and movement. This also handles creating new grid objects
RightMouseClicks: When creating a new GridObject this will rotate the object 90 degrees
MouseWheel: Zoom in and Out
Escape: Deselects Active_Object and Selected_Object respectively
WASD: Moves Camera
MouseScroll: When the mouse is at the edges of the screen this will also Move the Camera
QE: Rotate Camera
To install within your own application:
1) Create an empty prefab, place it in an initial location and drag the GridGenerator script onto it.
- Select that empty prefab and Set the Ignore mask and other variables respectively to your desires.
- Make sure to place the prefab close to a proper initial location
- such as close to the terrain, or movement path areas
- Also make sure to set leeway for the Min and Max slope angle, don't choose the exact values you desire but above or bellow them is good
- IMPORTANT: Make sure to set sloped objects parallel to the x or z axis, for now slopes aren't calculated properly a long a fixed rotation. Also note that hollowed objects such as tunnels aren't implemented yet.
2) Drag the CamMovementBehavior script onto your Main Camera object
- Select your Main Camera object then change the attributes associated with this script. Don't forget to drag on your GridGenerator in the Grid Gen location. Also, choose whether RTS Toggle or DC Toggle.
- This also requires an ignore mask for ignoring objects that contain that LayerMask
- The Min, Max zoom distance, move to speed, zoom speed, rotate speed, and follow toggle key can be changed to whatever you wish them to be.
- The multi select material is used for coloring the bounding box when multi selecting when RTS toggle is active
3) Drag the SelectionBehavior script on your Main Camera object
- Drag on your GridGenerator that you are using to the Main Grid Generator option
- Set the Add Additional Key, Mouse cursor, Mouse Hover Cursor, and Mouse Directions to your needs
- By default: the Mouse Cursor and Mouse Hover Cusor are 4 frames each at 64x64 pixels each frame -> total 256x64 pixels
- The Mouse Directions is 8 frames at 32x32 pixels per frame -> 256x32 total
4) Once you have set the assets accordingly to your project's design, drag the ControlObjHandler script to your player object
- Within the scripts object attributes
- This is where you will want to set the name of your player
- Also, this is where you'll want to set the color of the Selected Indicator once the object is selected
- You'll also want to set the values for your health system for your Control Object
- See the ControlObj prefab for reference
5) Repeat step three for your Creature Objects and NPC Objects, but use the CreatureHandler and NPCHandler scripts instead
- You will want to keep the prefab name the same for all of your controllable, creature and npc objects. But you can change the name of the objects to whatever you wish within their individual ObjHandlers
6) If you desire Object Creation drag the ObjectCreationGUIController onto your main camera
- The first thing you will want to do is create a prefab that contains the name "GridObj" in it
- Such as the PlatformSlopedGridObj or SimpleShackGridObj prefabs
- You'll then want to drag onto that prefab the GridObject script
- You will need to give this GirdObject a special Layer
- IgnoreGridCast is what I use, you'll want to use this Layer for all your GridObjects
- This is where you'll want to set the options Rows and Columns as well as the options Texture
- The texture should be made up of Rows * Columns frames at 50 x 50 pixels each frame
- As seen in the SimpleShackGridObj prefab
- From here is where it gets a bit more complicated, depending on what you want your GridObject to do you may need to create a custom script
- You'll want to set it up just like the SimpleShackHandler script, you may or may not need Time Limits or Spawn Objects, but you do need the ActivateOption function
- ActivateOption is the function that activates when you choose it's particular option, such as spawning objects as seen with the Simple Shack
- You'll want to drag this script onto your GridObject
- Back in the ObjectCreationGUIController, you will now want to set the Rows and Columns that make up your system
- These Rows * Columns make up the dimensions for your system, such as how many Grid Object Icons will display, and the Creation Timer Values and Objects
- Now you will need to drag your GridGenerator into the Main Grid Generator location
- Drag on your Grid Object Icons
- These are 50 x 50 pixels each frame where you have Rows * Columns frames
- Set your Creation Timer Values
- Drag on your Creation Objects that contain "GridObj" in there prefab name, as well as it's other scripts
- Both of these last two options Size need to be: Rows * Columns
- Set the Ignore Layer that is used with your GridObject
- Finally set the material that is used for rendering the GridGenerator.GridSquare bellow your object on creation
- This material needs to contain the VertexColorUnlit shader
Please Contact: m11hu.nosp@m.t@gm.nosp@m.ail.c.nosp@m.om if you have any suggestions, bug reports or input.
A Reference To Chase Hutchens would be much appreciated if used in your project(s).
A review rating on the asset store would also be very much appreciated if you can.