void Start() { gameObject.AddComponent <EnemyAudio>(); gameObject.AddComponent <CapsuleCollider>(); gameObject.AddComponent <AudioSource>(); gameObject.AddComponent <NavMeshAgent>(); player = GameObject.Find("Player"); animator = GetComponent <Animator>(); navMeshAgent = GetComponent <NavMeshAgent>(); capsuleCollider = GetComponent <CapsuleCollider>(); enemyAudio = GetComponent <EnemyAudio>(); gameObject.tag = "enemy"; animator.runtimeAnimatorController = RuntimeAnimatorController.Instantiate( Resources.Load("Animations/Attack") ) as RuntimeAnimatorController; navMeshAgent.speed = 1; capsuleCollider.radius = 0.4f; capsuleCollider.height = 2f; capsuleCollider.center = new Vector3(0, 0.7f, 0); if (player == null) { Debug.LogError("Player Object must be named \"Player\"."); } }
void Start() { if (!m_Animator) { Debug.LogError("No Animator script has been assigned to " + gameObject.name); } if (!m_BasicEnemy) { Debug.LogError("No Basic Enemy script has been assigned to " + gameObject.name); } if (!m_EnemyPlayerDetection) { Debug.LogError("No Enemy Player Detection script has been assigned to " + gameObject.name); } if (!m_FloorCheckCollider) { Debug.LogError("No Floor Check Collider2D has been assigned to " + gameObject.name); } if (!m_WallCheckCollider) { Debug.LogError("No Wall Check Collider2D has been assigned to " + gameObject.name); } m_EnemyAudio = m_BasicEnemy.GetComponent <EnemyAudio>(); m_Action = Actions.EnemyPatrol; }
void Awake() { enemyAnim = GetComponent <EnemyAnimator>(); navAgent = GetComponent <NavMeshAgent>(); target = GameObject.FindWithTag(Tags.PLAYER_TAG).transform; enemyAudio = GetComponentInChildren <EnemyAudio>(); }
public void ApplyDamage(float damage) { if (is_Dead) { return; } health -= damage; if (is_Player) { //show stats Health UI player_Stats.Display_HealthStats(health); } if (is_Boar || is_Cannibal) { if (enemy_Controller.Enemy_State == EnemyState.PATROL) { enemy_Controller.chase_Distance = 50f; enemyAudio = GetComponentInChildren <EnemyAudio>(); } } if (health <= 0f) { PlayerDied(); is_Dead = true; } }
// Start is called before the first frame update void Start() { Health = maxHealth; sprite = GetComponent <SpriteRenderer>(); audioplayer = GetComponent <EnemyAudio>(); Debug.Log("born"); }
void Awake() { enemyAnimator = GetComponent <EnemyAnimator>(); enemyController = GetComponent <EnemyController>(); navMeshAgent = GetComponent <NavMeshAgent>(); enemyAudio = GetComponentInChildren <EnemyAudio>(); }
void Awake() { //if it is a boss then increase the health of boss accoring to its level if (is_Boss) { health = 100 + bossLevel * 100; } //if it is a boss or a cannibal, get the components if (is_Boar || is_Cannibal) { enemy_Anim = GetComponent <EnemyAnimator>(); enemy_Controller = GetComponent <EnemyController>(); navAgent = GetComponent <NavMeshAgent>(); // get enemy audio enemyAudio = GetComponentInChildren <EnemyAudio>(); } //if it is a player the get the player stats component if (is_Player) { player_Stats = GetComponent <PlayerStats>(); } }
void Start() { player = GameObject.Find("Player"); self = gameObject; if (player == null) { Debug.LogError("Player Object must be named \"Player\"."); } self.AddComponent <EnemyAudio>(); self.AddComponent <CapsuleCollider>(); self.AddComponent <AudioSource>(); self.AddComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); navMeshAgent = GetComponent <NavMeshAgent>(); capsuleCollider = GetComponent <CapsuleCollider>(); enemyAudio = GetComponent <EnemyAudio>(); self.tag = "enemy"; animator.runtimeAnimatorController = RuntimeAnimatorController.Instantiate( Resources.Load("Animations/Attack") ) as RuntimeAnimatorController; navMeshAgent.speed = 1; capsuleCollider.isTrigger = false; capsuleCollider.radius = 0.8f; }
void Start() { GetComponent <SphereCollider>().radius = range; nav = transform.parent.GetComponent <UnityEngine.AI.NavMeshAgent>(); anim = transform.parent.GetComponent <Animator>(); audioControl = transform.parent.GetComponent <EnemyAudio>(); }
void Start() { //wave = GameObject.Find("GameMode").GetComponent<WaveManager>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCharacter>(); GetEnemyType(); GetAnimation(this.gameObject.tag); enemyAnimator = GetComponent <Animator>(); enemyAudio = GetComponent <EnemyAudio>(); EnemyManager.Instance.enemyList.Add(this.gameObject); EnemyManager.Instance.enemyPos.Add(this.gameObject.transform.position); deathParticle = transform.Find("Death_Particle").GetComponent <ParticleSystem>(); bloodParticle = transform.Find("BloodParticle").GetComponent <ParticleSystem>(); soulsParticle = Resources.Load <Transform>("Prefabs/SoulsTrailer"); soulsClone = Instantiate(soulsParticle, this.transform.Find("SoulsBirthPlace")); soulsClone.gameObject.AddComponent <ParticleMove>(); soulsClone.gameObject.SetActive(false); soulsParent = GameObject.Find("ParticleParent").GetComponent <Transform>(); attackList.Add(attack01); attackList.Add(attack02); attackList.Add(attack03); }
private void Awake() { em = GetComponent <EnemyMovement>(); sr = GetComponent <SpriteRenderer>(); eAnim = GetComponent <EnemyAnimation>(); mm = GameObject.FindGameObjectWithTag("gameManager").GetComponent <MapManager>(); eAud = GameObject.FindGameObjectWithTag("EnemyAudio").GetComponent <EnemyAudio>(); }
public float waitBeforeAttack = 1.5f; //Time between attacks void Awake() { anim = GetComponent <EnemyAnimator>(); navAgent = GetComponent <NavMeshAgent>(); enemyAudio = GetComponentInChildren <EnemyAudio>(); target = GameObject.FindWithTag("Player").transform; }
void Awake() { if (is_Wolf) { enemy_Anim = GetComponent <EnemyAnimator>(); enemy_Contrller = GetComponent <EnemyController>(); navAgent = GetComponent <NavMeshAgent>(); enemyAudio = GetComponentInChildren <EnemyAudio>(); } if (is_Player) { //TODO have some form of player stats } }
void Awake() { if (isBoar || isCannibal) { _enemyAnim = GetComponent <EnemyAnimator>(); _enemyController = GetComponent <EnemyController>(); _navAgent = GetComponent <NavMeshAgent>(); _enemyAudio = GetComponentInChildren <EnemyAudio>(); } if (isPlayer) { playerStats = GetComponent <PlayerStats>(); } }
void Awake() { if (is_Zombie) { enemy_Anim = GetComponent <EnemyAnimator>(); enemy_Controller = GetComponent <EnemyController>(); navAgent = GetComponent <NavMeshAgent>(); enemyAudio = GetComponentInChildren <EnemyAudio>(); } if (is_Player) { playerStats = GetComponent <PlayerStats>(); } }
void Awake() { if (is_Boar || is_Cannibal) { enemy_Anim = GetComponent <EnemyAnimator>(); enemy_Controller = GetComponent <EnemyController>(); navAgent = GetComponent <NavMeshAgent>(); enemyAudio = GetComponentInChildren <EnemyAudio>(); //get audio } if (is_Player) { playerStats = GetComponent <PlayerStats>(); } }
void Awake() { if (enemyType == EnemyType.NONE) { //If player playerStats = GetComponent <PlayerStats>(); playerAudio = GetComponentInChildren <PlayerAudio>(); playerAnimator = GetComponent <PlayerAnimator>(); } else { //if enemy enemyAnimator = GetComponent <EnemyAnimator>(); enemyController = GetComponent <EnemyController>(); navMeshAgent = GetComponent <NavMeshAgent>(); enemyAudio = GetComponentInChildren <EnemyAudio>(); } }
public bool isPlayer, isBoar, isCannibal; //Identifying GameObjects void Awake() { if (isBoar || isCannibal) { enemyAnim = GetComponent <EnemyAnimator>(); enemyController = GetComponent <EnemyController>(); navAgent = GetComponent <NavMeshAgent>(); //Get enemy audio enemyAudio = GetComponentInChildren <EnemyAudio>(); } if (isPlayer) { //Get player stats/health value playerStats = GetComponent <PlayerStats>(); } }
private void Start() { if (!m_BasicEnemy) { Debug.LogError("No Basic Enemy script attached to " + gameObject.name); } if (m_WaypointA.Equals(m_WaypointB)) { Debug.LogWarning("Both waypoints for " + gameObject.name + " are equal."); } else if (m_WaypointB.x < m_WaypointA.x) { Debug.LogError("Invalid Waypoint positions. Waypoint B cannot be positioned before Waypoint A"); } m_EnemyAudio = m_BasicEnemy.GetComponent <EnemyAudio>(); m_Action = Actions.EnemyMoveAction; }
private void Awake() { moverController = GetComponent <MoverController>(); hitbox = transform.Find("Hitbox").GetComponent <BoxCollider2D>(); poolManager = Toolbox.GetOrAddComponent <PoolManager>(); poolManager.CreatePool(bloodSplatter, 150); damageInfo = new DamageInfo(); damageInfo.damage = 10; fsm = GetComponent <Animator>(); enemy = GetComponent <Enemy>(); enemyAnimator = GetComponent <EnemyAnimator>(); enemyAudio = GetComponent <EnemyAudio>(); frameInfo = new EnemyFrameInfo(); }
void Start() { player = FindObjectOfType <Player>(); enemyAudio = GetComponent <EnemyAudio>(); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { playerPosition = GameObject.FindWithTag("Player").transform; enemyAudio = animator.GetComponent <EnemyAudio>(); audioSource = animator.GetComponent <AudioSource>(); }