void Awake() { enemy_animation_controller = GetComponent <EnemyAnimationController>(); nav_mesh_agent = GetComponent <NavMeshAgent>(); enemy_target = GameObject.FindWithTag("Player").transform; // enemy_Audio = GetComponentInChildren<EnemyAudio>(); }
private void Awake() { chasingState = new ChasingState(this); idleState = new EnemyIdleState(this); returningState = new ReturningState(this); attackingState = new AttackingState(this); visiblePlayers = new List <GameObject>(); returnPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z); eyes = transform.FindChild("Eyes"); health = GetComponent <EnemyHealth>(); attack = GetComponent <EnemyAttack>(); sounds = GetComponent <EnemySoundController>(); animator = GetComponent <EnemyAnimationController>(); navMeshAgent = GetComponent <NavMeshAgent>(); isTargetting = false; if (transform.parent.CompareTag("EnemyMob")) { mobKnowledge = GetComponentInParent <EnemyMobKnowledge>(); } tm = GameObject.FindWithTag("TeamManager").GetComponent <TeamManager>(); }
private void Awake() { canvas = GameObject.FindGameObjectWithTag("GameUICanvas").GetComponent <RectTransform>(); bossAttack = GetComponent <BossAttack>(); enemyHealthUITrans = enemyHealthUIObj.GetComponent <RectTransform>(); enemyHealthUI = enemyHealthUIObj.GetComponent <Slider>(); enemyAnimCtrl = GetComponent <EnemyAnimationController>(); }
void Start() { enemyAnimationController = transform.GetChild(0).GetComponent <EnemyAnimationController>(); // Reference to playerObject can be provided in inspector for testing if (player != null) { currentTarget = player; MoveToInteraction(); } }
public void T02UpdateAnimationController_ReturnsIDLE() { var mock = new EnemyControlMock(null, CharacterControl.AnimationState.FORWARD); var sut = new EnemyAnimationController(mock); sut.UpdateAnimationState(); Assert.AreEqual(CharacterControl.AnimationState.IDLE, sut.animationState); }
public void T03UpdateAnimationController_ReturnsAttack() { var fake = new GameObject("Fake Transform"); var mock = new EnemyControlMock(fake.transform, CharacterControl.AnimationState.ATTACK); var sut = new EnemyAnimationController(mock); sut.UpdateAnimationState(); Assert.AreEqual(CharacterControl.AnimationState.ATTACK, sut.animationState); }
public void T01UpdateAnimationController_ReturnsForwardDirection() { var fake = new GameObject("Fake Transform"); var mock = new EnemyControlMock(fake.transform, CharacterControl.AnimationState.FORWARD); var sut = new EnemyAnimationController(mock); sut.UpdateAnimationState(); Assert.AreEqual(CharacterControl.AnimationState.FORWARD, sut.animationState); }
// Start is called before the first frame update void Start() { agent = GetComponent <NavMeshAgent>(); rb = GetComponent <Rigidbody>(); player = GameObject.FindGameObjectWithTag("Player"); animationController = GetComponent <EnemyAnimationController>(); enemyStats = GetComponent <CharacterStats>(); UpdateHealthSlider(); timeOfLastAttack = 0.1f; }
public void Init(Player _player) { playerAnim = GetComponentInChildren <Animator>(); player = _player; controllerToUse = null; PlayerShotController.OnShot += ShotAnimation; PlayerMovementController.OnMovement += MovementAnimation; player.OnPlayerHit += HitAnimation; ResetAnimator(); }
// Start is called before the first frame update void Start() { agent = GetComponent <NavMeshAgent>(); rb = GetComponent <Rigidbody>(); player = PlayerManager.Instance.gameObject; animationController = GetComponent <EnemyAnimationController>(); enemyStats = GetComponent <EnemyStat>(); enemyStats.InitCharacterStat(); UpdateHealthSlider(); _timeOfLastAttack = 0.1f; }
private void Awake() { thisStatus = GetComponent <EnemyStatus>(); playerDetectCol = GetComponent <CircleCollider2D>(); enemyAnimController = GetComponent <EnemyAnimationController>(); if (mapMaster == null) { mapMaster = GameObject.FindGameObjectWithTag("EnemyColMap").GetComponent <EnemyPathfindManager>(); } if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } }
void Start() { GameObject songObject = this.transform.Find("SongObject").gameObject; AudioSource player = songObject.GetComponent <AudioSource> (); player.Play(); player.loop = true; agent = GetComponent <NavMeshAgent> (); myRigidbody = GetComponent <Rigidbody> (); animationController = GetComponentInChildren <EnemyAnimationController> (); chasing = Chasing.NOTHING; flickerCoroutineRunning = false; m_AudioSource = GetComponent <AudioSource>(); // StartCoroutine (DebugCoroutine ()); }
void Awake() { currentHealth = maxHealth; animator = GetComponent <EnemyAnimationController>(); healthBarCanvas = transform.FindChild("EnemyHealthCanvas").gameObject; healthBar = healthBarCanvas.transform.FindChild("Health").GetComponent <Image>(); healthBar.fillAmount = 1; HideHealthBar(); damageText = healthBarCanvas.transform.FindChild("FloatingDamageText").gameObject; damageTextTrans = damageText.transform; teamManager = GameObject.FindGameObjectWithTag("TeamManager").GetComponent <TeamManager>(); StartCoroutine(ApplyBurnDamage()); }
// NOTE: pass waypoints to each instance for different path support public void Init(Vector2[] levelWaypoints, EnemyData data) { transform.localPosition = new Vector2(levelWaypoints[0].x * LevelController.CellSize, levelWaypoints[0].y * LevelController.CellSize); for (var i = 1; i < levelWaypoints.Length; i++) { Waypoints.Enqueue(new Vector2(levelWaypoints[i].x * LevelController.CellSize, levelWaypoints[i].y * LevelController.CellSize)); } Data = data; HealthAmount = Data.HealthAmount; GameObject Enemy = Instantiate(Resources.Load("Prefabs/Enemy" + Data.Name), this.transform) as GameObject; AnimationController = Enemy.GetComponent <EnemyAnimationController>(); Move(); }
private void Awake() { thisStatus = GetComponent <EnemyStatus1>(); playerDetectCol = GetComponent <CircleCollider2D>(); enemyAnimController = GetComponent <EnemyAnimationController>(); if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } if (bullet == null) { throw new System.Exception("BULLET PREFAB WAS NOT ADDED, CANNOT SHOOT"); } Bullets = GameObject.FindGameObjectWithTag("BulletsParent").GetComponent <Transform>(); }
void Awake() { if (check_zombie) { enemy_animation_controller = GetComponent <EnemyAnimationController>(); nav_mesh_agent = GetComponent <NavMeshAgent>(); enemy_controller = GetComponent <EnemyContoller>(); // get enemy audio enemy_sound = GetComponentInChildren <EnemySound>(); } if (check_player) { weapon_controller = GetComponent <WeaponController>(); player_statistics = GetComponent <PlayerStatistics>(); if (PlayerPrefs.GetFloat("playerhealth") > 0) { health_value = PlayerPrefs.GetFloat("playerhealth"); player_statistics.View_Health_Statistics(health_value); } } }
private void Awake() { bs = GetComponent <BossStatus>(); enemyAnimController = GetComponent <EnemyAnimationController>(); circleCol = GetComponent <CircleCollider2D>(); bs = GetComponent <BossStatus>(); if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } if (bullet == null) { throw new System.Exception("BULLET PREFAB WAS NOT ADDED, CANNOT SHOOT"); } Bullets = GameObject.FindGameObjectWithTag("BulletsParent").GetComponent <Transform>(); screamEnemies = GameObject.FindGameObjectWithTag("ScreamEnemies").GetComponent <Transform>(); spawnPointsParent = GameObject.FindGameObjectWithTag("ScreamEmeniesSpawn").GetComponent <Transform>(); SetSpawnPoints(); }
/// <summary> /// Initialize Script /// </summary> public virtual void Init(EnemyManager _enemyMng) { graphics = GetComponentInChildren <EnemyGraphicController>(); enemyMng = _enemyMng; startPosition = transform.position; startRotation = transform.rotation; ResetLife(); ResetStunHit(); ResetPosition(); SetCanStun(true); // Initialize Enemy State Machine enemySM = GetComponent <EnemySMController>(); if (enemySM != null) { enemySM.Init(this); } toleranceCtrl = GetComponent <EnemyToleranceController>(); if (toleranceCtrl != null) { toleranceCtrl.Init(); } collisionCtrl = GetComponent <EnemyCollisionController>(); if (collisionCtrl != null) { collisionCtrl.Init(); } movementCtrl = GetComponent <EnemyMovementController>(); if (movementCtrl != null) { movementCtrl.Init(collisionCtrl); } animCtrl = GetComponentInChildren <EnemyAnimationController>(); if (animCtrl != null) { animCtrl.Init(this); } commandsSpriteCtrl = GetComponentInChildren <EnemySpriteController>(); if (commandsSpriteCtrl != null) { commandsSpriteCtrl.Init(this); } vfxCtrl = GetComponentInChildren <EnemyVFXController>(); if (vfxCtrl != null) { vfxCtrl.Init(this); } sfxCtrl = GetComponentInChildren <EnemySoundController>(); if (sfxCtrl != null) { sfxCtrl.Setup(this); sfxCtrl.Init(); } viewCtrl = GetComponent <EnemyViewController>(); if (viewCtrl != null) { viewCtrl.Init(); } CalculatePathLenght(); }
// Public Properties // // Private Properties // #endregion #region Unity Methods new private void Start() { base.Start(); animationController = GetComponent <EnemyAnimationController>(); }
private void Awake() { animationController = GetComponent <EnemyAnimationController>(); ragdollController = GetComponent <RagdollController>(); }
public void SetAnimatorController(EnemyAnimationController _controller) { controllerToUse = _controller; moving = false; jumping = false; }