Пример #1
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();
        }
    }