// Start is called before the first frame update void Start() { Apple1 myApple = new Apple1(); //The apple version of the methods override the fruit versions. // Since the apple versions call the fruit version with the 'base' keyword, both are called myApple.SayHello(); myApple.Chop(); //since the methods of the fruit class are virtual and the methods of the apple class are override //when we upcast an apple into a fruit, the apple version of the methods are used Fruit1 myFruit = new Apple1(); myFruit.SayHello(); myFruit.Chop(); }
void Start() { Timer = SpawnTimer; //disables all menus needed not needed at start ExitMenu.enabled = false; MainGUI.enabled = false; InGameExitMenu.enabled = false; GameOverGUI.enabled = false; DirectionsGUI.enabled = false; //disables all objects not needed at start Player.SetActive(false); Apple1.SetActive(false); Apple2.SetActive(false); Apple3.SetActive(false); QuitYes.SetActive(false); //sets game score to 0 GameScore = 0; // recalls high score info for display at start screen HighScore1.text = "HighScore: " + PlayerPrefs.GetString("HighScoreName").ToString() + " - " + ((int)PlayerPrefs.GetFloat("HighScore")).ToString(); }
/// <summary> /// Apple1: /// http://myapplecomputer.net/Apple-1/Apple-1_Specs.html /// http://www.applefritter.com/book/export/html/22 /// /// PET: /// source of ROMs: /// http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/ /// /// EHBASIC 6502 - simple basic interpreter /// http://codegolf.stackexchange.com/questions/12844/emulate-a-mos-6502-cpu /// </summary> static void Emulator(string sSystem) { ISystemBase system = null; switch (sSystem) { case "APPLE1": system = new Apple1(); break; case "CBM2001N_B1": system = new CBM2001N_B1(); break; case "CBM2001N": case "CBM2001N_B2": system = new CBM2001N_B2(); break; case "EHBASIC": system = new EHBASIC6502(); break; case "TRS80M1": system = new TRS80M1(); break; case "ZX80": system = new ZX80(); break; case "SIMPLEZ80": system = new SimpleZ80(); break; default: throw new ApplicationException("Emulator not implemented:" + sSystem); } EmulatorScreen screen = new EmulatorScreen(system); }
public void StartGame() { // resets till death count just in case TillDeath = 3; // calls player high score from previous game to be displayed on player gui HighScore.text = "HighScore: " + PlayerPrefs.GetString("HighScoreName").ToString() + " - " + ((int)PlayerPrefs.GetFloat("HighScore")).ToString(); // start game bool toggle GameStart = !GameStart; //Makes the start menu go away StartGUI.enabled = false; MainGUI.enabled = true; //locks the cursor to the game window...or supposed to...havent tested this as i have not tried a build yet. Cursor.lockState = CursorLockMode.Confined; //hides the cursor so we dont have to look at its ugly self :-) Cursor.visible = false; // enables the player and his/her/it's lives Player.SetActive(true); Apple1.SetActive(true); Apple2.SetActive(true); Apple3.SetActive(true); }
void Start() { //Notice here how the variable "myFruit" is of type //Fruit but is being assigned a reference to an Apple. This //works because of Polymorphism. Since an Apple is a Fruit, //this works just fine. While the Apple reference is stored //in a Fruit variable; it can only be used like a Fruit Fruit1 myFruit = new Apple1 (); myFruit.SayHello (); myFruit.Chop (); //This is called downcasting. The variable "myFruit" which is //of type Fruit, actually contains a reference to an Apple. Therefore, //it can safely be turned back into an Apple variable. This allows //it to be used like an Apple, wher before it could only used //like a Fruit. Apple1 myApple = (Apple1)myFruit; myApple.SayHello (); myApple.Chop (); }