Esempio n. 1
0
        async Task LoadData()
        {
            if (IsBusy)
            {
                return;
            }

            Exception error = null;

            try
            {
                IsBusy = true;

                var poke = await API.getPokemonAsync(Url);

                Information = poke;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error: " + ex);
                error = ex;
            }
            finally
            {
                IsBusy = false;
            }

            if (error != null)
            {
                await ShowAlertAsync("Error!", error.Message, "OK");
            }
        }
    protected virtual void Awake()
    {
        tilemap      = GetComponent <Tilemap>();
        pokemonCache = new Dictionary <Pokemon, Vector2Int>();

        touchManager = FindObjectOfType <TouchManager>();
        salesDesk    = FindObjectOfType <SalesDesk>();

        pokemonInformation = FindObjectOfType <PokemonInformation>();
    }
Esempio n. 3
0
    public void Init(PokemonInformation pokemonInformation, UnityAction buyActionCallback)
    {
        this.pokemonInformation = pokemonInformation;
        this.buyActionCallback  = buyActionCallback;

        PolygonCollider2D polygonCollider2D = GetComponent <PolygonCollider2D>();
        Sprite            sprite            = GetComponentInChildren <SpriteRenderer>().sprite;

        polygonCollider2D.pathCount = sprite.GetPhysicsShapeCount();
        List <Vector2> path = new List <Vector2>();

        for (int i = 0; i < polygonCollider2D.pathCount; i++)
        {
            path.Clear();
            sprite.GetPhysicsShape(i, path);
            polygonCollider2D.SetPath(i, path);
        }
    }