void Start() { GUIhSize = Screen.height * GUIregion; GUIwSize = Screen.width * GUIregion; recDown = new Rect(0, 0, Screen.width, GUIhSize); recUp = new Rect(0, Screen.height - GUIhSize, Screen.width, GUIhSize); recLeft = new Rect(0, 0, GUIwSize, Screen.height); recRight = new Rect(Screen.width - GUIwSize, 0, GUIwSize, Screen.height); selectionBox = gameObject.GetComponent <CreateSelectionBox>(); }
void Start() { GUIhSize = Screen.height * GUIregion; GUIwSize = Screen.width * GUIregion; recDown = new Rect(0, 0, Screen.width, GUIhSize); recUp = new Rect(0, Screen.height-GUIhSize, Screen.width, GUIhSize); recLeft = new Rect(0, 0, GUIwSize, Screen.height); recRight = new Rect(Screen.width-GUIwSize, 0, GUIwSize, Screen.height); selectionBox = gameObject.GetComponent<CreateSelectionBox>(); }
void Update() { if (Input.GetMouseButton(0) && selectionBox.selecting && renderer.isVisible) { Vector3 camPos = Camera.mainCamera.WorldToScreenPoint(transform.position); camPos.y = CreateSelectionBox.InvertMouseY(camPos.y); selected = CreateSelectionBox.selection.Contains(camPos); } else if (Input.GetMouseButton(0) && selectionBox.selecting && !renderer.isVisible) { selected = false; } if (selected && selectionBox.selecting) { unitManager.SelectAdditionalUnit(gameObject); } else if (selectionBox.selecting) { unitManager.DeselectUnit(gameObject); } }
void Start() { unitManager = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent <UnitManager>(); attackMoveIndicator = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent <AttackMoveIndicatorScript>(); selectionBox = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CreateSelectionBox>(); }
void Start() { unitManager = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent<UnitManager>(); attackMoveIndicator = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent<AttackMoveIndicatorScript>(); selectionBox = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CreateSelectionBox>(); }