Exemple #1
0
 public override Texture2D getProjectileTexture()
 {
     return(RogueUtils.getTextureFromPath(RogueUtils.getEquipmentIconDir() + "/"
                                          + "bow/"
                                          + "arrows/"
                                          + "BasicArrow.png"));
 }
Exemple #2
0
        protected GameObject createProjectileSprite()
        {
            GameObject go = new GameObject();

            //Find the Player GameObject using it's tag and store a reference to its transform component.

            Texture2D tex = RogueUtils.getTextureFromPath(RogueUtils.getEquipmentIconDir() + "/"
                                                          + "bow/"
                                                          + "arrows/"
                                                          + "BasicArrow.png");

            go.AddComponent <SpriteRenderer>().sprite = RogueUtils.generateSpriteFromTexture(getProjectileTexture());
            go.AddComponent <Rigidbody2D>();
            RectTransform goTransform = go.AddComponent <RectTransform>();

            goTransform.sizeDelta = new Vector2(0, 0);
            goTransform.anchorMin = new Vector2(0, 0.45f);
            goTransform.anchorMax = new Vector2(1, 0.55f);
            go.AddComponent <BasicProjectile>().setWeapon(this);
            go.layer = LayerMask.NameToLayer("Units");
            go.tag   = "Projectile";
            go.GetComponent <SpriteRenderer>().sortingLayerName = "Projectile";

            return(go);
        }
Exemple #3
0
        private void addDirectionArrow()
        {
            directionArrow = new GameObject();
            Texture2D tex = RogueUtils.getTextureFromPath(RogueUtils.getUIIconDir()
                                                          + "/directionArrow.png");

            directionArrow.AddComponent <SpriteRenderer>().sprite = RogueUtils.generateSpriteFromTexture(tex);
            directionArrow.layer = LayerMask.NameToLayer("UI");
            directionArrow.GetComponent <SpriteRenderer>().sortingLayerName = "Units";
            directionArrow.name = "PlayerDirection";
            directionArrow.transform.position = new Vector3(0.45f, 0);
            directionArrow.transform.SetParent(transform);
        }
Exemple #4
0
 //**************** Item ******************************
 public Texture2D getIcon()
 {
     return(RogueUtils.getTextureFromPath(getIconPath()));
 }
Exemple #5
0
 public string getIconPath()
 {
     return(RogueUtils.getEquipmentIconDir() + "/"
            + getItemType() + "/"
            + GetType().Name + ".png");
 }
 public void setTextureOnImage(Image img, Texture2D tex)
 {
     img.overrideSprite = RogueUtils.generateSpriteFromTexture(tex);
 }