/// <summary> /// Clears the warship list. /// </summary> private void ClearWarshipList() { mCurrentSelectedPlayer = null; mSelectedEffect.SetActiveRecursively(false); foreach (PlayerWarship war in mPlayerWarshipList) { GameObject.Destroy(war.playerWarship); // GameObject.Destroy(war.playerHeader.gameObject); } mPlayerWarshipList.Clear(); }
public bool OnFingerDownEvent(int fingerIndex, Vector2 fingerPos) { Ray ray = Globals.Instance.MSceneManager.mMainCamera.ScreenPointToRay(fingerPos); RaycastHit hit; bool t_hited = Physics.Raycast(ray, out hit, Mathf.Infinity, (1 << 14)); //GUIPlayerDock guiDock = Globals.Instance.MGUIManager.GetGUIWindow<GUIPlayerDock>(); if (t_hited) { // search the right ship GameObject go = hit.collider.gameObject.transform.parent.parent.gameObject; foreach (PlayerWarship ship in mPlayerWarshipList) { if (ship.playerWarship == go) { mCurrentSelectedPlayer = ship; // show the operation buttons //guiDock.ButtonsParent.gameObject.SetActiveRecursively(true); // set the selected effect mSelectedEffect.transform.position = go.transform.position; mSelectedEffect.SetActiveRecursively(true); break; } } } else { // hide the operation buttons //guiDock.ButtonsParent.gameObject.SetActiveRecursively(false); // hide the selected effect mSelectedEffect.SetActiveRecursively(false); } return(t_hited); }