An arena 3rd-person shooter based on the "rock-paper-scissors" game.
- Hugo Feliciano - 21805809
- Pedro Fernandes - 21803791
- Rafael Castro e Silva - 21903059
All data regarding variables that will be iterated upon, altered by design or make up important data regarding a game object is placed in a scriptable object, this is to minimize prefab merge conflict fuckery.
The monobehaviour script of a game object should then read from the apropriate Scriptable Object to get its correct data.
Scripts/Scriptables
contains the scripts that define the Scriptable Objects.
Scriptable Objects/
contains the scriptable objects themselves, created by
using the right-click menu of the Assets
window in the editor.
-
Create a Tower
- Create a Tower Piece
- Create Geometry of Tower Piece
- Give the created object Mesh Collider and a Rigidbody components
- Create an empty and position it on the Piece's "center" - if this is a middle piece then it will be the player's spawn location and direction.
- Drag the empty into the "pivot transform" property in the Piece's inspector window.
- Make a Prefab out of this object.
- Create and empty that will hold all 3 pieces, add to it a ArenaTower component
- Add the pieces you want as part of the tower as children of this empty
- Position the pieces however you want vertically.
- Script will align all pieces in the x and z axis so all the pivots form a straight vertical line.
- In the ArenaTower component of the empty add the children as "Top", "Mid", "Bot".
- Create a prefab of this Empty, this is a Tower, put it in a folder with only other Towers, or by itself.
- Create a Tower Piece
-
Arena Setup
- Create a GameObject with a
ArenaGenerator
component. - Select the amount of Towers to be in that Arena.
- (Optional) Add to that GameObject all the Tower prefabs you want in the arena.
- By default it will select all the towers in the Arena Towers Folder.
- (Optional) Define a center Tower that will be put in the center of the Arena no matter what.
- Default is all towers are treated equal.
- Create a GameObject with a
- Arena Generation
- Define a Y value to be the base
- Define a (X,Z) coordinate as the center of the Arena.
- From all the Towers it can use, randomly select the towers up to the previously defined number, these are the chosen Towers
- If a center Tower was defined then immediately chose that one before choosing the others.
- In the chosen towers, access the RigidBody components of each piece and set
mass = 0
and turn off Gravity, restrict all rotation axis and increase the Drag and Angular Drag to at least 1.- In the center tower set
mass = 99
(higher than 0), and turn off Gravity, restrict all rotation axis and increase the Drag and Angular Drag to at least 1.
- In the center tower set
- Spawn the towers randomly in a small area (> 1 unit away) around the defined center, with the pivot points of the middle pieces of every Tower acting as origins for the GameObjects.
- If defined, the center Tower will be spawned dead set in the middle.
- The physics engine will now push every tower away from each other until no geometry overlap
- Additional Setup
- Add a
Box Collider
to every Tower and setIsTrigger = true
, this will be used to define zones for the AI later. - Spawn players in the pivot of the middle piece of a random tower, looking at the center and both equally distant from it.
- Add a
All the instance variables in Behaviour classes whose values are obtained
from Data Scriptable Objects are prefixed with a d
.
So for example, the private instance variable that controls the rate of
fire of a ShooterBehaviour
is called _dFireRate
.