I got a little bit further with scripting and decided to make a small rpg, now im trying to just set up a script to cast Fire ball. i’m making a fault somewhere, just can’t quite seem to find where.
using UnityEngine;
using System.Collections;
public class Fireball : MonoBehaviour {
public int manaCost = 30;
private string spellName = "Fire Ball";
public float castTime = 35.5f;
private float curCastTime = 0f;
private bool spellCasting = false;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown(KeyCode.G))
{
for(float i = 0; i < castTime; i += Time.deltaTime)
{
Debug.Log("---Working---");
GUI.Box(new Rect(Screen.width / 2 - 50, Screen.height * 0.9f, castTime / curCastTime, 50), curCastTime + "/" + castTime);
i += Time.deltaTime;
}
}
}
void OnGUI()
{
}
}
Btw, this is just to make the loading barr work, you know, for charging spells, i know the GUI.box is in the wrong place, but it doesn’t even show my Debug.Log, so im trying to figure out why it’s not going through the loop