コード例 #1
0
    private void Start()
    {
        if (ApplicationManager.Instance?.SelectedPlant != null)
        {
            // _plantCharacter.PlantSprite = ApplicationManager.Instance.SelectedPlant.Sprite;
            _plantCharacter.SetPlant(ApplicationManager.Instance.SelectedPlant);
        }

        _growthBar.FillAmount = 0;

        _mainCameraAnimator.Play(CameraAnimatorStartGameState);
        _mainCameraAnimator.speed = 0;

        _gameState = GameState.StartScreen;
        _leftCopyOfPlantCharacter          = Instantiate(_plantCharacter);
        _leftCopyOfPlantCharacter.enabled  = false;
        _rightCopyOfPlantCharacter         = Instantiate(_plantCharacter);
        _rightCopyOfPlantCharacter.enabled = false;
    }
コード例 #2
0
    public void StartGame()
    {
        _gameState = GameState.Game;

        Destroy(_leftCopyOfPlantCharacter.gameObject);
        _leftCopyOfPlantCharacter = null;
        Destroy(_rightCopyOfPlantCharacter.gameObject);
        _rightCopyOfPlantCharacter = null;

        _birdSpawner = Instantiate(_birdSpawnerPrefab, _worldTilter.transform);
        _birdSpawner.transform.localPosition = new Vector3(0, 1.2f, 0);
        _birdSpawner.Target = _plantCharacter.transform;

        _rainCloud = Instantiate(_cloudPrefab, _worldTilter.transform);
        _rainCloud.transform.localPosition = new Vector3(0, 4.5f, 0);
        _rainCloud.gameObject.SetActive(false);

        // plant should start as a small sapling
        _plantCharacter.AnimateGrowthTo(0);

        _setupCoroutine = StartCoroutine(GameSetupCoroutine());
    }