Example #1
0
        private bool SetupAttack()
        {
            if (null != Attacker)
            {
                _entityControllerScript = Attacker.GetComponent <EntityController>();
            }
            if (null != Attacker)
            {
                _fx = Attacker.AddComponent <FX>();
            }
            if (null != _fx)
            {
                FXInfo.CopyTo(_fx);
                _fx.InitFX();
            }
            _healthPanel = GameObject.FindWithTag("HealthGameObject") as GameObject;
            _combatPanel = GameObject.FindWithTag("CombatPanel") as GameObject;
            if (null != _combatPanel)
            {
                _combatPadScript = _combatPanel.GetComponent <CombatPad>();
            }
            _superBar = GameObject.FindWithTag("SuperBar") as GameObject;
            GameObject movementPad = GameObject.FindWithTag("MovementPad") as GameObject;

            if (null != movementPad)
            {
                _keyboardScript = movementPad.GetComponent <Keyboard>();
            }

            if (null == Attacker)
            {
                Debug.LogError("Attack.SetupAttack: Attacker is null.");
            }
            if (null == _entityControllerScript)
            {
                Debug.LogError("Attack.SetupAttack: _entityControllerScript is null.");
            }
            if (null == _healthPanel)
            {
                Debug.LogError("Attack.SetupAttack: _healthPanel is null.");
            }
            if (null == _combatPanel)
            {
                Debug.LogError("Attack.SetupAttack: _combatPanel is null.");
            }
            if (null == _superBar)
            {
                Debug.LogError("Attack.SetupAttack: _superBar is null.");
            }
            if (null == _combatPadScript)
            {
                Debug.LogError("Attack.SetupAttack: _combatPadScript is null.");
            }
            if (null == _keyboardScript)
            {
                Debug.LogError("Attack.SetupAttack: _keyboardScript is null.");
            }

            if (null == Attacker)
            {
                return(false);
            }
            if (null == _healthPanel)
            {
                return(false);
            }
            if (null == _combatPanel)
            {
                return(false);
            }
            if (null == _superBar)
            {
                return(false);
            }
            if (null == _combatPadScript)
            {
                return(false);
            }
            if (null == _keyboardScript)
            {
                return(false);
            }

            _isSetup = true;
            return(true);
        }