private void initControllers()
    {
        _enemyMediator = gameObject.AddComponent<EnemyMediator>();
        _enemyMediator.init();

        _enemyProxy = new EnemyProxy();
        _enemyProxy.init();
    }
        public override void Execute(INotification notification)
        {
            EnemyProxy proxyEnemies = MyFacade.Instance.RetrieveProxy(EnemyProxy.NAME) as EnemyProxy;
            var        enemy0       = new EnemyModel(0, 1, 1, 666);
            var        enemy1       = new EnemyModel(1, 2, 2, 666);
            var        enemy2       = new EnemyModel(2, 3, 3, 666);

            proxyEnemies.AddEnemy(enemy0);
            proxyEnemies.AddEnemy(enemy1);
            proxyEnemies.AddEnemy(enemy2);


            LevelProxy proxyLevels = MyFacade.Instance.RetrieveProxy(LevelProxy.NAME) as LevelProxy;


            var lvl0Enemies = new[]
            {
                new LevelEnemy(0, -2, -2),
                new LevelEnemy(0, 0, 0),
                new LevelEnemy(0, 2, 2)
            };
            var lvl0 = new LevelModel(0, lvl0Enemies);

            proxyLevels.AddLevel(lvl0);

            var lvl1Enemies = new[]
            {
                new LevelEnemy(1, -2, 0),
                new LevelEnemy(1, 0, 0),
                new LevelEnemy(1, 2, 0)
            };
            var lvl1 = new LevelModel(1, lvl1Enemies);

            proxyLevels.AddLevel(lvl1);

            var lvl2Enemies = new[]
            {
                new LevelEnemy(2, -2, 2),
                new LevelEnemy(2, 0, 0),
                new LevelEnemy(2, 2, -2)
            };
            var lvl2 = new LevelModel(2, lvl2Enemies);

            proxyLevels.AddLevel(lvl2);
        }
Esempio n. 3
0
        public override void Execute(INotification notification)
        {
            Debug.Log("Sub2");


            var otherProxy = MyFacade.Instance.RetrieveProxy(OtherDataProxy.NAME) as OtherDataProxy;

            if (otherProxy.GetLives() <= 0)
            {
                return;
            }

            GameMediator mediator = Facade.RetrieveMediator(GameMediator.NAME) as GameMediator;

            mediator.Hide();

            int id = (int)notification.Body;

            LevelProxy levelProxy = Facade.RetrieveProxy(LevelProxy.NAME) as LevelProxy;
            EnemyProxy enemyProxy = Facade.RetrieveProxy(EnemyProxy.NAME) as EnemyProxy;
            var        level      = levelProxy.LevelsLists[id];

            foreach (var enemy in level.Enemies)
            {
                var a  = mediator.InstanceEnemyItem();
                var aa = a.GetComponentInChildren <EnemyItem>(true);
                aa.UpdateItem(enemyProxy.GetEnemy(enemy.EnemyId));
                a.transform.localScale = mediator.GetEnemySize();
                a.transform.position   = new Vector3(enemy.EnemyPosX * 3, 1.5f, enemy.EnemyPosY * 3);
                a.SetActive(true);
                aa.Destroyed += () => SendNotification(MyFacade.ENEMY_DESTROYED, aa);
                mediator.AddItems(aa);
            }

            mediator.Show();
        }
    public void StartCombat(EnemyProxy enemy, bool isBoss = false)
    {
        CurrentState = PlayerExplorationState.InCombat;

        enemy.StartCombat(this, isBoss);
    }
    public void StartCombat(EnemyProxy enemy, string desiredLevel)
    {
        CurrentState = PlayerExplorationState.InCombat;

        enemy.StartCombat(this, desiredLevel);
    }