// Załadowanie informacji dla danej sceny public void SetPlayer(int _currentLevel) { GameObject.Find("Resolution").transform.localScale = new Vector3(Screen.width / 1920.0f, Screen.height / 1080.0f, 1f); BC = GetComponent <BoxCollider2D>(); manager = GameObject.Find("Manager").GetComponent <Manager>(); camT = GameObject.Find("Main Camera").transform; xSpeed = 0; ySpeed = 0; currentLiane = 0; currentLevel = _currentLevel; if (currentLevel == 1) { liane = lianes[0].GetComponent <Liane>(); } halfWidth = (float)Screen.width / 2f; if (currentLevel >= 2) { movementCircleBack = GameObject.Find("movementCircleBack").transform; movementCircleFront = GameObject.Find("movementCircleFront").transform; if (currentLevel == 2) { manager.sli_air = GameObject.Find("Air").GetComponent <Slider>(); } remainingAir = 10f; } AS.PlayOneShot(audio_roundStart); manager.txt_health.text = manager.health + ""; readyToPlay = true; }
public static void Main() { /* einige Testdaten */ /* some testdata */ Baum b1 = new Baum("Eiche", 2012, 299, 25); Baum b2 = new Baum("Pappel", 2010, 199, 15); Liane l1 = new Liane("Gemeiner Efeu", 1990, 15); Strauch s1 = new Strauch("Stechapfel", 1999, 2.5f, true); Console.WriteLine("Baum: " + b1.getInfo()); Console.WriteLine("Baum: " + b2.getInfo()); Console.WriteLine("Liane: " + l1.getInfo()); Console.WriteLine("Strauch: " + s1.getInfo()); /* Objekt vom Typ Gaertnerei erstellen */ /* create an object from type Gaertnerei */ Gaertnerei gae1 = new Gaertnerei(); /* testen der einkaufen Methode einkaufen */ /* test the einkaufen method */ gae1.einkaufen(b1); gae1.einkaufen(b2); gae1.einkaufen(l1); gae1.einkaufen(s1); /* testen der verkaufen Methode einkaufen */ /* test the verkaufen method */ gae1.verkaufen("Eiche" , 2012); /* testen der getWoodByLimit Methode einkaufen */ /* test the getWoodByLimit method */ List<Gehoelz> tmp; tmp = gae1.getWoodByLimit(199.01f); /* testen ob die Methode die richtigen Werte zurück liefert */ /* test if the returnvalues of the method are right */ Console.WriteLine(); for(int c=0; c<tmp.Count; c++) { Console.WriteLine("[" + c + "] = " + tmp[c].getInfo() ); } /* die Methodeerweiterungen der Klassen Baum und Strauch testen */ /* test of the extension of the classes Baum and Strauch */ Console.WriteLine(); for(int c=0; c<tmp.Count; c++) { Gehoelz objtmp = tmp[c]; if( objtmp is Baum) { Baum baum = (Baum)objtmp; Console.WriteLine("Instanz war vom Typ Baum: Art=" + baum.getArt() + " maximale Höhe=" + baum.getMaxHoehe() ); }else if( objtmp is Liane) { Liane liane = (Liane)objtmp; Console.WriteLine("Instanz war vom Typ Liane : Art=" + liane.getArt() ); }else if( objtmp is Strauch) { Strauch strauch = (Strauch)objtmp; Console.WriteLine("Instanz war vom Typ Strauch : Art=" + strauch.getArt() + " ist Giftig=" + strauch.getIstGiftig() ); } } }
// Gdy postać złapie kolejną liane private void LianeCatched() { AS.PlayOneShot(audio_endJump); manager.score += 100; manager.txt_score.text = manager.score + ""; xSpeed = 0; ySpeed = 0; if (currentLiane + 2 == lianes.Count) { manager.score += 500; manager.txt_score.text = manager.score + ""; manager.ChangeLevel(currentLevel); } else { currentLiane++; liane = lianes[currentLiane].GetComponent <Liane>(); } }