Beispiel #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;
 }
Beispiel #3
0
        private void Awake()
        {
            _attackHandler = GetComponent <AttackHandler>();

            _stats = GetComponent <StatsBehaviour>();

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

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

            _input = GetComponent <InputHandler>();

            _characterController = GetComponent <CharacterController>();

            _statsBehaviour = GetComponent <StatsBehaviour>();

            IsControlDisabled = false;

            PlayerHealthBehaviour.OnPlayerDeath += DisableController;
        }
Beispiel #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);
            }
        }
Beispiel #8
0
        void Awake()
        {
            _stats = FindObjectOfType <StatsBehaviour>();

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