void Start() { // Setting up the references. ai = GetComponent <EnemyAI2>(); anim = GetComponent <Animator>(); //enemyAudio = GetComponent<AudioSource>(); //hitParticles = GetComponentInChildren<ParticleSystem>(); circleCollider = GetComponent <CircleCollider2D>(); loot = GetComponent <LootDrops>(); // Setting the current health when the enemy first spawns. currentHealth = startingHealth; previousHealth = startingHealth; healthbar.SetActive(false); rez = GetComponent <Resurrectable>(); spriteRend = GetComponent <SpriteRenderer>(); if (isStunnable) { stunnable = GetComponent <Stunnable>(); } var prefabs = GameObject.FindGameObjectWithTag("Load").GetComponent <LoadedPrefabs>().prefabs; foreach (var prefab1 in prefabs) { if (prefab1.name == "CritAnim") { critPrefab = prefab1; break; } } CheckOnFire(); CheckFrozen(); }
void OnTriggerEnter2D(Collider2D other) { if (!playerMissing) { EnemyAI2 script = other.GetComponent <EnemyAI2>(); if (other.gameObject.name == "Player") { DestroyProjectile(); other.GetComponent <PlayerHealth>().DamagePlayer(damage); } else if (script == null) { DestroyProjectile(); if (other.GetComponent <EnemyHealth>()) { other.GetComponent <EnemyHealth>().DamageEnemy(damage); } } else if (other.gameObject.name == "Swing_Effect") { DestroyProjectile(); } } }
// Start is called before the first frame update void Start() { ai = GetComponentInParent <EnemyAI2>(); cc = GetComponent <CircleCollider2D>(); player = GameObject.FindGameObjectWithTag("Player"); ph = player.GetComponent <PlayerHealth>(); }
// Start is called before the first frame update void Awake() { ai = GetComponent <EnemyAI2>(); sw = GetComponentInChildren <SM_ElectroWaveAttack>(); anim = GetComponent <Animator>(); rezAb = GetComponent <ResurrectAbility>(); }
public void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Obstacle" || other.tag == "NPC") { OGController.currentCrystals = maxCrystals; OGController.finalCrystal = gameObject; StartCoroutine(EndChain()); return; //end the chain upon impact with an obstacle } if (cc.isTrigger == true && other.tag == "Enemy") { float critChance = Random.Range(0f, 1f); Debug.Log(critChance); bool criticalHit; if (critChance <= stats.criticalChance) { criticalHit = true; } else { criticalHit = false; } var calculatedDamage = baseDamage / 100f * stats.iceDamage; Debug.Log(calculatedDamage); int damage = player.GetComponentInChildren <IceBarrier>().baseDamage; damage = Mathf.RoundToInt(calculatedDamage); Debug.Log(gameObject.name + " sending " + damage + " damage."); EnemyHealth enemy = other.GetComponent <EnemyHealth>(); enemy.TakeDamage(damage, damageType, criticalHit, enemy.transform.position + new Vector3(0f, 0.4f, 0f)); EnemyAI2 ai = other.GetComponent <EnemyAI2>(); ai.Knockback((Vector2)gameObject.transform.position); } }
// Start is called before the first frame update void Start() { ai = GetComponent <EnemyAI2>(); player = GameObject.FindGameObjectWithTag("Player"); ph = player.GetComponent <PlayerHealth>(); ps = GetComponentInChildren <ParticleSystem>(); pm = player.GetComponent <PlayerMovement>(); rb = GetComponent <Rigidbody2D>(); }
// Use this for initialization void Start() { _animator = GetComponent <Animator>(); _navMeshAgent = GetComponent <NavMeshAgent>(); enemyai = GetComponent <EnemyAI2>(); enemy = GetComponent <NPC>(); //for fluidity _navMeshAgent.stoppingDistance = 0.3f; }
private void Start() { //player = GameObject.FindGameObjectWithTag("Player"); lootTable = GameObject.FindGameObjectWithTag("GameController").GetComponent <LootTable>(); if (gameObject.GetComponent <EnemyAI2>() != null) { fromEnemy = true; ai = gameObject.GetComponent <EnemyAI2>(); } }
void Start() { ps = GetComponent <ParticleSystem>(); anim = GetComponent <Animator>(); eh = GetComponentInParent <EnemyHealth>(); stunnable = GetComponentInParent <Stunnable>(); ai = GetComponentInParent <EnemyAI2>(); StartCoroutine(StunRune()); }
/** * Collider for laser prefab. * Upon contact with enemy, destroys itself with an explosion. */ private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Enemy") { EnemyAI enemy1 = other.GetComponent <EnemyAI>(); EnemyAI2 enemy2 = other.GetComponent <EnemyAI2>(); BossAI boss1 = other.GetComponent <BossAI>(); if (enemy1 != null || enemy2 != null || boss1 != null) { StartCoroutine(ExplosionRoutine()); } } }
void Update() { enemy = GetComponent<EnemyAI2> (); if (oldmode != enemy.patrolmode) // if there is a change in mode { // swap bodies temp = current; Destroy (current); currPos = gameObject.transform.position; // get position and rotation of currQuart = gameObject.transform.rotation; // sphere if (enemy.patrolmode == false) // if in chase mode or running away { current = GameObject.Instantiate (ghostChase, currPos, currQuart) as GameObject; } else { // else if in patrol mode current = GameObject.Instantiate (ghostNormal, currPos, currQuart) as GameObject; } current.transform.parent = gameObject.transform; // Set ghostHead as ghostBody's parent current.AddComponent ("ClothMovement"); // Add ClothMovement script to ghost's body current.AddComponent("ColorTest"); oldmode = enemy.patrolmode; } }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); ai = GetComponent <EnemyAI2>(); }
void Start() { stats = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStats>(); eh = GetComponent <EnemyHealth>(); ai = GetComponent <EnemyAI2>(); }
void Start() { cc = GetComponent <CircleCollider2D>(); ai = GetComponentInParent <EnemyAI2>(); gs = GetComponentInParent <GoblinSpearman>(); }
void Start() { bc = GetComponent <BoxCollider2D>(); ai = GetComponentInParent <EnemyAI2>(); parent = ai.gameObject; }
// Start is called before the first frame update void Start() { ai = GetComponent <EnemyAI2>(); InvokeRepeating("CheckResurrection", 0f, 20f); }
void Start() { ai = GetComponentInParent <EnemyAI2>(); cc = GetComponent <CircleCollider2D>(); }
void Start() { ai = GetComponent <EnemyAI2>(); eh = GetComponent <EnemyHealth>(); circleCollider = GetComponent <CircleCollider2D>(); }
// Start is called before the first frame update void Start() { ai = GetComponent <EnemyAI2>(); dt = ai.dt; }
// Start is called before the first frame update void Start() { ai = GetComponent <EnemyAI2>(); }