Exemple #1
0
        public void Initialize(List <SpellBehaviour> modifiers, StatsBehaviour stats,
                               Transform transform, IDamagable avoidTarget)
        {
            _transform.position = transform.position;

            _transform.rotation = transform.rotation;

            _transform.rotation *= Quaternion.Euler(0f,
                                                    Random.Range(-_recoil, _recoil), 0f);

            _damage = stats.GetStatValue(StatType.ProjectileDamage);

            _speed = stats.GetStatValue(StatType.ProjectileSpeed);

            _range = stats.GetStatValue(StatType.AttackRange);

            _size = stats.GetStatValue(StatType.ProjectileSize);

            _recoil = stats.GetStatValue(StatType.AttackRecoil);

            _targetToAvoid = avoidTarget;

            _timeToRemove = _range / _speed;

            _modifiers = modifiers;
        }
 private void Start()
 {
     _stats           = GetComponent <StatsBehaviour>();
     _damageHighlight = GetComponent <DamageHighlight>();
     MaxHealth        = _stats.GetStatValue(StatType.Health);
     CurrentHealth    = MaxHealth;
 }
Exemple #3
0
        private void Awake()
        {
            _attackHandler = GetComponent <AttackHandler>();

            _stats = GetComponent <StatsBehaviour>();

            Item.OnPickUp += AddItem;
        }
Exemple #4
0
 private void Awake()
 {
     _rigidbody      = GetComponent <Rigidbody>();
     _statsBehaviour = GetComponent <StatsBehaviour>();
     _player         = FindObjectOfType <Player>().transform;
     _agent          = GetComponent <NavMeshAgent>();
     _stateMachine   = GetComponent <EnemyStateMachine>();
     InitializeStateMachine();
 }
Exemple #5
0
        public override void BeginEffect(Transform target)
        {
            _stats = target.GetComponent <StatsBehaviour>();

            if (_stats)
            {
                _stats.AddStatMod(this);
            }
        }
Exemple #6
0
        private void Awake()
        {
            _mainCamera = Camera.main;

            _input = GetComponent <InputHandler>();

            _characterController = GetComponent <CharacterController>();

            _statsBehaviour = GetComponent <StatsBehaviour>();

            IsControlDisabled = false;

            PlayerHealthBehaviour.OnPlayerDeath += DisableController;
        }
Exemple #7
0
        private void Awake()
        {
            _stats         = GetComponent <StatsBehaviour>();
            _attackInvoker = GetComponent <IAttackHandler>();
            _avoidTarget   = GetComponent <IDamagable>();
            _attackInvoker.OnAttackTrigger      += HandleAttack;
            _attackInvoker.OnAttackCancel       += AttackCancel;
            PlayerHealthBehaviour.OnPlayerDeath += () => _nextAttackTime = float.PositiveInfinity;

            if (!_projectilePool)
            {
                _projectilePool =
                    GameObject.FindGameObjectWithTag("EnemyProjectilesPool").GetComponent <ProjectilePool>();
            }

            foreach (Turret turret in GetComponentsInChildren <Turret>())
            {
                _turrets.Add(turret);
            }
        }
Exemple #8
0
        void Awake()
        {
            _stats = FindObjectOfType <StatsBehaviour>();

            _data.Type = ItemType.Passive;
        }
Exemple #9
0
 public ChaseState(EnemyController monster) : base(monster.gameObject)
 {
     _enemyController = monster;
     _statBehaviour   = _enemyController.GetComponent <StatsBehaviour>();
 }
Exemple #10
0
 public CombatState(EnemyController enemy) : base(enemy.gameObject)
 {
     _enemyController = enemy;
     _statBehaviour   = _enemyController.GetComponent <StatsBehaviour>();
 }