Beispiel #1
0
        public HP(GameObject spawnPosition)
        {
            GameObject spriteGameObject = Instantiate <GameObject>(spawnPosition);

            spriteGameObject.transform.localScale = new Vector3(12, 14, 0);
            SpriteItem = spriteGameObject.GetComponent <SpriteRenderer>();
            Texture2D textureHelmo = Resources.Load <Texture2D>("SetWarrior/Icons/Mercado/Misc/HP");
            Sprite    mySprite     = Sprite.Create(textureHelmo, new Rect(0.0f, 0.0f, textureHelmo.width, textureHelmo.height), new Vector2(0.0f, 0.0f), 100.0f);

            SpriteItem.sprite = mySprite;

            SpriteItem.sortingOrder = 1;
            BoxCollider2D boxColliderSprite = spriteGameObject.GetComponent <BoxCollider2D>();

            boxColliderSprite.offset = new Vector2(0.0492785871f, 0.055150032f);
            boxColliderSprite.size   = new Vector2(0.103928745f, 0.115270615f);
            spriteGameObject.tag     = "consumivel";

            HP component = spriteGameObject.AddComponent <HP>();

            component.Nome       = Nome;
            component.Tipo       = Tipo;
            component.SpriteItem = SpriteItem;
        }
Beispiel #2
0
        public Item DeepCopy()
        {
            HP other = (HP)this.MemberwiseClone();

            return(other);
        }