public void StartDestroy() { GameApplication.Instance.GetService <IEnemyService>().PlayerSpotted -= StartChasing; currentEnemyModel = null; currentState = null; currentEnemyView.DestroySelf(); currentEnemyView = null; }
private void CreateEnemy() { EnemyView enemyViewInstance = GameObject.Instantiate <EnemyView>(enemyViewPrefab); EnemyModel enemyModel = new EnemyModel(enemyConfig.health, enemyConfig.force, enemyConfig.torque, enemyConfig.bulletVariants, enemyConfig.enemyColor); ApplyMaterial(enemyConfig.enemyColor, enemyViewInstance); EnemyController enemyController = new EnemyController(enemyViewInstance, enemyModel); }
private void CreateModel(EnemyScriptableObject _enemyScriptableObject, Vector3?_spawnPos = null) { EnemyModel _enemyModel = new EnemyModel(_enemyScriptableObject); currentEnemyModel = _enemyModel; if (_spawnPos != null) { SpawnEnemy(_enemyModel, _spawnPos); } else { SpawnEnemy(_enemyModel); } }
private void SpawnEnemy(EnemyModel _enemyInstance, Vector3?_position = null) { GameObject currentEnemyInstance = GameObject.Instantiate(_enemyInstance.GetEnemyModel()); if (_position != null) { currentEnemyInstance.transform.position = (Vector3)_position; } else { currentEnemyInstance.transform.position = new Vector3(UnityEngine.Random.Range(-20, 40), 0, UnityEngine.Random.Range(-20, 40)); } currentEnemyView = currentEnemyInstance.GetComponent <EnemyView>(); currentEnemyView.SetMaterial(_enemyInstance.GetEnemyMaterial()); currentEnemyView.SetController(this); }
public EnemyController(EnemyView enemyView, EnemyModel enemyModel) { enemyView.ControllerChannelInitialisaton(this); EnemyView = enemyView; }