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(); }
//initialize void Start() { instance = this; // canSkip = false; uiM = new UIMaster(); sM = new ScoreMaster(); mM = new MapMaster(); pM = new PlayerMaster(); dM = new DeployMaster(); mvM = new MoveMaster(); aM = new AttackMaster(); acceptInput = true; turnNum = 0; CannonMaster.ResetCurrent(); gP = GamePhase.Deploy; ScoreMaster.ResetScore(); mL = new MapLoader(); mL.LoadMapFromTextAsset(((TextAsset)Resources.Load("Maps/" + mapName))); PlayerMaster.SetBackLines(MapMaster.Map); TopDownCamera.ActivateMainCamera(MapMaster.Height, MapMaster.Width, MapMaster.MapRadius); UIMaster.SetGeneralUI(); UIMaster.SetDeployUI(); UIMaster.SetCannonUI(); UIMaster.DisplayScore(); UIMaster.SetPanelAlpha(false, (int)UIPannels.Cannon); UIMaster.SetPanelAlpha(false, (int)UIPannels.Phase); UIMaster.SetPanelAlpha(false, (int)UIPannels.View); UIMaster.SetPanelAlpha(false, (int)UIPannels.Fight); UIMaster.SetActionPanel(true); if (!tutorial) { UIMaster.DisplayState(gP, PlayerMaster.CurrentTurn); } // norton = VS_AI ? new AIBrain() : null; // must be called after UIMaster.SetGeneralUI to percive turns properly }
public static IEnumerator GameOver() // disables input and calles method that fades to black and changes scenes { acceptInput = false; UIMaster.SetPanelAlpha(false, (int)UIPannels.Action); UIMaster.SetPanelAlpha(false, (int)UIPannels.Action); GameObject gg = GameObject.Find("PhasePanel"); if (gg != null) { gg.GetComponent <CanvasGroup>().alpha = 0; } //GameObject.Find("New Canvas").GetComponent<Canvas>().enabled = false; GameObject cam = TopDownCamera.Instance.gameObject; cam.transform.GetChild(0).gameObject.SetActive(true); //There's a black screen attached to the MainCamera that is used for fading SpriteRenderer blackScreen = cam.transform.GetChild(0).GetComponent <SpriteRenderer>(); blackScreen.color = new Color(0, 0, 0, 0); instance.StartCoroutine(EndingGame(blackScreen)); yield return(null); }