Exemplo n.º 1
0
    public void Play(Text textModify)
    {
        if (!isPlaying)
        {
            //instantiate character and disable editor camera, also reduce panel item if we didnt already check the bouton Play to Stop
            if (GridMapper.SpawnPosition != null)
            {
                GridMapper.SpawnPlayer();

                if (MainCam.orthographic)
                {
                    ChangeCameraMode();
                }
                if (gridEnabled)
                {
                    DisEnableGrid();
                }
                if (!reductedPanelItem)
                {
                    ReductPanelItem();
                }
                isPlaying       = true;
                textModify.text = "Stop";
            }
        }

        else
        {
            //destroy the character, enable editor camera and un reduce panel item if we didnt already check the bouton Stop to Play
            GridMapper.DeletePlayer();

            if (!gridEnabled)
            {
                DisEnableGrid();
            }
            if (reductedPanelItem)
            {
                ReductPanelItem();
            }
            isPlaying       = false;
            textModify.text = "Play";
        }
    }