public override Texture2D getProjectileTexture() { return(RogueUtils.getTextureFromPath(RogueUtils.getEquipmentIconDir() + "/" + "bow/" + "arrows/" + "BasicArrow.png")); }
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); }
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); }
//**************** Item ****************************** public Texture2D getIcon() { return(RogueUtils.getTextureFromPath(getIconPath())); }
public string getIconPath() { return(RogueUtils.getEquipmentIconDir() + "/" + getItemType() + "/" + GetType().Name + ".png"); }
public void setTextureOnImage(Image img, Texture2D tex) { img.overrideSprite = RogueUtils.generateSpriteFromTexture(tex); }