Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Wall : MonoBehaviour {
- public Sprite dmgSprite;
- public int hp = 4;
- public AudioClip chopSound1;
- public AudioClip chopSound2;
- private SpriteRenderer spriteRenderer;
- // Use this for initialization
- void Awake ()
- {
- spriteRenderer = GetComponent<SpriteRenderer>();
- }
- public void DamageWall (int loss)
- {
- SoundManager.instance.RandomizeSfx (chopSound1, chopSound2);
- spriteRenderer.sprite = dmgSprite;
- hp -= loss;
- if (hp <=0)
- gameObject.SetActive(false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement