void OnCollisionEnter2D(Collision2D col) { if (col.transform.tag == "Pipe") { Game.isPlaying = false; var pipes = FindObjectsOfType <Pipe>(); for (int i = 0; i < pipes.Length; ++i) { Destroy(pipes[i].gameObject); } ScoreMaster.SaveScore(); ScoreMaster.ResetScore(); } }
//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 }