// Use this for initialization void Start() { startPos = transform.position; dispCounter = gameObject.GetComponentInParent(typeof(DispenserCounter)) as DispenserCounter; completeAudioSource = gameObject.AddComponent <AudioSource>(); completeAudioSource.clip = completeAudioClip; }
// Use this for initialization void Start() { crankStartRot = transform.forward; dispCounter = gameObject.GetComponentInParent(typeof(DispenserCounter)) as DispenserCounter; completeAudioSource = gameObject.AddComponent <AudioSource>(); completeAudioSource.clip = completeAudioClip; }
private void Start() { dispCounter = gameObject.GetComponentInParent(typeof(DispenserCounter)) as DispenserCounter; dispCounter.addSpawn(this); spawnString = dispCounter.spawnerType; spawnAudioSource = gameObject.AddComponent <AudioSource>(); spawnAudioSource.clip = spawnAudioClip; spawnModels = Resources.LoadAll(spawnString, typeof(GameObject)); }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Money") { MagicBox mb = magicBoxTarget.GetComponent <MagicBox>(); mb.deleteMoney(col.gameObject); DispenserCounter dispCounter = dispCounterTarget.GetComponent <DispenserCounter> (); dispCounter.increment(); //dispCounter.counter++; } }
public override void OnInspectorGUI() { DrawDefaultInspector(); DispenserCounter myScript = (DispenserCounter)target; if (GUILayout.Button("increment")) { myScript.increment(); } if (GUILayout.Button("decrement")) { myScript.decrement(); } if (GUILayout.Button("spawnObject")) { myScript.spawnObject(); } }