Example #1
0
    // Use this for initialization
    void Start()
    {
        startPos    = transform.position;
        dispCounter = gameObject.GetComponentInParent(typeof(DispenserCounter)) as DispenserCounter;

        completeAudioSource      = gameObject.AddComponent <AudioSource>();
        completeAudioSource.clip = completeAudioClip;
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        crankStartRot = transform.forward;
        dispCounter   = gameObject.GetComponentInParent(typeof(DispenserCounter)) as DispenserCounter;

        completeAudioSource      = gameObject.AddComponent <AudioSource>();
        completeAudioSource.clip = completeAudioClip;
    }
Example #3
0
    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));
    }
Example #4
0
    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();
        }
    }