Пример #1
0
 public void StartDestroy()
 {
     GameApplication.Instance.GetService <IEnemyService>().PlayerSpotted -= StartChasing;
     currentEnemyModel = null;
     currentState      = null;
     currentEnemyView.DestroySelf();
     currentEnemyView = null;
 }
 public void RemoveEnemiesFromList(EnemyView enemyView)
 {
     enemies.Remove(enemyView);
     //Debug.Log("Enemy count after removing" + enemies.Count);
     if (enemies.Count == 0)
     {
         GameService.Instance.InvokeGameWon();
     }
 }
        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);
        }
Пример #4
0
        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);
        }
        private void ApplyMaterial(EnemyColor tankColor, EnemyView enemyView)
        {
            Material material = null;

            switch (tankColor)
            {
            case EnemyColor.GOLDEN:
                material = materialName[0];
                break;

            case EnemyColor.SILVER:
                material = materialName[1];
                break;

            case EnemyColor.YELLOW:
                material = materialName[2];
                break;
            }
            for (int i = 0; i < enemyView.transform.GetChild(0).childCount; i++)
            {
                enemyView.transform.GetChild(0).GetChild(i).GetComponent <MeshRenderer>().material = material;
            }
        }
 public void AddEnemiesToList(EnemyView enemyView)
 {
     enemies.Add(enemyView);
     //Debug.Log("Enemy count after adding" + enemies.Count);
 }
Пример #7
0
 public EnemyController(EnemyView enemyView, EnemyModel enemyModel)
 {
     enemyView.ControllerChannelInitialisaton(this);
     EnemyView = enemyView;
 }
Пример #8
0
 public void AttachView(EnemyView view)
 {
     m_View = view;
     m_View.AttachData(this);
 }