public Hero Create(HeroModel heroModel)
 {
     return null;
     //return new Hero
     //{
     //    Model = heroModel,
     //    Position = position,
     //    Texture = AssetsArchive.Instance.Assets.FirstOrDefault(heroModel.)
     //}
 }
Exemple #2
0
 public void GetCharacters(HeroModel[] models, bool isMine)
 {
     if (isMine)
     {
         myMap.GetFixedHerosAndPosition(models);
     }
     else
     {
         otherMap.GetFixedHerosAndPosition(models);
     }
 }
Exemple #3
0
 private void SelectionChanged() {
     foreach (var selectable in SelectionManager.GetSelectedObjects()) {
         var hero = selectable.GetView().GetModel<HeroModel>();
         if (hero != null) {
             selectedHero = hero;
             return;
         }
     }
     selectedHero = null;
     OnUnselectHero();
 }
Exemple #4
0
 public void InitializeSlots(HeroModel heroParam) {
     hero = heroParam;
     var slots = hero.GetSpellSlots();
     Slot1 = new SpellSlotUi();
     InjectionBinder.injector.Inject(Slot1);
     Slot1.Initialize(this, hero, slots[0], GameDataService.GetIconBySpell(slots[0].spell));
     Slot2 = new SpellSlotUi();
     InjectionBinder.injector.Inject(Slot2);
     Slot2.Initialize(this, hero, slots[1], GameDataService.GetIconBySpell(slots[1].spell));
     UpgradePoints = hero.UpgradePoints.Value;
     hero.UpgradePoints.OnPropertyChanged += OnUpgradePointsChanged;
 }
Exemple #5
0
 public IUnit CreateUnit(Vector3 position, UnitTypes type, UnitData data, bool isDefender) {
     IUnit unit;
     if (type == UnitTypes.HERO) {
         unit = new HeroModel();
     } else {
         unit = new UnitModel();
     }
     InjectionBinder.injector.Inject(unit);
     unit.Spawn(position, data, type, isDefender);
     unit.InitializeStates();
     unit.StartAct();
     return unit;
 }
Exemple #6
0
        public void Initialize(HeroContext heroParam, HeroModel heroModelParam, SpellSlot slotParam, string icon) {
            slot = slotParam;
            Level = slot.level;
            Icon = icon;
            Parent = heroParam;
            heroModel = heroModelParam;

            slot.OnStartCooldown += OnStartCooldown;
            slot.OnEndCooldown += OnEndCooldown;
            if (slot.Cooldown != null) {
                IsOnCooldown = true;
                slot.Cooldown.OnTick += OnTick;
            } else {
                IsOnCooldown = false;
            }
        }
    // 只有ID和品质可以影响toy的外观--只创建英雄所以其实可以不用工程方法
    public Toy createToy(int nTypeID, int nQuality, CAMP_TYPE eCampType, stHeroData pHeroData)
    {
        Toy pToy = null;
        stHeroCfg pConfig = HeroConfig.Instance().getHeroInfoById(nTypeID);
        if (null != pConfig)
        {
            HeroToy pHeroToy = new HeroToy();

            // 这样将model放开可以使模型易于扩展
            HeroModel pHeroModel = new HeroModel();
            pHeroModel.init(nTypeID, nQuality);
            pHeroToy.bindModel(pHeroModel);

            pHeroToy.setHeroConfig(pConfig);
            pHeroToy.setHeroData(pHeroData);

            initToy(pHeroToy, nTypeID, nQuality, eCampType, pHeroData);
            pToy = pHeroToy;
        }

        return pToy;
    }
Exemple #8
0
 /// <summary>
 /// Returns a Hero based on specified heroModel.
 /// </summary>
 /// <param name="heroModel"></param>
 /// <returns></returns>
 public Hero Create(HeroModel heroModel)
 {
     return new Hero
     {
         Attack = heroModel.Attack,
         Health = heroModel.Health,
         Id = heroModel.HeroId,
         ImageData = heroModel.ImageData,
         Magic = heroModel.Magic,
         Name = heroModel.Name
     };
 }
Exemple #9
0
    public void Initialize(HeroModel data)
    {
        heroClass = data.heroClass;
        maxHp = data.hp;
        currentHp = data.hp;
        maxAp = data.ap;
        currentAp = data.ap;
        SetPosition(data.position.posX, data.position.posY);
        transform.localEulerAngles = new Vector3(0.0f, 180.0f, 0.0f);

        if (Hud == null)
            return;

        Hud.SetHp(maxHp, currentHp);
        Hud.SetAp(maxAp, currentAp);
    }
Exemple #10
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            IsMouseVisible = true;
            mouse = Mouse.GetState();

            // (NOTE): Hero
            heroPos = new Vector2(100f, 100f);
            hero = new HeroModel
            {
                Attack = 1,
                Health = 20,
                HeroId = 1,
                ImageData = "healer",
                Magic = 10,
                Name = "Healer"
            };

            heroRect = new Rectangle(10, 100, 64, 64);
            heroScale = new Vector2(0.1f);

            // (NOTE): Monster
            monsterPos = new Vector2(150f, 100f);
            monster = new MonsterModel
            {
                Attack = 1,
                Health = 20,
                MonsterId = 1,
                ImageData = "monster",
                Name = "Genericus"
            };

            monsterRect = new Rectangle(10, 100, 100, 100);
            monsterScale = new Vector2(0.3f);

            // (NOTE): Player
            playerList = new List<PlayerModel>();
            player = new PlayerModel
            {
                Hero = hero,
                Name = "Zeqzor",
                PlayerId = 1,
                Score = 0
            };
            playerList.Add(player);

            // (NOTE): Match
            match = new MatchModel
            {
                Level = 1,
                MatchId = 1,
                Monster = monster,
                Players = playerList,
            };

            base.Initialize();
        }
		protected override void Because()
		{
			_result = Mapper.Map<HeroCard, HeroModel>(_card);
		}
Exemple #12
0
    public void GetFixedHerosAndPosition(HeroModel[] heroModels)
    {
        numOfCharacter = Mathf.Min(heroModels.Length, characters.Length);
        totalSettingNum = 0;
        for (int index = 0; index < numOfCharacter; ++index)
        {
            HeroModel heroData = heroModels[index];
            if (characters[index] != null)
            {
                mapManager.ResetHighlight();
                Object.Destroy(characters[index]);
            }

            HeroClass heroType = (HeroClass)((int)heroData.heroClass % (int)HeroClass.NUM);
            switch (heroType)
            {
                case HeroClass.ARCHER:
                    characters[index] = Instantiate(ArcherPrefab) as GameObject;
                    break;
                case HeroClass.FIGHTER:
                    characters[index] = Instantiate(SwordPrefab) as GameObject;
                    break;
                case HeroClass.MAGICIAN:
                    characters[index] = Instantiate(MagicianPrefab) as GameObject;
                    break;
                case HeroClass.THIEF:
                    characters[index] = Instantiate(ThiefPrefeb) as GameObject;
                    break;
                case HeroClass.PRIEST:
                    characters[index] = Instantiate(PriestPrefeb) as GameObject;
                    break;
                case HeroClass.MONK:
                    characters[index] = Instantiate(MonkPrefeb) as GameObject;
                    break;
                default:
                    break;
            };

            characters[index].transform.parent = gameObject.transform;
            GetCharacter(index).Index = index;
            GetCharacter(index).SetHud(GameObject.FindGameObjectWithTag("UI").GetComponent<UIManager>().GetNewHud());
            GetCharacter(index).Initialize(heroData);
        }
    }