コード例 #1
0
ファイル: Robot.cs プロジェクト: roodiaz/programacion-2
 /// <summary>
 /// Creates the instance with limbs, head and torso.
 /// </summary>
 /// <param name="origin">Origin of the robot.</param>
 /// <param name="model">ModelName of the robot.</param>
 /// <param name="pieces">List of pieces of the robot.</param>
 public Robot(EOrigin origin, EModelName model, List <RobotPiece> pieces)
     : this()
 {
     this.origin    = origin;
     this.modelName = model;
     this.pieces    = this.CloneList(pieces);
 }
コード例 #2
0
 public Enemy(int id, EModelName name, int level, EBaseModelType baseType, ERaceType race, EProfessionType profession, EGenderType gender, EEnemy enemyType, int expDrop, int hp, int damage) :
     base(id, name, level, baseType, race, profession, gender)
 {
     this.EnemyType = enemyType;
     this.ExpDrop   = expDrop;
     this.HP        = hp;
     this.Damage    = damage;
 }
コード例 #3
0
    public void ParseModelJson()
    {
        JSONObject j = requestDataFromWeb.RequestCharacterData();

        foreach (JSONObject temp in j.list)
        {
            //公有属性
            int             id         = (int)temp["ID"].n;
            EModelName      name       = (EModelName)System.Enum.Parse(typeof(EModelName), temp["ModelName"].str);
            int             level      = (int)temp["Level"].n;
            EBaseModelType  baseType   = (EBaseModelType)System.Enum.Parse(typeof(EBaseModelType), temp["BaseType"].str);//基础类型(玩家,敌人,npc)
            ERaceType       race       = (ERaceType)System.Enum.Parse(typeof(ERaceType), temp["Race"].str);
            EProfessionType profession = (EProfessionType)System.Enum.Parse(typeof(EProfessionType), temp["Profession"].str);
            EGenderType     gender     = (EGenderType)System.Enum.Parse(typeof(EGenderType), temp["Gender"].str);

            BaseModel baseModel = null;

            switch (baseType)
            {
            case EBaseModelType.eCharacter:
                int   hp              = (int)temp["HP"].n;
                int   hpRecoverRate   = (int)temp["HpRecoverRate"].n;
                int   mp              = (int)temp["MP"].n;
                int   mpRecoverRate   = (int)temp["MpRecoverRate"].n;
                int   levelExp        = (int)temp["LevelExp"].n;
                int   exp             = (int)temp["Exp"].n;
                float expPercentRate  = (float)temp["ExpPercentRate"].n;
                int   levelUpperLimit = (int)temp["LevelUpperLimit"].n;
                int   intelligence    = (int)temp["Intelligence"].n;
                int   strength        = (int)temp["Strength"].n;
                int   agility         = (int)temp["Agility"].n;
                int   stamina         = (int)temp["Stamina"].n;
                int   energy          = (int)temp["Energy"].n;
                float missRate        = (float)temp["MissRate"].n;
                int   missValue       = (int)temp["MissValue"].n;
                float criRate         = (float)temp["CriRate"].n;
                int   criValue        = (int)temp["CriValue"].n;
                int   attackDamage    = (int)temp["AttackDamage"].n;
                int   physicDenfence  = (int)temp["PhysicDenfence"].n;
                int   magicDenfence   = (int)temp["MagicDenfence"].n;

                baseModel = new Character(id, name, level, baseType, race, profession, gender, hp, hpRecoverRate, mp, mpRecoverRate, exp, levelExp, expPercentRate, levelUpperLimit,
                                          intelligence, strength, agility, stamina, energy, missRate, missValue, attackDamage, criRate, criValue, physicDenfence, magicDenfence);
                break;

            case EBaseModelType.eNPC:
                break;

            case EBaseModelType.eEnemy:
                break;

            default:
                break;
            }
            characterModelList.Add(baseModel);
        }
    }
コード例 #4
0
 public BaseModel(int id, EModelName name, int level, EBaseModelType baseType, ERaceType race, EProfessionType profession, EGenderType gender)
 {
     this.ID        = id;
     this.ModelName = name;
     this.Level     = level;
     //this.Sprite = sprite;
     this.BaseType   = baseType;
     this.Race       = race;
     this.Profession = profession;
     this.Gender     = gender;
 }
コード例 #5
0
        /// <summary>
        /// Creates multiples pieces of the robot.
        /// </summary>
        /// <param name="metalType">Type Of metal of the robot.</param>
        /// <param name="origin">Origin of the robot.</param>
        /// <param name="modelName">Model name of the robot.</param>
        /// <param name="amountHead">Amount of heads of the robot.</param>
        /// <param name="amounTorso">Amount of torsos of the robot.</param>
        /// <param name="amountArms">Amount of arms of the robot.</param>
        /// <param name="amountLegs">Amount of legs of the robot.</param>
        /// <param name="amountTail">Amount of tails of the robot.</param>
        /// <param name="isRidable">boolean state that indicates if the robot is rideable or not.</param>
        private void ConfigureRobotForBuild(EMetalType metalType, EOrigin origin, EModelName modelName, int amountHead, int amounTorso, int amountArms, int amountLegs, int amountTail, bool isRidable)
        {
            amountOfMaterials = (int)modelName;
            int amountPieces = amountHead + amountArms + amountLegs + amounTorso + amountTail;
            int totalMaterialsForEachPiece = amountOfMaterials * amountPieces;

            if (RobotFactory.CheckAmountOfMaterialsInBuckets(totalMaterialsForEachPiece))
            {
                Robot prototype;
                prototype  = RobotFactory.CreateMultiplePiecesAndAddToStock(metalType, origin, modelName, amountOfMaterials, amountHead, amounTorso, amountArms, amountLegs, amountTail, isRidable);
                filename   = prototype.Model.ToString();
                absBioPath = $"{pathBiography}{filename}.bin";
                prototype.LoadBioFile(absBioPath);
                try {
                    if (RobotFactory.QualityControl(prototype, amountPieces))
                    {
                        if (RobotFactory.AddRobotToWarehouse(prototype))
                        {
                            ShowFormBuildingWithSound();
                            RobotFactory.SaveDataOfFactory();
                            prototype.SetSerialNumber();
                            DataAccessManager.InsertRobot(prototype);
                            ShowFormISOWithSound(prototype);
                        }
                    }
                    else
                    {
                        if (RobotFactory.DissasembleRobot(prototype))
                        {
                            throw new QualityControlFailedException("There have a difference in the amount of pieces, Quality control has failed!. For safety reasons, the robot was dismantled and its materials recycled.");
                        }
                    }
                } catch (Exception e) {
                    throw new Exception(e.Message, e);
                }
            }
            else
            {
                throw new InsufficientMaterialsException("Insufficients Materials to build this model of robot, you need to import more materials in the machine room or choose another model.");
            }
        }
コード例 #6
0
 public Character(int id, EModelName name, int level, EBaseModelType baseType, ERaceType race, EProfessionType profession, EGenderType gender, int hp, int hpRR, int mp, int mpRR, int exp, int levelExp, float ExpPR, int LevelUL,
                  int intelligence, int strength, int agility, int stamina, int energy, float missRate, int missValue, int attack, float criRate, int criValue, int pDenfence, int mDenfence) : base(id, name, level, baseType, race, profession, gender)
 {
     this.HP              = hp;
     this.HpRecoverRate   = hpRR;
     this.MP              = mp;
     this.MpRecoverRate   = mpRR;
     this.Exp             = exp;
     this.LevelExp        = levelExp;
     this.ExpPercentRate  = ExpPR;
     this.LevelUpperLimit = LevelUL;
     this.Intelligence    = intelligence;
     this.Strength        = strength;
     this.Agility         = agility;
     this.Stamina         = stamina;
     this.Energy          = energy;
     this.MissRate        = missRate;
     this.AttackDamage    = attack;
     this.PhysicDenfence  = pDenfence;
     this.MagicDenfence   = mDenfence;
     this.CriValue        = criValue;
     this.MissValue       = missValue;
     this.CritRate        = criRate;
 }
コード例 #7
0
ファイル: Robot.cs プロジェクト: roodiaz/programacion-2
 /// <summary>
 /// Creates the instance with limbs, head and torso.
 /// </summary>
 /// <param name="origin">Origin of the robot.</param>
 /// <param name="model">ModelName of the robot.</param>
 /// <param name="pieces">List of pieces of the robot.</param>
 /// <param name="isRideable">A boolean state that indicate if it rideable or not.</param>
 public Robot(EOrigin origin, EModelName model, List <RobotPiece> pieces, bool isRideable)
     : this(origin, model, pieces)
 {
     this.isRideable = isRideable;
 }
コード例 #8
0
 public NPC(int id, EModelName name, int level, EBaseModelType baseType, ERaceType race, EProfessionType profession, EGenderType gender, ENPCType npcType) : base(id, name, level, baseType, race, profession, gender)
 {
     this.NpcType = npcType;
 }