public static Golem1 GenerateGolem() { var enemy = new Golem1(TextureHelper.Enemy2WalkingTextures, new Pathfinding()); Enemies.Add(enemy); return(enemy); }
// Verifica se um inimigo foi atingido void OnTriggerEnter2D(Collider2D collider) { if (collider.CompareTag("Enemy")) { Character comp = collider.GetComponent <Character> (); if (!comp.damaging) { comp.Damage(transform.position, damage); Destroy(gameObject); } } else if (collider.CompareTag("Rock")) { SoundManager.RockCollision(); Vector3 pos = collider.transform.position; MazeManager.GetTile(pos - new Vector3(0, Tile.size / 2, 0)).obstacle = ""; Destroy(collider.gameObject); OnDestroyRock(pos); Destroy(gameObject); } else if (collider.CompareTag("Golem")) { Character comp = collider.GetComponent <Character> (); if (!comp.damaging) { Golem1 golem1 = collider.GetComponent <Golem1> (); if (comp.lifePoints == 1) { if (golem1 != null) { if (golem1.boss) { golemCount++; //Debug.Log ("killed golem"); //Debug.Log (Time.time); } } } Vector2 moveVector = GameManager.AngleToVector(Player.instance.character.lookingAngle) * speed; comp.Damage((Vector2)transform.position - moveVector * 10, damage); Destroy(gameObject); } } }