Beispiel #1
0
 private TankDirection(uint userId)
 {
     this.userId   = userId;
     forwardButton = InteractivityManager.SingletonInstance.GetButton("forward");
     backButton    = InteractivityManager.SingletonInstance.GetButton("back");
     leftButton    = InteractivityManager.SingletonInstance.GetButton("left");
     rightButton   = InteractivityManager.SingletonInstance.GetButton("right");
 }
    void ButtonEvent(object sender, InteractiveButtonEventArgs e)
    {
        if (!e.IsPressed)
        {
            return;               //Only handle button downpresses
        }
        switch (e.ControlID)
        {
        case "Progress":
            InteractiveButtonControl button = InteractivityManager.SingletonInstance.GetButton(e.ControlID);
            float progress    = button.Progress; // Get current button progress
            float newprogress = progress + 0.1f;
            button.SetProgress(newprogress);     //Increase button progress by 10%

            if (newprogress >= 1f)
            {
                button.SetDisabled(true);     //Disable button when reaching 100%
                return;
            }


            button.TriggerCooldown(1000);     //Trigger 1 second cooldown
            break;

        case "AttackScene":
            e.Participant.Group = MixerInteractive.GetGroup("attacking");     //Set participant's group to change MixPlay scene
            break;

        case "Jump":
            if (IsGrounded())
            {
                rb.AddForce(Vector3.up * 5, ForceMode.Impulse);
                setAnimationState("Run");
            }
            break;
        }

        e.CaptureTransaction(); //Capture the spark transaction
    }