// The beginning of the game, should there be no game save. void Start() { // Creates the storage class and starts a new game. storage = new Storage(this); storage.newGame(); // Gets Lark and moves him to his spawn point. lark = storage.getLark(); // Gets Lark's script. larkScript = storage.getLarkScript(); // Gets the pause screen script. pScreen = storage.getPauseScreen(); // Sets storage and handler for Lark. larkScript.setStorageHandler(this, storage); // Same for the character handler. cHandler = (CharacterHandler)GameObject.Find("Characters").GetComponent(typeof(CharacterHandler)); cHandler.setInitialVariables(this, storage); // Same for the portal handler. pHandler = (PortalHandler)GameObject.Find("Portals").GetComponent(typeof(PortalHandler)); pHandler.initialize(this); // Gets the camera for the game. gameCamera = GameObject.Find("Main Camera"); // Instantiates and starts the starting event. StartingEvent sEvent = new StartingEvent(this); currentEvent = sEvent; sEvent.begin(); }
// Gets the game handler, the storage, and lark for child classes. public GameEvent(GameHandler gHandler) { this.gHandler = gHandler; this.lark = gHandler.getLark(); this.storage = gHandler.getStorage(); this.larkScript = storage.getLarkScript(); // Also gets the Mask's script. mask = (Mask)storage.getMask().GetComponent(typeof(Mask)); }
public void initialize(GameHandler gHandler) { this.gHandler = gHandler; this.lark = gHandler.getLark(); this.storage = gHandler.getStorage(); // Gets the game mask. mask = (Mask)GameObject.Find("Mask").GetComponent(typeof(Mask)); // Gets Lark's script. lScript = (Lark)lark.GetComponent(typeof(Lark)); }
public void newGame() { // Gets the spawn point of Lark, and acquires Lark himself. lark = GameObject.Find("Player"); larkScript = (Lark)lark.GetComponent(typeof(Lark)); spawnPoint = GameObject.Find("Story Spawn 1"); respawnX = spawnPoint.transform.position.x; respawnY = spawnPoint.transform.position.y; // Gets the pause screen script. pScreen = (PauseScreen)GameObject.Find("Pause Screen").GetComponent(typeof(PauseScreen)); // Gets the mask that exists in the game. mask = GameObject.Find("Mask"); // Gets the dialogue handler. dHandler = (DialogueHandler)GameObject.Find("Textbox").GetComponent(typeof(DialogueHandler)); // Gets the character handler. cHandler = (CharacterHandler)GameObject.Find("Characters").GetComponent(typeof(CharacterHandler)); // If a new game, sets all stages to zero initially. for (int i = 0; i < 50; i++) { stages [i] = 0; } // DEBUG PURPOSES. items.Add(new Herb()); }