47 m_Canvas = GetComponentInParent<Canvas>();
85 return Vector3Int.zero;
94 m_Grid = GameObject.FindObjectOfType<Grid>();
108 if( ( Mathf.Abs( cursorGridPosition.x - playerGridPosition.x ) >
ItemUseGridRadius ) ||
109 ( Mathf.Abs( cursorGridPosition.y - playerGridPosition.y ) >
ItemUseGridRadius ) )
118 if( itemDetails ==
null )
127 if( gridPropertyDetails !=
null )
207 m_CursorImage.color = Color.clear;
216 m_CursorImage.color =
new Color( 1f, 1f, 1f, 1f );
227 Vector3 worldPosition =
m_MainCamera.ScreenToWorldPoint(
new Vector3( Input.mousePosition.x, Input.mousePosition.y, -
m_MainCamera.transform.position.z ) );
228 return m_Grid.WorldToCell( worldPosition );
246 Vector3 gridWorldPosition =
m_Grid.CellToWorld( gridPosition );
247 Vector2 gridScreenPosition =
m_MainCamera.WorldToScreenPoint( gridWorldPosition );
InventoryLocation
Describes the type of inventory and count Ex: player inventory or chest inventory
ItemType
Describe the item type
void OnDisable()
Unsubscribe sceneload
Sprite m_GreenCursorSprite
void Start()
Initialize camera and canvas
bool IsCursorValidForSeed(GridPropertyDetails gridPropertyDetails)
Test cursor validity for a seed for the target gridPropertyDetails.
ItemType m_SelectedItemType
ItemType SelectedItemType
void SetCursorValidity(Vector3Int cursorGridPosition, Vector3Int playerGridPosition)
Check series of checks to determine validity of the cursor location. Based on the validity set the cu...
Vector2 GetRectTransformPositionForCursor(Vector3Int gridPosition)
Transfor the UI Items on canvas to pixel positions.
Vector3Int GetGridPositionForCursor()
Return the position of the cursor.
Vector3Int DisplayCursor()
Display the cursor which marked valid and invalid drop locations.
void SetCursorToValid()
Set the cursor to valid.
void Update()
Call display cursor function at every frame.
void SceneLoaded()
Initialize the Grid
bool m_CursorPositionIsValid
void DisableCursor()
Disable the cursor.
bool IsCursorValidForCommodity(GridPropertyDetails gridPropertyDetails)
Test cursor validity for a commodity for the target gridPropertyDetails.
void SetCursorToInvalid()
Set the cursor to invalid.
void OnEnable()
Subscribe scene load.
void EnableCursor()
Enable the cursor.
RectTransform m_CursorRectTransform
Vector3Int GetGridPositionForPlayer()
Return the grid position of the player.
bool CursorPositionIsValid
This will get the information from serialiable object and populate these class Basically this will st...
This will get the information from serialiable object and populate these class Basically this will st...
This class will manage all the inventory related operations.
This class holds information of items.
This class has all the things related to player