IEnumerator ShowIndications(string type, string position) { GameObject window = Instantiate(popupWindow, canvas.transform); float x = 150f + Random.Range(0f, Screen.width - 300f); float y = 75f + Random.Range(0f, Screen.height - 150f); window.transform.position = new Vector3(x, y, 0f); string p = ""; switch (position) { case "ColliderAileGauche": shipMapScript.LeftWing(1); p = "left wing"; break; case "ColliderAileDroite": shipMapScript.RightWing(1); p = "right wing"; break; case "ColliderAvant": shipMapScript.Front(1); p = "front"; break; case "ColliderCentre": shipMapScript.Center(1); p = "center"; break; case "ColliderArriere": shipMapScript.Back(1); p = "back"; break; } window.GetComponentInChildren <Text>().text = type + " in the " + p + " !"; // Wait for 5 seconds yield return(new WaitForSeconds(5)); Destroy(window); }
private void AfterAction() { // Action Destroy(_attachedGameobject); _attachedGameobject = null; switch (position) { case "AileGauche": ally.RepairedPart(shipmap.GetLeftWing()); shipmap.LeftWing(-1); break; case "AileDroite": ally.RepairedPart(shipmap.GetRightWing()); shipmap.RightWing(-1); break; case "Avant": ally.RepairedPart(shipmap.GetFront()); shipmap.Front(-1); break; case "Centre": ally.RepairedPart(shipmap.GetCenter()); shipmap.Center(-1); break; case "Arriere": ally.RepairedPart(shipmap.GetBack()); shipmap.Back(-1); break; } // Enable movement _droneBusy = false; playerMovement.canMove = true; mouse.canMove = true; selectTool.canMove = true; textAction.text = ""; }