예제 #1
0
    void AdjustVolume()
    {
        float distance = GenericFunctions.GetDistance(gameObject, Dima);

        distance        = distance > 100 ? 100 : distance;
        hitSound.volume = 1f - (distance / 40);
    }
예제 #2
0
    float AdjustedVolume()
    {
        float distance = GenericFunctions.GetDistance(gameObject, Dima);

        distance = distance > 100 ? 100 : distance;
        return(0.5f - (distance / 50));
    }
예제 #3
0
    void Update()
    {
        float distance = GenericFunctions.GetDistance(gameObject, Dima);

        distance         = distance > 100 ? 100 : distance;
        burnAudio.volume = 0.3f - (distance / 80);
    }
예제 #4
0
    void Start()
    {
        Vector3    middlePoint = (rail_end_1.transform.position + rail_end_2.transform.position) / 2;
        Quaternion lookRot     = GenericFunctions.GetLookRotation(rail_end_1.transform, rail_end_2.transform);
        float      distance    = GenericFunctions.GetDistance(rail_end_1, rail_end_2);

        wire.position   = middlePoint;
        wire.rotation   = lookRot;
        wire.localScale = new Vector3(distance - (distance / 1.21f), wire.transform.localScale.y, wire.transform.localScale.z);
    }
예제 #5
0
    void PlayHitSound()   // plays one of 3 hit sounds with volume adjusted based on distance
    {
        float distance = GenericFunctions.GetDistance(gameObject, Dima);

        distance        = distance > 100 ? 100 : distance;
        hitSound.volume = 0.6f - (distance / 60);

        int number = Random.Range(0, 2);

        hitSound.clip = clips[number];
        hitSound.Play();
    }
예제 #6
0
    void Update()
    {
        if (!overlord.playerDead && !overlord.stageWin)
        {
            float heightOffset = 6f;
            float distance     = GenericFunctions.GetDistance(Dima, crosshair);

            transform.position = NewCameraPos(heightOffset);

            /*
             * if (distance > cameraSizeMin && distance < cameraSizeMax) {
             *  ZoomCamera(distance);
             * }
             */
        }
    }
예제 #7
0
    void Start()
    {
        overlord   = GameObject.Find("OVERLORD").GetComponent <Overlord_script>();
        Dima       = GameObject.Find("Dima");
        dimaScript = Dima.GetComponent <Dima_script>();

        Vector3 middlePoint = (laser_A.transform.Find("Laser_Target_A").position + laser_B.transform.Find("Laser_Target_B").position) / 2;

        middlePointObject = Instantiate(new GameObject(), middlePoint, Quaternion.identity);

        Quaternion lookRot = GenericFunctions.GetLookRotation(laser_A.transform, laser_B.transform);

        float distance = GenericFunctions.GetDistance(laser_A.transform.Find("Laser_Target_A").gameObject, laser_B.transform.Find("Laser_Target_B").gameObject);

        if (isDeathLaser)
        {
            beam_A1.SetActive(false);
            beam_A2.SetActive(false);

            beam_D.transform.position   = middlePoint;
            beam_D.transform.rotation   = lookRot;
            beam_D.transform.localScale = new Vector3(distance - (distance / 7), beam_D.transform.localScale.y, beam_D.transform.localScale.z);
        }
        else
        {
            beam_D.SetActive(false);

            beam_A1.transform.position   = middlePoint;
            beam_A1.transform.rotation   = lookRot;
            beam_A1.transform.localScale = new Vector3(distance - (distance / 7), beam_A1.transform.localScale.y, beam_A1.transform.localScale.z);

            beam_A2.transform.position   = middlePoint;
            beam_A2.transform.rotation   = lookRot;
            beam_A2.transform.localScale = new Vector3(distance - (distance / 7), beam_A2.transform.localScale.y, beam_A2.transform.localScale.z);
        }

        laser_Ball_A    = laser_A.transform.Find("Laser_ball").gameObject;
        laser_Ball_D_A  = laser_A.transform.Find("Laser_ball_D").gameObject;
        laser_Ball_A1_A = laser_A.transform.Find("Laser_ball_A1").gameObject;
        laser_Ball_A2_A = laser_A.transform.Find("Laser_ball_A2").gameObject;

        laser_Ball_B    = laser_B.transform.Find("Laser_ball").gameObject;
        laser_Ball_D_B  = laser_B.transform.Find("Laser_ball_D").gameObject;
        laser_Ball_A1_B = laser_B.transform.Find("Laser_ball_A1").gameObject;
        laser_Ball_A2_B = laser_B.transform.Find("Laser_ball_A2").gameObject;
    }
예제 #8
0
    void LaserFireController()
    {
        float baseVolume = isDeathLaser ? 0.4f : 0.4f;
        float distance   = GenericFunctions.GetDistance(middlePointObject, Dima);

        distance = distance > 100 ? 100 : distance;
        laserFireAudio.volume = baseVolume - (distance / 60);

        if (isDeathLaser)
        {
            beam_D.SetActive(laserOn);
            laserFireAudio.clip = laserFireSounds[0];
        }
        else
        {
            if (overlord.alarmOn)
            {
                beam_A2.SetActive(laserOn);
                beam_A1.SetActive(false);
            }
            else
            {
                beam_A1.SetActive(laserOn);
                beam_A2.SetActive(false);
            }
            laserFireAudio.clip = laserFireSounds[1];
        }
        if (laserOn && !playingFireAudio)
        {
            laserFireAudio.Play();
            playingFireAudio = true;
        }
        else if (!laserOn)
        {
            laserFireAudio.Stop();
            playingFireAudio = false;
        }
        LaserBalls();
    }