/// <summary> /// Initialize Script /// </summary> public void Init(EnemyManager _enemyMng) { soundCtrl = GetComponentInChildren <GeneralSoundController>(); graphics = GetComponentInChildren <EnemyGraphicController>(); collider = GetComponent <Collider>(); enemyMng = _enemyMng; startPosition = transform.position; startRotation = transform.rotation; canShot = true; ResetLife(); ResetStunHit(); ResetPosition(); viewCtrl = GetComponent <EnemyViewController>(); if (viewCtrl != null) { viewCtrl.Init(); } animCtrl = GetComponentInChildren <TurretAnimationController>(); if (animCtrl != null) { animCtrl.Init(this); } behaviourCoroutine = StartCoroutine(NormalBehaviour()); }
public EnemyController(IObjectPooler objectPooler, EnemyViewController enemyViewController) { _enemyPooler = objectPooler; _enemyPooler.NewObjectCreated += SubscribeToNewEnemies; enemyViewController.WaveEnded += ResumeWaveTimer; ReadConfig(); }
/// <summary> /// Function that activate on state enter /// </summary> public override void Enter() { spriteCtrl = context.enemy.GetEnemyCommandsSpriteController(); viewCtrl = context.enemy.GetViewCtrl(); playerParasiteRange = LevelManager.instance.GetPlayer().GetParasiteController().GetRange(); context.enemy.SetCanStun(false); stunDuration = context.enemy.GetStunDuration(); context.enemy.GetVFXController().EnemyStunVFX(true); context.enemy.GetAnimationController().Stun(true); timer = 0; start = true; }
public override void Enter() { enemy = context.enemy; viewCtrl = enemy.GetViewCtrl(); target = viewCtrl.FindPlayer(); if (target == null) { context.EndAlertCallback(); } else { AlertSetup(); } }
/// <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(); }
/// <summary> /// Function that activate on state enter /// </summary> public override void Enter() { enemy = context.enemy; viewCtrl = enemy.GetViewCtrl(); RoamingSetup(); }