Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'dice'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 3 results

  1. I'm Spanish, my english suxs.... this is a class I made for a game I'm doing, I leave here if anyone wants it. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.Reflection; public class LanzamientoDados { ArrayList tiradas = new ArrayList(); public LanzamientoDados() { } public double[] Lanzar() { if (tiradas.Count == 0) return new double[] {-1}; tirada[] ts = (tirada[])tiradas.ToArray(typeof(tirada)); return Lanzar(ts); } public double Lanzar(tirada Tirada) { return Tirada.Resolver(); } public double[] Lanzar(tirada[] tiradas) { double[] result = new double[tiradas.Length]; for (int i = 0; i <= tiradas.Length-1; i++) { tirada t = tiradas[i]; result[i] = t.Resolver(); } return result; } public int Lanzar(string expresion) { tirada t = new tirada(expresion); return t.Resolver(); } public int[] Lanzar(params string[] expresiones) { int[] result = new int[expresiones.Length]; for (int i = 0; i <= expresiones.Length - 1; i++) { tirada t = new tirada(expresiones[i]); result[i] = t.Resolver(); } return result; } public void Add(tirada Tirada) { tiradas.Add(Tirada); } public void Clear() { tiradas.Clear(); } } public class tirada { protected enum eDados { D4 = 4, D6 = 6, D8 = 8, D10 = 10, D12 = 12, D20 = 20, D30 = 30, D100 = 100 } public string expresion; private string[] patterns = { "[\\d]*(dado)\\[[\\d]*(-)[\\d]*\\]", "[\\d]*(dado)" }; public tirada(string Expresion) { expresion = Expresion; } internal int Resolver() { //si no viene expresión, devolver -1 if (expresion == "") return -1; //iniciliazar el random Random random = new Random(); //guardar la expresión en una cadena temporal string expaux = expresion; //cambiar los valores de cadena de los dados (D10, D20, D6, etc...) a valores numéricos //recorremos los valores del enum al reves, para cambiar antes los D100 que los D10 int[] valores = (int[]) System.Enum.GetValues(typeof(eDados)); for (int i = valores.Length - 1; i >= 0; i--) { //dado a buscar string d = "D" + valores[i].ToString(); foreach (string pattern in patterns) { //expresión regular para encontrar los dados necesarios del valor indicado string reg = pattern.Replace("dado", d); Regex rx = new Regex(reg); MatchCollection matches = rx.Matches(expaux); foreach (Match match in matches) { string exp = match.Value; //si el dado encontrado no tiene un número que le preceda, la cantidad de dados a tirar es 1 int cantidad = 1; int min = 1; int max = valores[i]; if (exp.IndexOf("D") > 0) { cantidad = int.Parse(exp.Split('D')[0]); max = valores[i] * cantidad; } if (exp.IndexOf("[") > 0 && exp.IndexOf("]") > 0) { string limites = exp.Substring(exp.IndexOf("[") + 1, exp.IndexOf("]") - exp.IndexOf("[") - 1); min = int.Parse(limites.Split('-')[0]); max = int.Parse(limites.Split('-')[1]); } //eDados dado = (eDados)valores[i]; expaux = expaux.Replace(exp, ValorRandom(random, cantidad, min, max, valores[i]).ToString()); } } } int result = 0; try { result = Evaluate (expaux); } catch (Exception ex) { Console.WriteLine(ex.Message); result = 0; } return result; } public int Evaluate(string expression) { return (int)new System.Xml.XPath.XPathDocument (new System.IO.StringReader("<r/>")).CreateNavigator().Evaluate (string.Format("number({0})", new System.Text.RegularExpressions.Regex(@"([\+\-\*])").Replace(expression, " ${1} ").Replace("/", " div ").Replace("%", " mod "))); } private int ValorRandom(Random random, int cantidad, int min, int max, int limite) { int result; do { result = 0; for (int i = 1; i <= cantidad; i++) result += random.Next(0, limite) + 1; } while (result < min || result > max); return result; } }
  2. (I have no idea if this has been posted because my searching skill suxx ) So anyway, as the title says: What game company would you love to work with and why? I would love to work with DICE because they´re Swedish just like me and it´s my dream to work at their place and work on the Battlefield series and Mirror´s Edge (if there are any other than two). <3 Now, tell me yours
  3. So if you guys dont know the battlefield 4 game-player reveal trailer has been released. Check it out! What are you most looking forward to about this game!!! I love the open battles and the large scale battles. not to mention the destruction system.
×
×
  • Create New...