private void LeftMouseClick() { if (player.hud.MouseInBounds()) { GameObject hitObject = FindHitObject(); Vector3 hitPoint = FindHitPoint(); if (hitObject && hitPoint != ResourceManager.InvalidPosition) { if (player.SelectedObject) { player.SelectedObject.MouseClick(hitObject, hitPoint, player); } else if (hitObject.name != "Ground") { SuperObject superObject = hitObject.transform.parent.GetComponent <SuperObject>(); if (superObject) { //we already know the player has no selected object player.SelectedObject = superObject; superObject.SetSelection(true, player.hud.GetPlayingArea()); } } } } }
private void ChangeSelection(SuperObject worldObject, Player controller) { //this should be called by the following line, but there is an outside chance it will not SetSelection(false, playingArea); if (controller.SelectedObject) { controller.SelectedObject.SetSelection(false, playingArea); } controller.SelectedObject = worldObject; worldObject.SetSelection(true, controller.hud.GetPlayingArea()); }