// Use this for initialization
    void Start()
    {
        ctrl           = GetComponent <pxStrax>();
        ctrl.cutoff    = 0.1f + transform.position.x * 0.05f;
        ctrl.resonance = 0.6f + transform.position.z * 0.1f;
        ctrl.osc2Mix   = 0.5f + transform.position.y * 0.25f;
        float note = notes[(int)(Mathf.Floor(Mathf.Abs(transform.position.x) * 24f) % 8f)] + Mathf.Floor(Random.value * 3f) * 12f + 43f;

        ctrl.KeyOn(note);
    }
 void Start()
 {
     //caching our components
     _audioSource = GetComponent <AudioSource>();
     _straxSynth  = GetComponent <pxStrax>();
 }
 void Start()
 {
     synth = GetComponent <pxStrax>();
 }
Esempio n. 4
0
 // Start is called before the first frame update
 void Start()
 {
     audioSynt = GetComponent <pxStrax>();
 }
Esempio n. 5
0
    private void InitAgent()
    {
        // get all the stuff
        renderers = new List <Renderer>();
        renderers.Add(GetComponent <Renderer>());
        rigidbody = GetComponent <Rigidbody>();
        synth     = GetComponent <pxStrax>();
        if (synth == null)
        {
            gameObject.AddComponent <pxStrax>();
            synth = GetComponent <pxStrax>();
        }

        // put the agent somewhere randomly
        RotateAgent(-10.0f, 10.0f);
        transform.position = new Vector3(
            Random.Range(-10.0f, 10.0f),
            Random.Range(-10.0f, 10.0f),
            Random.Range(-10.0f, 10.0f)
            );

        // predator or prey
        _isAgentFood = Random.Range(0.0f, 100.0f) < chanceOfAgentBeingFood ? true : false;

        // setup agent types
        if (_isAgentFood)
        {
            gameObject.tag = "agent-food";
            stepSpeed     *= 4.0f;
            synth.sustain  = true;
            synth.release  = 0.01f;
            // configure body
            Destroy(agentTail);

            foreach (GameObject leg in agentLegs)
            {
                renderers.Add(leg.GetComponent <Renderer>());
            }

            foreach (Renderer rend in renderers)
            {
                rend.material = matForFoodAgent;
            }
        }
        else
        {
            // prey agent
            gameObject.tag = "agent-hungry";
            synth.sustain  = false;
            synth.release  = 0.02f;

            // configure body
            foreach (GameObject leg in agentLegs)
            {
                Destroy(leg);
            }
            renderers.Add(agentTail.GetComponent <Renderer>());
            foreach (Renderer rend in renderers)
            {
                rend.material = matNoFood;
            }
        }
    }