//-------------------------------------------------------------------------------------------- void Start() { mSavedGameManager = GameObject.FindGameObjectWithTag("SaveManager").GetComponent<SavedGameManager>(); //if the current game ptr is somehow bad, return to the main menu if(mSavedGameManager.getCurrentGame() == null) { Debug.Log("CURRENT GAME PTR NULL: RETURNING TO MAIN MENU"); //TODO -- spawn error message, return to main menu } //populate map of level buttons LevelButtonEventHandler[] levelButtons = GetComponentsInChildren<LevelButtonEventHandler>(); foreach(LevelButtonEventHandler handler in levelButtons) { Button button = handler.gameObject.GetComponent<Button>(); if(button != null) { mLevelButtonMap.Add(handler, button); } } //TODO -- init high scores using the game manager and current game ptr //TODO -- enable / disable buttons based on current game ptr level completion //sanity check -- null any selected level data on the current game ptr mSavedGameManager.getCurrentGame().setSelectedLevel(SceneIndex.NULL); mSelectedLevel = SceneIndex.NULL; }
//-------------------------------------------------------------------------------------------- public void handleLevelCompleted(SceneIndex level) { isLevelComplete = true; //get the saved game manager gameManager = GameObject.Find("SavedGameManager").GetComponent<SavedGameManager>(); if(gameManager == null) { return; } //save whether or not the final chassis was used didUseFinalChassis = gameManager.getCurrentGame().getCurrentLoadout().getChasis() == Loadout.LoadoutChasis.FINAL; //save the score, and if there were no hits (if player not hit, bonus added to final score) score = GameObject.Find("Score").GetComponent<Score>(); finalScore = score.wasPlayerHit ? score.trueScore : score.trueScore + (int)PointVals.NO_HITS; //save score and get the old high scores oldPersonalHighScore = gameManager.getCurrentGame().highScores[(int)level - 3]; oldGlobalHighScore = gameManager.globalHighScores[(int)level - 3]; //save game gameManager.handleLevelCompleted(level, finalScore, didUseFinalChassis); //now we can activate the panel and run its animations gameObject.SetActive(true); StartCoroutine(handlePanelAnimations()); //activate the button button.Select(); }
//-------------------------------------------------------------------------------------------- void Start() { mSavedGameManager = SavedGameManager.createOrLoadSavedGameManager(gmPrefab).GetComponent<SavedGameManager>(); //if the current game ptr is somehow bad, return to the main menu if(mSavedGameManager.getCurrentGame() == null) { Debug.Log("ERROR: CURRENT GAME PTR NULL -- LOADING MAIN MENU"); SceneManager.LoadScene((int)SceneIndex.MAIN_MENU); return; } //init the sprite arrays levelTitleSprites = Resources.LoadAll<Sprite>("GUI_Assets/LevelTitles"); levelButtonSprites = Resources.LoadAll<Sprite>("GUI_Assets/LevelButtonIcons"); levelImgSprites = Resources.LoadAll<Sprite>("GUI_Assets/WorldIcons"); stageButtonSprites = Resources.LoadAll<Sprite>("GUI_Assets/StageButtonIcons"); //hide classified levels / worlds setLevelButtonsClassified(); //need to get a handle on the final chassis stars finalChassisStars = mStagePanel.GetComponentsInChildren<FinalChassisStar>(); //tutorial always unlocked, init menu to this lastButtonClicked = mLevelPanel.GetComponentInChildren<Button>(); lastButtonClicked.Select(); handleLevelButtonMouseOver(0); //sanity check -- null any selected level data on the current game ptr mSavedGameManager.getCurrentGame().setSelectedLevel(SceneIndex.NULL); mSelectedLevel = SceneIndex.NULL; StartCoroutine(mScreenFader.FadeFromBlack()); }
//-------------------------------------------------------------------------------------------- void Start() { mSavedGameManager = GameObject.FindGameObjectWithTag("SaveManager").GetComponent<SavedGameManager>(); //if the current game ptr is somehow bad, return to the main menu if(mSavedGameManager.getCurrentGame() == null) { Debug.Log("CURRENT GAME PTR NULL: RETURNING TO MAIN MENU"); //TODO -- spawn error message, return to main menu } //TODO -- enable / disable loadout buttons using current game ptr's avaialble loadouts //sanity check -- null any current loadout data on the current game ptr mSavedGameManager.getCurrentGame().setCurrentLoadout(null); mCurrentLoadout = new Loadout(); }
// //-------------------------------------------------------------------------------------------- void Start() { mSavedGameManager = GameObject.FindGameObjectWithTag("SaveManager").GetComponent<SavedGameManager>(); //TODO -- temp if(mSavedGameManager.getCurrentGame() == null) { mSavedGameManager.createNewGame("test"); } }
//-------------------------------------------------------------------------------------------- void Start() { mSavedGameManager = SavedGameManager.createOrLoadSavedGameManager(gmPrefab).GetComponent<SavedGameManager>(); //if the current game ptr is somehow bad, return to the main menu if(mSavedGameManager.getCurrentGame() == null) { Debug.Log("ERROR: CURRENT GAME PTR NULL -- LOADING MAIN MENU"); SceneManager.LoadScene((int)SceneIndex.MAIN_MENU); return; } //init resource arrays buttonSprites = Resources.LoadAll<Sprite>("GUI_Assets/Menu_Loadouts"); iconSprites = Resources.LoadAll<Sprite>("GUI_Assets/LoadoutIcons_new"); elementStrings = new string[16, 3] //name, description, unlock { {"Exterminator", "Standard issue chassis. Takes 3 hits.", "-"}, {"Final", "Breaks after a single hit, but radiates a mysterious energy...", "Complete Tutorial 3 to unlock!"}, {"Booster", "Slower than the Exterminator, but Precision gives you a speed boost.", "Complete Level 1-1 to unlock!"}, {"Shrink", "Slower than the Exterminator, but your hitbox in Precision is SMALL.", "Complete Level 2-2 to unlock!"}, {"Quick", "Quicker but weaker than the Exterminator. Secondaries recharge faster.", "Complete Level 3-3 to unlock!"}, {"Bug Repellants", "Standard issue anti-bug bullets.", "-"}, {"No-Miss Swatter", "Fire and forget! Automatically attacks the nearest enemy.", "Complete Tutorial 2 to unlock!"}, {"Precision Pesticide", "Laser that sweeps from side to side as you move.", "Complete Level 1-2 to unlock!"}, {"Citronella Flame", "Shoots a short, but powerful cone of fire.", "Complete Level 2-1 to unlock!"}, {"Volt Lantern", "Powerful forward and rear facing lasers.", "Complete Level 3-2 to unlock!"}, {"EMP Counter", "Disrupts enemy firing systems and clears the area of bullets.", "-"}, {"Phasing System", "Renders your ship invulnerable for a short time.", "Complete Tutorial 1 to unlock!"}, {"Holo-Duplicate", "Deploys a hologram of your ship that enemies attack instead.", "Complete Level 1-3 to unlock!"}, {"Mosquito Tesla Coil", "Hold to absorb bullets. Release to send damage back. Does not recharge!", "Complete Level 2-3 to unlock!"}, {"Freeze Ray", "Starts a chain reaction that freezes nearby enemy bullets.", "Complete Level 3-1 to unlock!"}, {"-", "-", "-"} }; //sanity check -- null any current loadout data on the current game ptr mSavedGameManager.getCurrentGame().setCurrentLoadout(null); mCurrentLoadout = new Loadout(); //initialize the default loadout mCurrentLoadout.setChasis(Loadout.LoadoutChasis.EXTERMINATOR); mCurrentLoadout.setPrimary(Loadout.LoadoutPrimary.REPEL); mCurrentLoadout.setSecondary(Loadout.LoadoutSecondary.EMP); //init menu as though chassis button has been clicked chassisButton.Select(); handleChassisButtonClicked(); StartCoroutine(mScreenFader.FadeFromBlack()); StartCoroutine(handleIconAnimation()); }