private void Start()
        {
            _shieldHealth = GetComponent <BaddieHealth>();
            anim          = GetComponent <Animator>();
            _autoRespawn  = GetComponent <AutoRespawn>();

            respawnTime = _autoRespawn.AutoRespawnDuration;
        }
Exemple #2
0
 /// <summary>
 /// Grabs components and saves initial position and timer
 /// </summary>
 protected virtual void Initialization()
 {
     // we get the animator
     _animator        = GetComponent <Animator>();
     _collider2D      = GetComponent <Collider2D> ();
     _autoRespawn     = GetComponent <AutoRespawn> ();
     _bounds          = LevelManager.Instance.LevelBounds;
     _initialPosition = this.transform.position;
     _timer           = TimeBeforeFall;
 }
Exemple #3
0
        /// <summary>
        /// Grabs useful components, enables damage and gets the inital color
        /// </summary>
        protected virtual void Initialization()
        {
            _character = GetComponent <Character>();
            if (gameObject.GetComponentNoAlloc <SpriteRenderer>() != null)
            {
                _renderer = GetComponent <SpriteRenderer>();
            }
            if (_character != null)
            {
                if (_character.CharacterModel != null)
                {
                    if (_character.CharacterModel.GetComponentInChildren <Renderer> () != null)
                    {
                        _renderer = _character.CharacterModel.GetComponentInChildren <Renderer> ();
                    }
                }
            }

            // we grab our animator
            if (_character != null)
            {
                if (_character.CharacterAnimator != null)
                {
                    _animator = _character.CharacterAnimator;
                }
                else
                {
                    _animator = GetComponent <Animator>();
                }
            }
            else
            {
                _animator = GetComponent <Animator>();
            }

            if (_animator != null)
            {
                _animator.logWarnings = false;
            }

            _autoRespawn = GetComponent <AutoRespawn> ();
            _controller  = GetComponent <CorgiController>();
            _healthBar   = GetComponent <MMHealthBar>();
            _collider2D  = GetComponent <Collider2D>();

            _initialPosition = transform.position;
            _initialized     = true;
            CurrentHealth    = InitialHealth;
            DamageEnabled();
            UpdateHealthBar(false);
        }
        private void Start()
        {
            b1Health = BuggyOne.GetComponent <BaddieHealth>();
            b2Health = BuggyTwo.GetComponent <BaddieHealth>();
            b3Health = BuggyThree.GetComponent <BaddieHealth>();
            b4Health = BuggyFour.GetComponent <BaddieHealth>();

            b1Respawn = BuggyOne.GetComponent <AutoRespawn>();
            b2Respawn = BuggyTwo.GetComponent <AutoRespawn>();
            b3Respawn = BuggyThree.GetComponent <AutoRespawn>();
            b4Respawn = BuggyFour.GetComponent <AutoRespawn>();

            b1BuggyFly = BuggyOne.GetComponent <AIDecisionBuggyFly>();
            b2BuggyFly = BuggyTwo.GetComponent <AIDecisionBuggyFly>();
            b3BuggyFly = BuggyThree.GetComponent <AIDecisionBuggyFly>();
            b4BuggyFly = BuggyFour.GetComponent <AIDecisionBuggyFly>();
        }