Exemplo n.º 1
0
    public static Ubimon FromJSON(IDictionary <string, object> json, UbimonDatabase db)
    {
        var ubimon = new Ubimon();

        ubimon.prototype = db.GetUbimonData(json["prototype"] as string);
        ubimon.id        = json["id"] as string;
        ubimon.trainer   = json["trainer"] as string;
        ubimon.name      = json["name"] as string;
        ubimon.level     = int.Parse(json["level"].ToString());
        ubimon.moves     = new List <Move>();
        foreach (var move in (json["moves"] as IList <object>))
        {
            ubimon.moves.Add(db.GetMove(move as string));
        }
        ubimon.life    = int.Parse(json["life"].ToString());
        ubimon.maxLife = int.Parse(json["maxLife"].ToString());

        return(ubimon);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Called when this component is created in the scene.
    /// </summary>
    void Awake()
    {
        main = this;
        //playerId = System.Guid.NewGuid().ToString();
        playerId        = "teste";
        ubimonDB        = UbimonDatabase.instance;
        ubimonContainer = new UbimonContainer(
            0, Mathf.CeilToInt(0.2f * Screen.height),
            Screen.width, Mathf.FloorToInt(Screen.height / 2 + 280 - 0.2f * Screen.height));

        battleBG = transform.FindChild("BattleBG").gameObject;
        battleBG.renderer.enabled = false;

        ubimons = new List <Ubimon>()
        {
            RandomEnemy()
        };
        ubimonContainer.icons = ubimonContainer.Fit(ubimons);

        battleTimer = battleCheckInterval;
    }
Exemplo n.º 3
0
 public static Ubimon FromJSON(string json, UbimonDatabase db)
 {
     return(FromJSON((IDictionary <string, object>)Json.Deserialize(json), db));
 }