Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="heroType"></param>
        /// <param name="id"></param>
        public Hero(HeroTypeEnum type)
        {
            PlayerName      = "PlaceHolder";
            PlayerNameColor = CCColor3B.Black;
            HeroType        = type;

            AddDecoration(PlayerNameDecoration = new NameDecoration(() => PlayerName, () => PlayerNameColor));
        }
Exemple #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="heroType"></param>
        /// <param name="id"></param>
        public Hero(HeroTypeEnum type)
        {
            PlayerName = "PlaceHolder";
            PlayerNameColor = CCColor3B.Black;
            HeroType = type;

            AddDecoration(PlayerNameDecoration = new NameDecoration(() => PlayerName, () => PlayerNameColor));
        }
Exemple #3
0
 public static string GetHeroTypeName(HeroTypeEnum heroType)
 {
     switch (heroType)
     {
         case HeroTypeEnum.Knight:
             return "Knight";
         case HeroTypeEnum.Cleric:
             return "Cleric";
         default:
             return "";
     }
 }
Exemple #4
0
        public static void CreateHero()
        {
            if (_dictHeroConfs == null)
            {
                var heroList = SerializationManager.LoadFromCSV <HeroItem>("Configs/HeroConfs");
                _dictHeroConfs = new Dictionary <string, HeroItem>();
                heroList.ForEach(p =>
                {
                    _dictHeroConfs.Add(p.strType, p);
                });
            }

            int          perc     = Random.Range(0, 100);
            HeroTypeEnum typeEnum = HeroTypeEnum.Archer;

            if (perc < 70)
            {
                typeEnum = (HeroTypeEnum)Random.Range(0, (int)HeroTypeEnum.Special);
            }
            else
            {
                typeEnum = (HeroTypeEnum)Random.Range((int)HeroTypeEnum.Special + 1, (int)HeroTypeEnum.Max);
            }

            var hero = (GameObject.Instantiate(Resources.Load(Consts.Prefab_HeroBase)) as GameObject).AddComponent <HeroCtrl>();

            hero.transform.position = new Vector3(Random.Range(-10, 10), 0, Random.Range(-10, 10));
            var itemConf = _dictHeroConfs[typeEnum.ToString()];

            Material matPrefab = null;
            var      matName   = itemConf.GenRandomHeroMatName();

            if (_dictLoadedMats.ContainsKey(matName))
            {
                matPrefab = _dictLoadedMats[matName];
            }
            else
            {
                matPrefab = Resources.Load <Material>(Consts.Material_Heroes + matName);
                _dictLoadedMats.Add(matName, matPrefab);
            }
            if (matPrefab != null)
            {
                hero.ModelMngr.smrBody.material.CopyPropertiesFromMaterial(matPrefab);
                hero.ModelMngr.smrBody.material.shader = matPrefab.shader;
            }
        }
Exemple #5
0
        public void CopyFrom(Hero hero)
        {
            this._id = hero._id;
            this._playerId = hero._playerId;
            this._name = hero._name;
            this._description = hero._description;
            this._sex = hero._sex;
            this._heroType = hero._heroType;

            this._basicAttack = hero._basicAttack;
            this._basicDefense = hero._basicDefense;
            this._basicPower = hero._basicPower;
            this._basicKnowledge = hero._basicKnowledge;

            this._attack = hero._attack;
            this._defense = hero._defense;
            this._power = hero._power;
            this._knowledge = hero._knowledge;
            this._speed = hero._speed;
            this._health = hero._health;

            this._experience = hero._experience;
            this._level = hero._level;
            this._maxSpellPoint = hero._maxSpellPoint;
            this._spellPointLeft = hero._spellPointLeft;
            this._infoImgFileName = hero._infoImgFileName;

            this._movementPoint = hero._movementPoint;
            this._movementPointLeft = hero._movementPointLeft;
        }
Exemple #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="heroType"></param>
        /// <param name="id"></param>
        public Hero(HeroTypeEnum type)
        {
            PlayerName = "[???]";

            SetNetworkType(GameObjectNetworkType.SHARE_FULL);
        }
Exemple #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="heroType"></param>
        /// <param name="id"></param>
        public Hero(HeroTypeEnum type)
        {
            PlayerName = "[???]";

            SetNetworkType(GameObjectNetworkType.SHARE_FULL);
        }