Beispiel #1
0
        private void MixerInteractive_OnInteractiveMessageEvent(object sender, Microsoft.Mixer.InteractiveMessageEventArgs e)
        {
            if (!e.Message.Contains("giveInput"))
            {
                return;
            }

            var message = JsonUtility.FromJson <InteractivePacket <InteractiveBombMessage> >(e.Message);

            if (null == message.@params || null == [email protected])
            {
                return;
            }

            switch ([email protected])
            {
            case BUTTON_BOMB:
                HandleBomb(message);
                break;

            case BUTTON_CONTROL:
                StartCoroutine(HandleTakeControl(message));
                break;
            }
        }
        private void MixerInteractive_OnInteractiveMessageEvent(object sender, Microsoft.Mixer.InteractiveMessageEventArgs e)
        {
            if (!e.Message.Contains("giveInput"))
            {
                return;
            }

            var message = JsonUtility.FromJson <InteractivePacket <InteractiveBombMessage> >(e.Message);

            if (null == message.@params || null == [email protected])
            {
                return;
            }

            var        location = [email protected];
            RaycastHit hit;
            var        ray = Camera.main.ViewportPointToRay(new Vector3(
                                                                Util.ScaleValue(location.x, 0, 1, Util.MinimapMinBoundary.x, Util.MinimapMaxBoundary.x),
                                                                Util.ScaleValue(1 - location.y, 0, 1, Util.MinimapMinBoundary.y, Util.MinimapMaxBoundary.y),
                                                                0));

            if (!Physics.Raycast(ray, out hit))
            {
                Debug.LogError("Bomb missed world");
                return;
            }

            switch ([email protected])
            {
            case "blast":
                new BlastBomb(BlastBombRadius, BlastBombDamage)
                .Drop(hit.point);
                break;

            case "sonic":
                new SonicBomb(SonicBombRadius, SonicBombAffector)
                .Drop(hit.point);
                break;

            default:
                Debug.LogError("I'm not dropping it like it's hot: " + [email protected]);
                break;
            }
        }