예제 #1
0
파일: Bow.cs 프로젝트: 11111000101/Rogue
 public override Texture2D getProjectileTexture()
 {
     return(RogueUtils.getTextureFromPath(RogueUtils.getEquipmentIconDir() + "/"
                                          + "bow/"
                                          + "arrows/"
                                          + "BasicArrow.png"));
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
파일: Weapon.cs 프로젝트: 11111000101/Rogue
 //**************** Item ******************************
 public Texture2D getIcon()
 {
     return(RogueUtils.getTextureFromPath(getIconPath()));
 }
예제 #5
0
파일: Weapon.cs 프로젝트: 11111000101/Rogue
 public string getIconPath()
 {
     return(RogueUtils.getEquipmentIconDir() + "/"
            + getItemType() + "/"
            + GetType().Name + ".png");
 }
예제 #6
0
 public void setTextureOnImage(Image img, Texture2D tex)
 {
     img.overrideSprite = RogueUtils.generateSpriteFromTexture(tex);
 }