예제 #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;
        }
예제 #2
0
 private void Start()
 {
     _stats           = GetComponent <StatsBehaviour>();
     _damageHighlight = GetComponent <DamageHighlight>();
     MaxHealth        = _stats.GetStatValue(StatType.Health);
     CurrentHealth    = MaxHealth;
 }
예제 #3
0
        private void Awake()
        {
            _attackHandler = GetComponent <AttackHandler>();

            _stats = GetComponent <StatsBehaviour>();

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

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

            _input = GetComponent <InputHandler>();

            _characterController = GetComponent <CharacterController>();

            _statsBehaviour = GetComponent <StatsBehaviour>();

            IsControlDisabled = false;

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

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