Third Person Cover Shooter
1.6
|
Walls usable for taking covers have to be marked by cover markers. More...
Public Member Functions | |
bool | IsLeftAdjacent (Cover cover, Vector3 position) |
Is the given cover adjacent to the left at the given position. More... | |
bool | IsRightAdjacent (Cover cover, Vector3 position) |
Is the given cover adjacent to the right at the given position. More... | |
CoverClimb | GetClimbAt (Vector3 position, float radius, float maxClimbHeight, float maxVaultHeight, float maxVaultDistance) |
Returns the type of possible climb at the given position. More... | |
void | RegisterUser (Actor actor, Vector3 position) |
Adds an AI as a user to the cover. More... | |
void | UnregisterUser (Actor actor) |
Removes an AI from the cover users. More... | |
bool | CheckTall (float observer) |
Return whether the cover is considered for an observer with given y coordinate. More... | |
bool | IsInFront (Vector3 observer, bool isOld) |
Returns true if the given position is in front of the cover. More... | |
Vector3 | LeftCorner (float y, float offset=0) |
Returns the position of the left corner with the given height coordinate. More... | |
Vector3 | RightCorner (float y, float offset=0) |
Returns the position of the right corner with the given height coordinate. More... | |
bool | IsByLeftCorner (Vector3 position, float distance) |
Returns true if the given position is within the given distance of the left corner. More... | |
bool | IsByRightCorner (Vector3 position, float distance) |
Returns true if the given position is within the given distance of the right corner. More... | |
int | ClosestCornerToSegment (Vector3 a, Vector3 b, float radius, out Vector3 position) |
Returns the cloest corner to a segment. More... | |
int | ClosestCornerTo (Vector3 point, float radius, out Vector3 position) |
Returns the closest corner useful for aiming. More... | |
Vector3 | ClosestPointTo (Vector3 point, float sideRadius, float frontRadius) |
Returns a position on a cover closest to the given point. More... | |
Vector3 | ClosestPointTo (Vector3 point, float leftSideRadius, float rightSideRadius, float frontRadius) |
Returns a position on a cover closest to the given point. More... | |
bool | IsFrontField (float angle, float field) |
Returns true if a given angle is pointing towards the front of the cover. More... | |
bool | IsFront (float angle, float margin=0) |
Returns true if a given angle is pointing towards the front of the cover. More... | |
bool | IsBack (float angle, float margin=0) |
Returns true if a given angle is pointing backwards from the cover. More... | |
bool | IsLeft (float angle, float margin=0) |
Returns true if a given angle is pointing left of the cover. More... | |
bool | IsLeftField (float angle, float field) |
Returns true if a given angle is pointing left of the cover. More... | |
bool | IsRight (float angle, float margin=0) |
Returns true if a given angle is pointing right of the cover. More... | |
bool | IsRightField (float angle, float field) |
Returns true if a given angle is pointing right of the cover. More... | |
Public Attributes | |
const float | TallThreshold = 1.2f |
Minimal distance from characters feet to the top of a cover for it to be considered tall. More... | |
bool | OpenLeft = true |
Can the character use the left corner of the cover. More... | |
bool | OpenRight = true |
Can the character use the rgiht corner of the cover. More... | |
float | AdjacentDistance = 1 |
Maximum allowed distance to adjacent covers. More... | |
Properties | |
IEnumerable< CoverUser > | Users [get] |
Returns all AI users of the cover. More... | |
float | Top [get] |
Y coordinate of the cover top in world space. More... | |
float | Bottom [get] |
Y coordinate of the cover bottom in world space. More... | |
Vector3 | Forward [get] |
Direction pointing towards the wall. More... | |
Vector3 | Right [get] |
Direction pointing right from a character along the wall. More... | |
Vector3 | Left [get] |
Direction pointing left from a character along the wall. More... | |
float | Angle [get] |
Orientation of the cover in degrees in world space. More... | |
float | Width [get] |
Width of the cover. More... | |
float | Height [get] |
Height of the cover. More... | |
float | Depth [get] |
Depth of the cover. More... | |
Cover | LeftAdjacent [get] |
Cover to the left. More... | |
Cover | RightAdjacent [get] |
Cover to the right. More... | |
bool | IsTall [get] |
Returns whether the cover is considered for an observer standing at the same level as the cover. More... | |
Walls usable for taking covers have to be marked by cover markers.
A cover marker is any gameobject with Cover and Box Collider components attached. Markers can intersect, form a chain which is interpreted as one big cover by character motors. Cover orientation matters, the example scene contains markers with feet that mark facing directions. There are two kinds of covers, low and tall. The kind is determined from the height of a BoxCollider attached to the marker. The height threshold is different for every character and is defined by a Character Motor. The character will correctly change its stance when moving between tall and low covers. A corner of a tall cover with no adjacent tall covers nearby is treated as a corner characters can peek from. However, there can be unmarked walls and therefore character can attempt to take a peek in impossible situations. Such cases are handled by Open Left and Open Right properties inside the Cover component, setting a value to false marks that corner as unusable for peeking. Covers can be climbed or vaulted over. Upon request, character motor will calculate if a climb is possible and perform it at the correct height. If the wall is low and thin enough to be jumped over, the character will perform a vault.
bool CoverShooter.Cover.CheckTall | ( | float | observer | ) |
Return whether the cover is considered for an observer with given y coordinate.
int CoverShooter.Cover.ClosestCornerTo | ( | Vector3 | point, |
float | radius, | ||
out Vector3 | position | ||
) |
Returns the closest corner useful for aiming.
int CoverShooter.Cover.ClosestCornerToSegment | ( | Vector3 | a, |
Vector3 | b, | ||
float | radius, | ||
out Vector3 | position | ||
) |
Returns the cloest corner to a segment.
Vector3 CoverShooter.Cover.ClosestPointTo | ( | Vector3 | point, |
float | sideRadius, | ||
float | frontRadius | ||
) |
Returns a position on a cover closest to the given point.
Vector3 CoverShooter.Cover.ClosestPointTo | ( | Vector3 | point, |
float | leftSideRadius, | ||
float | rightSideRadius, | ||
float | frontRadius | ||
) |
Returns a position on a cover closest to the given point.
CoverClimb CoverShooter.Cover.GetClimbAt | ( | Vector3 | position, |
float | radius, | ||
float | maxClimbHeight, | ||
float | maxVaultHeight, | ||
float | maxVaultDistance | ||
) |
Returns the type of possible climb at the given position.
bool CoverShooter.Cover.IsBack | ( | float | angle, |
float | margin = 0 |
||
) |
Returns true if a given angle is pointing backwards from the cover.
angle | Degrees in world space. |
margin | Reduction in each side of the back arc of the cover. |
bool CoverShooter.Cover.IsByLeftCorner | ( | Vector3 | position, |
float | distance | ||
) |
Returns true if the given position is within the given distance of the left corner.
bool CoverShooter.Cover.IsByRightCorner | ( | Vector3 | position, |
float | distance | ||
) |
Returns true if the given position is within the given distance of the right corner.
bool CoverShooter.Cover.IsFront | ( | float | angle, |
float | margin = 0 |
||
) |
Returns true if a given angle is pointing towards the front of the cover.
angle | Degrees in world space. |
margin | Reduction in each side of the front arc of the cover. |
bool CoverShooter.Cover.IsFrontField | ( | float | angle, |
float | field | ||
) |
Returns true if a given angle is pointing towards the front of the cover.
angle | Degrees in world space. |
field | Field of the front. 180 equals half a circle. |
bool CoverShooter.Cover.IsInFront | ( | Vector3 | observer, |
bool | isOld | ||
) |
Returns true if the given position is in front of the cover.
isOld | Old positions use lesser thresholds. |
bool CoverShooter.Cover.IsLeft | ( | float | angle, |
float | margin = 0 |
||
) |
Returns true if a given angle is pointing left of the cover.
bool CoverShooter.Cover.IsLeftAdjacent | ( | Cover | cover, |
Vector3 | position | ||
) |
Is the given cover adjacent to the left at the given position.
bool CoverShooter.Cover.IsLeftField | ( | float | angle, |
float | field | ||
) |
Returns true if a given angle is pointing left of the cover.
bool CoverShooter.Cover.IsRight | ( | float | angle, |
float | margin = 0 |
||
) |
Returns true if a given angle is pointing right of the cover.
bool CoverShooter.Cover.IsRightAdjacent | ( | Cover | cover, |
Vector3 | position | ||
) |
Is the given cover adjacent to the right at the given position.
bool CoverShooter.Cover.IsRightField | ( | float | angle, |
float | field | ||
) |
Returns true if a given angle is pointing right of the cover.
Vector3 CoverShooter.Cover.LeftCorner | ( | float | y, |
float | offset = 0 |
||
) |
Returns the position of the left corner with the given height coordinate.
void CoverShooter.Cover.RegisterUser | ( | Actor | actor, |
Vector3 | position | ||
) |
Adds an AI as a user to the cover.
Vector3 CoverShooter.Cover.RightCorner | ( | float | y, |
float | offset = 0 |
||
) |
Returns the position of the right corner with the given height coordinate.
void CoverShooter.Cover.UnregisterUser | ( | Actor | actor | ) |
Removes an AI from the cover users.
float CoverShooter.Cover.AdjacentDistance = 1 |
Maximum allowed distance to adjacent covers.
bool CoverShooter.Cover.OpenLeft = true |
Can the character use the left corner of the cover.
bool CoverShooter.Cover.OpenRight = true |
Can the character use the rgiht corner of the cover.
const float CoverShooter.Cover.TallThreshold = 1.2f |
Minimal distance from characters feet to the top of a cover for it to be considered tall.
|
get |
Orientation of the cover in degrees in world space.
|
get |
Y coordinate of the cover bottom in world space.
|
get |
Depth of the cover.
|
get |
Direction pointing towards the wall.
|
get |
Height of the cover.
|
get |
Returns whether the cover is considered for an observer standing at the same level as the cover.
|
get |
Direction pointing left from a character along the wall.
|
get |
Direction pointing right from a character along the wall.
|
get |
Y coordinate of the cover top in world space.
|
get |
Returns all AI users of the cover.
|
get |
Width of the cover.