A 2D Farming RPG
This is just a simple 2D farming RPG game
Loading...
Searching...
No Matches
GridCursor Class Reference
Inheritance diagram for GridCursor:
Inheritance graph
Collaboration diagram for GridCursor:
Collaboration graph

Public Member Functions

void DisableCursor ()
 Disable the cursor. More...
 
void EnableCursor ()
 Enable the cursor. More...
 
Vector3Int GetGridPositionForCursor ()
 Return the position of the cursor. More...
 
Vector3Int GetGridPositionForPlayer ()
 Return the grid position of the player. More...
 
Vector2 GetRectTransformPositionForCursor (Vector3Int gridPosition)
 Transfor the UI Items on canvas to pixel positions. More...
 

Properties

bool CursorPositionIsValid [get, set]
 
int ItemUseGridRadius [get, set]
 
ItemType SelectedItemType [get, set]
 
bool CursorIsEnabled [get, set]
 

Private Member Functions

void OnDisable ()
 Unsubscribe sceneload More...
 
void OnEnable ()
 Subscribe scene load. More...
 
void Start ()
 Initialize camera and canvas More...
 
void Update ()
 Call display cursor function at every frame. More...
 
Vector3Int DisplayCursor ()
 Display the cursor which marked valid and invalid drop locations. More...
 
void SceneLoaded ()
 Initialize the Grid More...
 
void SetCursorValidity (Vector3Int cursorGridPosition, Vector3Int playerGridPosition)
 Check series of checks to determine validity of the cursor location. Based on the validity set the cursor to be valid or invalid. More...
 
void SetCursorToValid ()
 Set the cursor to valid. More...
 
void SetCursorToInvalid ()
 Set the cursor to invalid. More...
 
bool IsCursorValidForCommodity (GridPropertyDetails gridPropertyDetails)
 Test cursor validity for a commodity for the target gridPropertyDetails. More...
 
bool IsCursorValidForSeed (GridPropertyDetails gridPropertyDetails)
 Test cursor validity for a seed for the target gridPropertyDetails. More...
 

Private Attributes

Canvas m_Canvas
 
Grid m_Grid
 
Camera m_MainCamera
 
Image m_CursorImage = null
 
RectTransform m_CursorRectTransform = null
 
Sprite m_GreenCursorSprite = null
 
Sprite m_RedCursorSprite = null
 
bool m_CursorPositionIsValid = false
 
int m_ItemUseGridRadius = 0
 
ItemType m_SelectedItemType
 
bool m_CursorIsEnabled = false
 

Detailed Description

Definition at line 4 of file GridCursor.cs.

Member Function Documentation

◆ DisableCursor()

void GridCursor.DisableCursor ( )
inline

Disable the cursor.

Definition at line 205 of file GridCursor.cs.

Here is the caller graph for this function:

◆ DisplayCursor()

Vector3Int GridCursor.DisplayCursor ( )
inlineprivate

Display the cursor which marked valid and invalid drop locations.

Returns

Definition at line 65 of file GridCursor.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableCursor()

void GridCursor.EnableCursor ( )
inline

Enable the cursor.

Definition at line 214 of file GridCursor.cs.

Here is the caller graph for this function:

◆ GetGridPositionForCursor()

Vector3Int GridCursor.GetGridPositionForCursor ( )
inline

Return the position of the cursor.

Returns

Definition at line 224 of file GridCursor.cs.

Here is the caller graph for this function:

◆ GetGridPositionForPlayer()

Vector3Int GridCursor.GetGridPositionForPlayer ( )
inline

Return the grid position of the player.

Returns

Definition at line 235 of file GridCursor.cs.

Here is the caller graph for this function:

◆ GetRectTransformPositionForCursor()

Vector2 GridCursor.GetRectTransformPositionForCursor ( Vector3Int  gridPosition)
inline

Transfor the UI Items on canvas to pixel positions.

Returns

Definition at line 244 of file GridCursor.cs.

Here is the caller graph for this function:

◆ IsCursorValidForCommodity()

bool GridCursor.IsCursorValidForCommodity ( GridPropertyDetails  gridPropertyDetails)
inlineprivate

Test cursor validity for a commodity for the target gridPropertyDetails.

Parameters
gridPropertyDetails
Returns
Return true if valid otherwise false.

Definition at line 188 of file GridCursor.cs.

Here is the caller graph for this function:

◆ IsCursorValidForSeed()

bool GridCursor.IsCursorValidForSeed ( GridPropertyDetails  gridPropertyDetails)
inlineprivate

Test cursor validity for a seed for the target gridPropertyDetails.

Returns
Return true if valid otherwise false.

Definition at line 197 of file GridCursor.cs.

Here is the caller graph for this function:

◆ OnDisable()

void GridCursor.OnDisable ( )
inlineprivate

Unsubscribe sceneload

Definition at line 28 of file GridCursor.cs.

Here is the call graph for this function:

◆ OnEnable()

void GridCursor.OnEnable ( )
inlineprivate

Subscribe scene load.

Definition at line 36 of file GridCursor.cs.

Here is the call graph for this function:

◆ SceneLoaded()

void GridCursor.SceneLoaded ( )
inlineprivate

Initialize the Grid

Definition at line 92 of file GridCursor.cs.

Here is the caller graph for this function:

◆ SetCursorToInvalid()

void GridCursor.SetCursorToInvalid ( )
inlineprivate

Set the cursor to invalid.

Definition at line 177 of file GridCursor.cs.

Here is the caller graph for this function:

◆ SetCursorToValid()

void GridCursor.SetCursorToValid ( )
inlineprivate

Set the cursor to valid.

Definition at line 168 of file GridCursor.cs.

Here is the caller graph for this function:

◆ SetCursorValidity()

void GridCursor.SetCursorValidity ( Vector3Int  cursorGridPosition,
Vector3Int  playerGridPosition 
)
inlineprivate

Check series of checks to determine validity of the cursor location. Based on the validity set the cursor to be valid or invalid.

Parameters
cursorGridPosition
playerGridPosition

Definition at line 103 of file GridCursor.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Start()

void GridCursor.Start ( )
inlineprivate

Initialize camera and canvas

Definition at line 44 of file GridCursor.cs.

◆ Update()

void GridCursor.Update ( )
inlineprivate

Call display cursor function at every frame.

Definition at line 53 of file GridCursor.cs.

Here is the call graph for this function:

Field Documentation

◆ m_Canvas

Canvas GridCursor.m_Canvas
private

Definition at line 6 of file GridCursor.cs.

◆ m_CursorImage

Image GridCursor.m_CursorImage = null
private

Definition at line 10 of file GridCursor.cs.

◆ m_CursorIsEnabled

bool GridCursor.m_CursorIsEnabled = false
private

Definition at line 18 of file GridCursor.cs.

◆ m_CursorPositionIsValid

bool GridCursor.m_CursorPositionIsValid = false
private

Definition at line 15 of file GridCursor.cs.

◆ m_CursorRectTransform

RectTransform GridCursor.m_CursorRectTransform = null
private

Definition at line 11 of file GridCursor.cs.

◆ m_GreenCursorSprite

Sprite GridCursor.m_GreenCursorSprite = null
private

Definition at line 12 of file GridCursor.cs.

◆ m_Grid

Grid GridCursor.m_Grid
private

Definition at line 7 of file GridCursor.cs.

◆ m_ItemUseGridRadius

int GridCursor.m_ItemUseGridRadius = 0
private

Definition at line 16 of file GridCursor.cs.

◆ m_MainCamera

Camera GridCursor.m_MainCamera
private

Definition at line 8 of file GridCursor.cs.

◆ m_RedCursorSprite

Sprite GridCursor.m_RedCursorSprite = null
private

Definition at line 13 of file GridCursor.cs.

◆ m_SelectedItemType

ItemType GridCursor.m_SelectedItemType
private

Definition at line 17 of file GridCursor.cs.

Property Documentation

◆ CursorIsEnabled

bool GridCursor.CursorIsEnabled
getset

Definition at line 23 of file GridCursor.cs.

◆ CursorPositionIsValid

bool GridCursor.CursorPositionIsValid
getset

Definition at line 20 of file GridCursor.cs.

◆ ItemUseGridRadius

int GridCursor.ItemUseGridRadius
getset

Definition at line 21 of file GridCursor.cs.

◆ SelectedItemType

ItemType GridCursor.SelectedItemType
getset

Definition at line 22 of file GridCursor.cs.


The documentation for this class was generated from the following file: