public static void CleanUp() //Resets the FightScene for next time { GameObject smokeCloud = GameObject.Find("SmokeCloud"); smokeCloud.transform.localScale = new Vector3(0.1f, 0.1f, 1); //Resets size of the smoke cloud GameObject p1Side = GameObject.Find("Player1Units"); GameObject p2Side = GameObject.Find("Player2Units"); GameObject winner = GameObject.Find("Winner"); p1Side.GetComponent <RectTransform>().anchoredPosition = p1Start; //Resets the position of P1's units p2Side.GetComponent <RectTransform>().anchoredPosition = p2Start; //Similiar comment for (int i = p1Side.transform.childCount - 1; i >= 0; --i) //Removes pictures { GameObject.Destroy(p1Side.transform.GetChild(i).gameObject); } for (int i = p2Side.transform.childCount - 1; i >= 0; --i) { GameObject.Destroy(p2Side.transform.GetChild(i).gameObject); } for (int i = winner.transform.childCount - 1; i >= 0; --i) { GameObject.Destroy(winner.transform.GetChild(i).gameObject); } UnitDict.Clear(); //Clears dictionary] UIMaster.SetFightScenePanel(false); //Turns off the canvas for the FightScene UIMaster.SetPanelAlpha(false, (int)UIPannels.Fight); }
public static void SetUpFight(List <Unit> f, List <Unit> tk) { fighting = true; //Fighting has begun UnitDict = new Dictionary <Unit, GameObject>(); p1Start = GameObject.Find("Player1Units").GetComponent <RectTransform>().anchoredPosition; p2Start = GameObject.Find("Player2Units").GetComponent <RectTransform>().anchoredPosition; fighters = f; //List of all the units participating in the fight toKill = tk; //Which units we are going to kill UIMaster.SetFightScenePanel(true); //Activates the Canvas for the FightScene UIMaster.SetPanelAlpha(true, (int)UIPannels.Fight); //Turns the alpha to 1 so that it is visible PlaceUnits(); }