void OnGUI()
    {
        GUILayout.Label("Use the number keys 0-9 to change the pitch of the note");

        KeyCode[] keyCodes =
        {
            KeyCode.Alpha1,
            KeyCode.Alpha2,
            KeyCode.Alpha3,
            KeyCode.Alpha4,
            KeyCode.Alpha5,
            KeyCode.Alpha6,
            KeyCode.Alpha7,
            KeyCode.Alpha8,
            KeyCode.Alpha9,
            KeyCode.Alpha0
        };
        for (int i = 0; i < keyCodes.Length; ++i)
        {
            if (Input.GetKeyDown(keyCodes[i]))
            {
                // Our patch listens for the sample_event message and plays the corresponding note
                PureData.Send <float>("sample_event", i);
            }
        }
    }
Exemple #2
0
 void Awake()
 {
     if (!patchOpened)
     {
         PureData.OpenPatch("_Main");
         PureData.Send("Tempo", tempo);
         patchOpened = true;
     }
 }
Exemple #3
0
	void DestroyObject(GameObject obj) {
		obj.layer = 19;
		
		StartCoroutine(PlayDestructionParticleFX(obj));
		
		foreach (SpriteRenderer sprite in obj.GetComponentsInChildren<SpriteRenderer>()) {
			StartCoroutine(FadeOutAlpha(sprite, 10));
		}
		
		PureData.Send("Destroy");
	}
Exemple #4
0
    public override void OnEnter()
    {
        jumpCounter     = jumpDuration;
        jumpOrientation = Layer.orientation;
        jumpYPosition   = transform.position.Rotate(jumpOrientation).y;

        velocity             = rigidbody2D.velocity + new Vector2(0, jumpHeight * jumpMinHeight).Rotate(-jumpOrientation);
        rigidbody2D.velocity = velocity;

        PureData.Send("Jump");
    }
Exemple #5
0
 public void ChangeOrientation(float newOrientation)
 {
     orientation = newOrientation % 360;
     transform.SetEulerAngles(orientation, "Z");
     PureData.Send("Rotate");
 }