Esempio n. 1
0
 public void Initialize(EnemyModel model)
 {
     this.model = model;
     model.EnemyData.Subscribe(view.SetEnemyData).AddTo(this);
     model.Position.Subscribe(view.SetPosition).AddTo(this);
     view.OnReceiveDamage.Subscribe(model.ReceiveDamage).AddTo(this);
 }
Esempio n. 2
0
        public EnemyModel Create(EnemyData.EnemyType type, Vector2 initialPos)
        {
            var enemyData  = new EnemyData(EnemyData.EnemyType.First);
            var enemyModel = new EnemyModel(enemyData, initialPos);

            var prefab      = Resources.Load <EnemyPresenter>("Enemy");
            var enemyObject = GameObject.Instantiate(prefab);

            enemyObject.Initialize(enemyModel);

            return(enemyModel);
        }