示例#1
0
    void Update()
    {
        GameObject player = Player.player;

        panel.SetActive(player != null); // hide while not in the game world
        if (!player)
        {
            return;
        }

        // health
        Health health = player.GetComponent <Health>();

        healthSlider.value = health.Percent();
        healthStatus.text  = health.current + " / " + health.max;

        // mana
        Mana mana = player.GetComponent <Mana>();

        manaSlider.value = mana.Percent();
        manaStatus.text  = mana.current + " / " + mana.max;

        // endurance
        Endurance endurance = player.GetComponent <Endurance>();

        enduranceSlider.value = endurance.Percent();
        enduranceStatus.text  = endurance.current + " / " + endurance.max;
    }
示例#2
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Strength", true, out subEle);
            subEle.Value = Strength.ToString();

            ele.TryPathTo("Perception", true, out subEle);
            subEle.Value = Perception.ToString();

            ele.TryPathTo("Endurance", true, out subEle);
            subEle.Value = Endurance.ToString();

            ele.TryPathTo("Charisma", true, out subEle);
            subEle.Value = Charisma.ToString();

            ele.TryPathTo("Intelligence", true, out subEle);
            subEle.Value = Intelligence.ToString();

            ele.TryPathTo("Agility", true, out subEle);
            subEle.Value = Agility.ToString();

            ele.TryPathTo("Luck", true, out subEle);
            subEle.Value = Luck.ToString();
        }
示例#3
0
    void Update()
    {
        GameObject player = Player.player;

        if (!player)
        {
            return;
        }

        Health health = player.GetComponent <Health>();

        healthSlider.value = health.Percent();
        healthStatus.text  = health.current + " / " + health.max;

        Mana mana = player.GetComponent <Mana>();

        manaSlider.value = mana.Percent();
        manaStatus.text  = mana.current + " / " + mana.max;

        Endurance endurance = player.GetComponent <Endurance>();

        enduranceSlider.value = endurance.Percent();
        enduranceStatus.text  = endurance.current + " / " + endurance.max;

        levelText.text   = player.GetComponent <Level>().current.ToString();
        damageText.text  = player.GetComponent <Combat>().damage.ToString();
        defenseText.text = player.GetComponent <Combat>().defense.ToString();
    }
示例#4
0
文件: Player.cs 项目: mdbull/Football
 /// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <param name="lastName"></param>
 /// <param name="firstName"></param>
 /// <param name="age"></param>
 /// <param name="height"></param>
 /// <param name="weight"></param>
 /// <param name="race"></param>
 /// <param name="grade"></param>
 /// <param name="endurance"></param>
 /// <param name="number"></param>
 public Player(Team team, string id, string lastName, string firstName, int age, int height, int weight, Race race, Grade grade, Endurance endurance, string number, int fumble)
     : base(team, id, lastName, firstName, age, height, weight, race)
 {
     this.number    = number;
     this.grade     = grade;
     this.endurance = endurance;
     this.fumble    = fumble;
 }
示例#5
0
 public void get_en()
 {//当耐力不足时候恢复耐力用
     if (Endurance < 7)
     {
         addendurance(1);
         Debug.Log("回复了耐力" + Endurance.ToString());
     }
 }
示例#6
0
        public override int GetHashCode()
        {
            var hashCode = -1621467;

            hashCode = hashCode * -1521134295 + Name.GetHashCode();
            hashCode = hashCode * -1521134295 + Endurance.GetHashCode();
            hashCode = hashCode * -1521134295 + Strength.GetHashCode();
            hashCode = hashCode * -1521134295 + Dexterity.GetHashCode();
            return(hashCode);
        }
示例#7
0
 public Combat_System(Character_Stat_Array attribute_Array, int Endurance, int Barrier, Client client, Buff_Component buff_Component)
 {
     limbs = new List <Limb>()
     {
         new Limb(attribute_Array, "Head"), new Limb(attribute_Array, "Torso")
     };
     this.Endurance = new Endurance(new Kryz.CharacterStats.CharacterStat(Endurance));
     this.Barrier   = new Barrier(new Kryz.CharacterStats.CharacterStat(Barrier));
     Client         = client;
     Buff_Component = buff_Component;
 }
示例#8
0
        public XmlElement Serialize(XmlDocument doc)
        {
            XmlElement xmlStats = doc.CreateElement("stats");

            xmlStats.SetAttribute("health", Health.ToString());
            xmlStats.SetAttribute("maxHealth", MaxHealth.ToString());
            xmlStats.SetAttribute("endurance", Endurance.ToString());
            xmlStats.SetAttribute("strength", Strength.ToString());
            xmlStats.SetAttribute("intelligence", Intelligence.ToString());
            xmlStats.SetAttribute("agility", Agility.ToString());
            xmlStats.SetAttribute("dexterity", Dexterity.ToString());
            xmlStats.SetAttribute("upgradePoint", UpgradePoint.ToString());

            return(xmlStats);
        }
示例#9
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("CreatureType", true, out subEle);
            subEle.Value = CreatureType.ToString();

            ele.TryPathTo("Skill/Combat", true, out subEle);
            subEle.Value = CombatSkill.ToString();

            ele.TryPathTo("Skill/Magic", true, out subEle);
            subEle.Value = MagicSkill.ToString();

            ele.TryPathTo("Skill/Stealth", true, out subEle);
            subEle.Value = StealthSkill.ToString();

            ele.TryPathTo("Health", true, out subEle);
            subEle.Value = Health.ToString();

            WriteUnusedXML(ele, master);

            ele.TryPathTo("Damage", true, out subEle);
            subEle.Value = Damage.ToString();

            ele.TryPathTo("Strength", true, out subEle);
            subEle.Value = Strength.ToString();

            ele.TryPathTo("Perception", true, out subEle);
            subEle.Value = Perception.ToString();

            ele.TryPathTo("Endurance", true, out subEle);
            subEle.Value = Endurance.ToString();

            ele.TryPathTo("Charisma", true, out subEle);
            subEle.Value = Charisma.ToString();

            ele.TryPathTo("Intelligence", true, out subEle);
            subEle.Value = Intelligence.ToString();

            ele.TryPathTo("Agility", true, out subEle);
            subEle.Value = Agility.ToString();

            ele.TryPathTo("Luck", true, out subEle);
            subEle.Value = Luck.ToString();
        }
示例#10
0
    // Update is called once per frame
    void Update()
    {
        Endurance enduScript = player.GetComponent <Endurance>();

        if (enduScript.flag == true)
        {
            if (transform.position.y <= 7.30)
            {
                player.GetComponent <Endurance>().FlagPoleTimer(false);

                if (Input.GetKeyDown(KeyCode.A))
                {
                    transform.Translate(Vector2.up * Time.deltaTime * enduScript.flagPower, Space.World);
                    //SoundManager.PlaySound("Winching");
                    if (!source.isPlaying)
                    {
                        source.Play();
                    }
                }
                if (Input.GetKeyDown(KeyCode.D))
                {
                    transform.Translate(Vector2.up * Time.deltaTime * enduScript.flagPower, Space.World);

                    /*if (!source.isPlaying)
                     * {
                     *  //source.Play();
                     * }*/
                }
            }
            else if (transform.position.y > 7.30)
            {
                SceneManager.LoadScene("YouWon");
            }
        }

        if (transform.position.y > 1.48 && transform.position.y <= 7.30)
        {
            transform.Translate(Vector2.down * Time.deltaTime * enduScript.flagDrop, Space.World);
        }
    }
示例#11
0
 public void Pack(BinaryWriter writer)
 {
     writer.Write(AttributeFlags);
     if ((AttributeFlags & 0x00000001) != 0)
     {
         Strength.Pack(writer);
     }
     if ((AttributeFlags & 0x00000002) != 0)
     {
         Endurance.Pack(writer);
     }
     if ((AttributeFlags & 0x00000004) != 0)
     {
         Quickness.Pack(writer);
     }
     if ((AttributeFlags & 0x00000008) != 0)
     {
         Coordination.Pack(writer);
     }
     if ((AttributeFlags & 0x00000010) != 0)
     {
         Focus.Pack(writer);
     }
     if ((AttributeFlags & 0x00000020) != 0)
     {
         Self.Pack(writer);
     }
     if ((AttributeFlags & 0x00000040) != 0)
     {
         Health.Pack(writer);
     }
     if ((AttributeFlags & 0x00000080) != 0)
     {
         Stamina.Pack(writer);
     }
     if ((AttributeFlags & 0x00000100) != 0)
     {
         Mana.Pack(writer);
     }
 }
示例#12
0
 public void Unpack(BinaryReader reader)
 {
     AttributeFlags = reader.ReadUInt32();
     if ((AttributeFlags & 0x00000001) != 0)
     {
         Strength.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000002) != 0)
     {
         Endurance.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000004) != 0)
     {
         Quickness.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000008) != 0)
     {
         Coordination.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000010) != 0)
     {
         Focus.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000020) != 0)
     {
         Self.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000040) != 0)
     {
         Health.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000080) != 0)
     {
         Stamina.Unpack(reader);
     }
     if ((AttributeFlags & 0x00000100) != 0)
     {
         Mana.Unpack(reader);
     }
 }
示例#13
0
        /// <summary>
        /// Loads a team from xml.
        /// </summary>
        /// <returns>Team</returns>
        /// <param name="filePath">String</param>
        private Team LoadTeamFromXML(string filePath)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filePath);
            XmlNode root = doc.FirstChild;

            if (root.HasChildNodes)
            {
                foreach (XmlNode xn in root.ChildNodes)
                {
                    if (xn.Name == "Info")
                    {
                        Dictionary <string, string> infoAttributes = new Dictionary <string, string>();
                        foreach (XmlNode cn in xn.ChildNodes)
                        {
                            infoAttributes.Add(cn.Name, cn.InnerText);
                        }
                        ret = new Team(infoAttributes["Name"], infoAttributes["Mascot"], Int32.Parse(infoAttributes["Year"]), infoAttributes["FieldName"], Int32.Parse(infoAttributes["FieldCapacity"]));
                        ret.Stats.AddStatSheet(StatTypes.WonLoss, new WonLossRecord(ret));
                    }
                    if (xn.Name == "TeamOffense")
                    {
                        Dictionary <string, string> offenseAttributes = new Dictionary <string, string>();
                        foreach (XmlNode cn in xn.ChildNodes)
                        {
                            offenseAttributes.Add(cn.Name, cn.InnerXml);
                        }

                        ret.TeamOffense = new Offense(ret, Int32.Parse(offenseAttributes["OffensiveLineBonus"]), Convert.ToBoolean(Int32.Parse(offenseAttributes["HasAllWeatherPenalty"])));
                    }
                    if (xn.Name == "Roster")
                    {
                        foreach (XmlNode cn in xn.ChildNodes)
                        {
                            if (cn.Name == "Offense")
                            {
                                int playerId = 1;
                                foreach (XmlNode ccn in cn.ChildNodes)
                                {
                                    if (ccn.Name == "Player")
                                    {
                                        Player       p  = null;
                                        PlayerSkills ps = null;
                                        Dictionary <string, string> playerSkillAttributes = new Dictionary <string, string>();
                                        Dictionary <string, string> playerAttributes      = new Dictionary <string, string>();
                                        foreach (XmlNode cccn in ccn.ChildNodes)
                                        {
                                            if (cccn.Name == "PlayerSkills")
                                            {
                                                foreach (XmlNode ccccn in cccn.ChildNodes)
                                                {
                                                    playerSkillAttributes.Add(ccccn.Name, ccccn.InnerText);
                                                }
                                            }
                                            else
                                            {
                                                playerAttributes.Add(cccn.Name, cccn.InnerText);
                                            }
                                        }
                                        //Get enums
                                        Race      race      = Race.Black;
                                        Grade     grade     = Grade.Senior;
                                        Endurance endurance = Endurance.Superb;
                                        p = new Player(ret, playerId.ToString(), playerAttributes["LastName"], playerAttributes["FirstName"], Int32.Parse(playerAttributes["Age"]), Int32.Parse(playerAttributes["Height"]), Int32.Parse(playerAttributes["Weight"]), race, grade, endurance, playerAttributes["Number"], Int32.Parse(playerAttributes["Fumble"]));

                                        try
                                        {
                                            ps = new PlayerSkills(playerSkillAttributes["Run"], playerSkillAttributes["Receive"], playerSkillAttributes["KickReturn"], Int32.Parse(playerSkillAttributes["Pass"]), Int32.Parse(playerSkillAttributes["Kick"]), playerSkillAttributes["Punt"]);

                                            p.AddPlayerSkills(ps);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                            throw ex;
                                        }
                                        ret.Add(p);
                                        playerId++;
                                    }
                                }
                                Player[] players = ret.ToArray();
                                ret.TeamOffense.SetPosition("QB", players[0]);
                                ret.TeamOffense.SetPosition("TB", players[1]);
                                ret.TeamOffense.SetPosition("FB", players[2]);
                                ret.TeamOffense.SetPosition("TE", players[3]);
                                ret.TeamOffense.SetPosition("WR1", players[4]);
                                ret.TeamOffense.SetPosition("WR2", players[5]);
                                ret.TeamOffense.SetPosition("K", players[6]);
                                ret.TeamOffense.SetPosition("P", players[6]);
                                ret.TeamOffense.SetPosition("KR", players[1]);
                                ret.TeamOffense.InitAvailableReceivers();
                            }
                            else
                            {
                                Dictionary <string, int>         defenseAttributes = new Dictionary <string, int>();
                                Dictionary <string, List <int> > defenseResults    = new Dictionary <string, List <int> >();

                                foreach (XmlNode ccn in cn.ChildNodes)
                                {
                                    if (ccn.Name == "DefenseResults")
                                    {
                                        foreach (XmlNode cccn in ccn.ChildNodes)
                                        {
                                            char[]     results     = cccn.InnerText.ToCharArray();
                                            List <int> resultArray = new List <int>();
                                            foreach (char c in results)
                                            {
                                                resultArray.Add((int)Char.GetNumericValue(c));
                                            }
                                            defenseResults.Add(cccn.Name, resultArray);
                                        }
                                    }
                                    else
                                    {
                                        defenseAttributes.Add(ccn.Name, Int32.Parse(ccn.InnerText));
                                    }
                                }

                                ret.TeamDefense = new Defense(ret, -defenseAttributes["RunPenalty"], -defenseAttributes["MaxRunLoss"], -defenseAttributes["MaxSackLoss"], -defenseAttributes["PassRushRating"], defenseAttributes["BonusRunPenalty"]);

                                LoadDefenseResults(defenseResults);


                                //ret.TeamDefense.InitCarryDefense(new CarryPlayResult[] { CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain });
                                //ret.TeamDefense.InitKickoffReturnDefense(new CarryPlayResult[] { CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain });
                                //ret.TeamDefense.InitPassDefense(new PassPlayResult[] { PassPlayResult.Sack, PassPlayResult.Sack, PassPlayResult.Sack, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Interception, PassPlayResult.Interception, PassPlayResult.Interception, PassPlayResult.Interception });
                            }
                        }
                    }
                }
            }
            return(ret);
        }
示例#14
0
 /// <summary>
 /// Génère une string représentant une couleur en hexadécimal basé sur les valeurs des stats
 /// de la couleur.
 /// </summary>
 /// <returns>La string générée.</returns>
 public string GetCodeHex()
 {
     return("#" + Force.ToString("X2")
            + Dexterite.ToString("X2")
            + Endurance.ToString("X2"));
 }
示例#15
0
 /// <inheritdoc/>
 public override bool DoesModelPassFilter(string filter) =>
 Strength.ToString().Contains(filter) ||
 Magic.ToString().Contains(filter) ||
 Endurance.ToString().Contains(filter) ||
 Agility.ToString().Contains(filter) ||
 Luck.ToString().Contains(filter);