Exemplo n.º 1
0
    /// <summary>
    /// Called when the virtual button has just been pressed:
    /// </summary>
    ///
    public void OnButtonPressed(VirtualButtonBehaviour vb)
    {
        Debug.Log("OnButtonPressed: " + vb.VirtualButtonName);

        SetVirtualButtonMaterial(m_VirtualButtonMaterialPressed);

        // Add the material corresponding to this virtual button
        // to the active material list:
        switch (vb.VirtualButtonName)
        {
        case "wave":
            // Start Astronaut waving animation
            GetComponentInChildren <Animator>().SetBool("IsWaving", true);
            print("AHHHHHHHHHHHHHH 0");
            break;

        case "scan":
            // Start Drone scanning animation
            Drone drone = GetComponentInChildren <Drone>();
            drone.AnimEvt_StartScanning();
            print("AHHHHHHHHHHHHHH");
            break;

        case "oxygen":
            // Start Oxygen Tank display animation
            GetComponentInChildren <Animator>().SetBool("IsDetailOn", true);
            print("AHHHHHHHHHHHHHH 2");
            break;

        case "fissure":
            // Change fissure color
            var fissureGradient = GetComponentInChildren <ParticleSystem>().colorOverLifetime;
            fissureGradient.enabled = true;

            // Create dark red to black gradient
            Gradient gradient = new Gradient();
            gradient.SetKeys(new GradientColorKey[] {
                new GradientColorKey(new Color(0.6f, 0f, 0f), 0.0f),
                new GradientColorKey(Color.black, 0.7f)
            },
                             new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f),
                                                      new GradientAlphaKey(0.5f, 1.0f) });

            fissureGradient.color = gradient;
            print("AHHHHHHHHHHHHHH 3");
            break;
        }
    }