Exemplo n.º 1
0
        private void Awake()
        {
            _plants           = new List <PlantLifecycle>();
            _plantPool        = new ObjectPool(_plantPrefab, _poolSize, transform, GetLifecycleHandle);
            _playingFieldGrid = FindObjectOfType <PlayingFieldGrid>();
            _plantHealthMeter = _plantHealthMeterGameObject.GetComponent <MeterDisplay>();

            FindObjectOfType <GameController>().RegisterScriptToSuspendWhenGameEnds(this);
        }
Exemplo n.º 2
0
        private void Awake()
        {
            _transform   = transform;
            _rigidbody   = GetComponent <Rigidbody>();
            _soundEffect = GetComponent <AudioSource>();
            _grid        = FindObjectOfType <PlayingFieldGrid>();

            GetComponentInChildren <RendererCallback>().VisibleStateChanged += HandleVisibilityStateChange;
            FindObjectOfType <GameController>().RegisterScriptToSuspendWhenGameEnds(this);
        }
Exemplo n.º 3
0
        private void Start()
        {
            PlayingFieldGrid grid = FindObjectOfType <PlayingFieldGrid>();

            PlayerMovement playerMovementScript = transform.Find("Player Character Container").GetComponent <PlayerMovement>();
            ToolCarousel   carouselScript       = transform.Find("Tool Carousel").GetComponent <ToolCarousel>();

            carouselScript.Initialize(grid.GetCarouselPosition(_playsFromLeft), _startingTool, playerMovementScript.transform.parent.name);
            playerMovementScript.InitializePlayer($"P{_playerIndex}", grid.GetPlayerStartPosition(_playsFromLeft), _startingTool, carouselScript);
        }
Exemplo n.º 4
0
        private void Awake()
        {
            _transform        = transform;
            _rigidbody        = GetComponent <Rigidbody>();
            _animator         = GetComponentInChildren <Animator>();
            _exhaledParticles = GetComponentInChildren <ParticleSystem>();
            _soundEffect      = GetComponent <AudioSource>();
            _playingFieldGrid = FindObjectOfType <PlayingFieldGrid>();

            _startingConstraints = _rigidbody.constraints;

            FindObjectOfType <SmogOverlay>().RegisterDensityChangeModifier(this);
            FindObjectOfType <GameController>().RegisterScriptToSuspendWhenGameEnds(this);

            GetComponentInChildren <AnimationEventListener>().NotifyAnimationEvent += HandleAnimationEvent;
        }