Пример #1
0
    public static void Explode()
    {
        SoundManager.PlaySound("Splosion");

        O2Panel o2Panel = GameObject.Find("O2 Panel").GetComponent <O2Panel>();

        o2Panel.VentO2();

        GameObject player = GameObject.FindGameObjectWithTag("Player");

        player.GetComponent <SpaceManInfo>().flames.Play();
    }
Пример #2
0
    public static IEnumerator HoldBreathOngoing()
    {
        O2Panel o2Panel = GameObject.Find("O2 Panel").GetComponent <O2Panel>();

        o2Panel.Change02Speed(20);

        SoundManager.PlaySound("Gasp");

        yield return(new WaitForSeconds(1f));

        o2Panel.Change02Speed(-20.08f);

        yield return(new WaitForSeconds(1f));

        o2Panel.Change02Speed(.08f);

        yield return(null);
    }
Пример #3
0
    private static IEnumerator VentAirOngoing()
    {
        float endTime;
        float duration = 2.5f;

        endTime = Time.time + duration;

        GameObject     player     = GameObject.FindGameObjectWithTag("Player");
        Rigidbody2D    rb2d       = player.GetComponent <Rigidbody2D>();
        Transform      ventAirLoc = player.GetComponent <SpaceManInfo>().ventAirLoc;
        Vector2        ventAirPos = ventAirLoc.localPosition;
        ParticleSystem pS         = ventAirLoc.GetComponent <ParticleSystem>();

        O2Panel o2Panel = GameObject.Find("O2 Panel").GetComponent <O2Panel>();

        pS.Play();
        o2Panel.VentO2();


        while (Time.time < endTime)
        {
            if (player == null || ventAirPos == null)
            {
                break;
            }


            //rb2d.AddForceAtPosition(ventAirLoc.right * 5000 * Time.deltaTime, ventAirPos);
            ventAirPos = ventAirLoc.localPosition;

            rb2d.AddRelativeForce(new Vector2(800 * Time.deltaTime, 0));

            yield return(null);
        }

        if (pS != null)
        {
            pS.Stop();
        }
    }