public void changeMagic(GameObject magic) { // Method for other scripts to change the magic currently used projectileHandler magicProperties = magic.GetComponent <projectileHandler>(); SpriteRenderer magicSprite = magic.GetComponent <SpriteRenderer>(); if (firePointSpriteHandler == null) { firePointSpriteHandler = firePoint.GetComponent <firePointdisplay>(); if (firePointSpriteHandler == null) { Debug.LogError("firepoint sprite handler renderer not found"); } } firePointSpriteHandler.updateSprite(magicSprite.sprite); tappingFireRate = magicProperties.projectileInfo.tappingFireRate; holdingFireRate = magicProperties.projectileInfo.holdingFireRate; projectile = magic; manaCost = magicProperties.projectileInfo.manaCost; }
public GameObject projectile; // The project that we will shoot // Use this for initialization void Start() { // Checking that everything needed is assigned Instance = this; if (firePoint == null) { Debug.LogError("firePoint not assigned"); } if (projectile == null) { Debug.LogError("projectile not assigned"); } firePointSprite = firePoint.GetComponent <SpriteRenderer>(); if (firePointSprite == null) { Debug.LogError("firepoint sprite renderer not found"); } firePointSpriteHandler = firePoint.GetComponent <firePointdisplay>(); if (firePointSpriteHandler == null) { Debug.LogError("firepoint sprite handler renderer not found"); } }