예제 #1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         RocketScript rocket = collision.gameObject.GetComponent <RocketScript>();
         rocket.SetState(new LanderWaterboom(rocket));
     }
 }
예제 #2
0
    public void GameReset()  //resetuje stan gry
    {
        // reset Landera
        Destroy(rocket);
        rocket       = Instantiate(instrocket);
        rocketScript = rocket.GetComponent <RocketScript>();
        var rand = Random.Range(-2f, 2f);

        rocket.transform.position = new Vector3(rand, 2, 0);
        //ustawienie stanu poczatkowego rakiety
        rocketScript.SetState(new LanderIdle(rocketScript));
        rocketScript.inputEnable = true;
        // zresetowanie pozycji platformy
        rand = Random.Range(-1.5f, 1.5f);
        platform.transform.position = new Vector3(rand, -2.05f, 0);
        //zresetowanie paliwa i monopropylanu
        rocketScript.monoprop = rocketScript.startingmonoprop;
        rocketScript.fuel     = rocketScript.startingfuel;
        //zwiekszenie ilosci podjętych prób
        atempts++;
    }