protected virtual void InitializeAttackState(Enemy enemy) { if (enemyAttack == null) { enemyAttack = new EnemyAttacking(enemy); } }
private void Awake() { player = FindObjectOfType <PlayerMovement>(); animator = GetComponent <Animator>(); agent = GetComponent <NavMeshAgent>(); enemyAttacking = GetComponent <EnemyAttacking>(); }
void Awake() { game = Game.GetGame(); slimeAudio = GetComponent <AudioSource>(); slimeMovement = GetComponent <SlimeMovement>(); enemyAttacking = GetComponent <EnemyAttacking>(); anim = GetComponent <Animation>(); anim["Damage"].layer = 1; colliders = GetComponents <Collider>(); currentHealth = startingHealth; // set it to a more reasonable value }
void OnCollisionEnter2D(Collision2D playerCol) { print("Inside PlayerCollision enter"); EnemyAttacking EnemyHitting = playerCol.collider.GetComponent <EnemyAttacking>(); if (EnemyHitting) { print("Player Hit"); PlayerHealth -= EnemyHitting.EnemyDamage(); } if (PlayerHealth <= 0) { SceneManager.LoadScene(SceneManager.GetSceneAt(0).name); } }
void Awake() { anim = this.GetComponent <Animator>(); agent = this.GetComponent <NavMeshAgent>(); move = this.GetComponent <EnemyMovementControll>(); capsuleCollider = this.GetComponent <CapsuleCollider>(); m_particleSystem = this.GetComponentInChildren <ParticleSystem>(); enemyAttack = this.GetComponentInChildren <EnemyAttacking>(); gamecontroller = GameObject.FindGameObjectWithTag("GameController"); //healthBarPrefab = myHealthBar = healthBarPrefab; //Instantiate<GameObject>(healthBarPrefab); SliderObject = myHealthBar.GetComponentInChildren <Canvas>(); healthslider = myHealthBar.GetComponentInChildren <Slider>(); myCurHp = maxHp; updateHealthSliderUI(); }
void Awake() { game = Game.GetGame(); player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent <PlayerHealth>(); playerMove = player.GetComponent <PlayerMovement>(); enemyHealth = GetComponent <SlimeHealth>(); enemyAttacking = GetComponent <EnemyAttacking> (); anim = GetComponent <Animation>(); nav = GetComponent <NavMeshAgent>(); SetNavEnabled(false); isStunned = false; }