Destroy() public method

public Destroy ( ) : void
return void
Esempio n. 1
0
    public void StopMiniGame()
    {
        // Останавилваем мини игру
        game.Destroy();
        game = null;

        startScreen.gameObject.SetActive(true);
    }
Esempio n. 2
0
    private void Update()
    {
        AudioSource audio = GetComponent <AudioSource> ();

        switch (state)
        {
        case State.WAITING:
            waitTime += Time.deltaTime;
            if (waitTime > timeToWait)
            {
                state = State.LOADING;
            }
            break;

        case State.LOADING:
            g = GetGame();
            g.StartGame(timeFactor);
            addAudio();
            state = State.RUNNING;
            break;

        case State.RUNNING:
            switch (g.GetState())
            {
            case MiniGame.State.RUNNING:
                break;

            case MiniGame.State.WON:
                score += g.Score;
                gamesCompleted++;
                CalculateTimeFactor();
                g.Destroy();
                g          = null;
                audio.clip = win;
                audio.Play();
                state    = State.WAITING;
                waitTime = 0;
                break;

            case MiniGame.State.LOST:
                life--;
                if (life == 0)
                {
                    GameOver();
                }
                g.Destroy();
                g          = null;
                audio.clip = lose;
                audio.Play();
                state    = State.WAITING;
                waitTime = 0;
                break;
            }
            break;
        }
    }
Esempio n. 3
0
    private void Update()
    {
        AudioSource audio = GetComponent<AudioSource> ();

        switch (state)
        {
        case State.WAITING:
            waitTime += Time.deltaTime;
            if (waitTime > timeToWait)
                state = State.LOADING;
            break;

        case State.LOADING:
            g = GetGame();
            g.StartGame(timeFactor);
            addAudio();
            state = State.RUNNING;
            break;

        case State.RUNNING:
            switch (g.GetState())
            {
            case MiniGame.State.RUNNING:
                break;
            case MiniGame.State.WON:
                score += g.Score;
                gamesCompleted ++;
                CalculateTimeFactor();
                g.Destroy();
                g = null;
                audio.clip = win;
                audio.Play ();
                state = State.WAITING;
                waitTime = 0;
                break;
            case MiniGame.State.LOST:
                life --;
                if (life == 0)
                    GameOver();
                g.Destroy();
                g = null;
                audio.clip = lose;
                audio.Play ();
                state = State.WAITING;
                waitTime = 0;
                break;
            }
            break;
        }
    }