C# 클래스 MouseWorldPosition, astrochimps

Script to filter all the mouse actions, including moving and clicking the buttons. Right now, we use left click to 'select' units and buildings, and right click to issue 'action' commands
상속: MonoBehaviour
파일 보기 프로젝트 열기: arcoelho01/astrochimps 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
cursorAttack UnityEngine.Texture2D
cursorBuild UnityEngine.Texture2D
cursorCaptureRay UnityEngine.Texture2D
cursorGetInside UnityEngine.Texture2D
cursorGetOut UnityEngine.Texture2D
cursorNormal UnityEngine.Texture2D
cursorObject Transform
cursorRecycleEnable UnityEngine.Texture2D
cursorReprogramEnable UnityEngine.Texture2D
cursorSabotageEnable UnityEngine.Texture2D
cursorWalk UnityEngine.Texture2D
cursorWalkNotOk UnityEngine.Texture2D
gameBarBottom float
gameBarTop float
mouseHitPointNow Vector3
selectedObject Transform
targetPosition Vector3

공개 메소드들

메소드 설명
DeselectedObject ( ) : void

Called from an external script, when a unit is deselected

GetSelectedObject ( ) : Transform

Return the transform of the object currently selected, if any

IWantToSelectAPosition ( ) : void

Executed when a script wants to receive a position when a mouse button is clicked

PositionIsAlreadySelected ( ) : bool

Used after IWantToSelectAPosition by another script, so it will know when something is clicked and a position is selected

RemoveCursor ( ) : void

Removes the cursor projector, destroying its object Used when we have deselected a unit

SelectObject ( Transform targetObject ) : void
WhatIsThePositionSelected ( ) : Vector3

Used in conjuction with IWantToSelectAPosition and PositionIsAlreadySelected. If the position is already select, them polls this script to know what is this position

비공개 메소드들

메소드 설명
Awake ( ) : void
CheckLeftMouseClick ( ) : void

Execute when the player presses the left mouse button Behaviours: select an unit, deselect-it if clicked in the terrain

CheckRightMouseClick ( ) : void

Execute when the player presses the right mouse button Behaviours: when a movable unit is selected, select where it should walk to

DoCheatingStuff ( ) : void

Do some cheats, for development purposes only

GetWhatIClicked ( ) : Transform

When the player presses the mouse button, check whatever is under the mouse cursor through a raycast

MouseOver ( ) : void

Checks the objects under the mouse cursor, showing its info in the info panel Actually, this is the main function of this script: it analyzes the context and set the mouse state and cursor accordingly

OnGUI ( ) : void

For now, the OnGUI only draws the custom mouse cursor

ShowSelectedPositionWithAProjector ( Vector3 position, float timeToShow ) : IEnumerator

When the player select a position to walk to, we show a cursor in the ground for visual aid

Start ( ) : void
Update ( ) : void

메소드 상세

DeselectedObject() 공개 메소드

Called from an external script, when a unit is deselected
public DeselectedObject ( ) : void
리턴 void

GetSelectedObject() 공개 메소드

Return the transform of the object currently selected, if any
public GetSelectedObject ( ) : Transform
리턴 Transform

IWantToSelectAPosition() 공개 메소드

Executed when a script wants to receive a position when a mouse button is clicked
public IWantToSelectAPosition ( ) : void
리턴 void

PositionIsAlreadySelected() 공개 메소드

Used after IWantToSelectAPosition by another script, so it will know when something is clicked and a position is selected
public PositionIsAlreadySelected ( ) : bool
리턴 bool

RemoveCursor() 공개 메소드

Removes the cursor projector, destroying its object Used when we have deselected a unit
public RemoveCursor ( ) : void
리턴 void

SelectObject() 공개 메소드

public SelectObject ( Transform targetObject ) : void
targetObject Transform
리턴 void

WhatIsThePositionSelected() 공개 메소드

Used in conjuction with IWantToSelectAPosition and PositionIsAlreadySelected. If the position is already select, them polls this script to know what is this position
public WhatIsThePositionSelected ( ) : Vector3
리턴 Vector3

프로퍼티 상세

cursorAttack 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorAttack
리턴 UnityEngine.Texture2D

cursorBuild 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorBuild
리턴 UnityEngine.Texture2D

cursorCaptureRay 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorCaptureRay
리턴 UnityEngine.Texture2D

cursorGetInside 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorGetInside
리턴 UnityEngine.Texture2D

cursorGetOut 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorGetOut
리턴 UnityEngine.Texture2D

cursorNormal 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorNormal
리턴 UnityEngine.Texture2D

cursorObject 공개적으로 프로퍼티

public Transform cursorObject
리턴 Transform

cursorRecycleEnable 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorRecycleEnable
리턴 UnityEngine.Texture2D

cursorReprogramEnable 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorReprogramEnable
리턴 UnityEngine.Texture2D

cursorSabotageEnable 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorSabotageEnable
리턴 UnityEngine.Texture2D

cursorWalk 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorWalk
리턴 UnityEngine.Texture2D

cursorWalkNotOk 공개적으로 프로퍼티

public Texture2D,UnityEngine cursorWalkNotOk
리턴 UnityEngine.Texture2D

gameBarBottom 공개적으로 프로퍼티

public float gameBarBottom
리턴 float

gameBarTop 공개적으로 프로퍼티

public float gameBarTop
리턴 float

mouseHitPointNow 공개적으로 정적으로 프로퍼티

public static Vector3 mouseHitPointNow
리턴 Vector3

selectedObject 공개적으로 프로퍼티

public Transform selectedObject
리턴 Transform

targetPosition 공개적으로 정적으로 프로퍼티

public static Vector3 targetPosition
리턴 Vector3