private void SetAAGunDisplay(EAlts alt)
 {
     if (alt == EAlts.Low)
     {
         foreach (GameObject bullet in bulletSprites)
         {
             bullet.GetComponent <BlackWhiteTween>().TweenColor(WHITE, time);
         }
     }
     else if (alt == EAlts.Mid)
     {
         for (int i = 0; i < bulletSprites.Length; i++)
         {
             if (i < 1)
             {
                 bulletSprites[i].GetComponent <BlackWhiteTween>().TweenColor(WHITE, time);
             }
             else
             {
                 bulletSprites[i].GetComponent <BlackWhiteTween>().TweenColor(!WHITE, time);
             }
         }
     }
     else
     {
         foreach (GameObject bullet in bulletSprites)
         {
             bullet.GetComponent <BlackWhiteTween>().TweenColor(!WHITE, time);
         }
     }
 }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        playerFlyingComponent = this.GetComponent <Flying>();
        playerFlightControls  = this.GetComponentInChildren <PlayerFlightControls>();
        altSlider.maxValue    = playerFlightControls.presetAlts[playerFlightControls.presetAlts.Length - 1];
        altSlider.minValue    = playerFlightControls.presetAlts[0];
        //altText.text = Mathf.RoundToInt(playerFlyingComponent.currentAltitude) + "m";
        sliderPresets = new Vector3[playerFlightControls.presetAlts.Length];

        // spawn the altitude labels
        for (int i = 0; i < playerFlightControls.presetAlts.Length; i++)
        {
            GameObject altitudeObject = Instantiate(altitudeTextPrefab, altSlider.transform);
            altitudeObject.GetComponent <TextMeshProUGUI>().text = ((EAlts)i).ToString();
            altitudeObject.name = ((EAlts)i).ToString() + " Altitude Text";

            float   heightPercent = playerFlightControls.presetAlts[i] / (altSlider.maxValue - altSlider.minValue);
            float   yPos          = altSlider.GetComponent <RectTransform>().rect.height *heightPercent;
            Vector3 textAlt       = new Vector3(70, yPos - 315, 0);
            altitudeObject.transform.localPosition = textAlt;

            //Debug.Log($"height%: {heightPercent}, yPos: {yPos}, altitudeObject: {altitudeObject.transform.position}");
            altitudeObject.SetActive(true);

            textAlt.x       -= 95;
            sliderPresets[i] = textAlt;
        }

        prevAltitude = playerFlightControls.currentAltSetting;
        altitudeArrow.transform.localPosition = sliderPresets[(int)playerFlightControls.currentAltSetting];
        altSlider.value = playerFlightControls.GetDynamicAlt();
    }
Exemple #3
0
    // Start is called before the first frame update
    void Start()
    {
        player = this.transform.parent;

        // set first density
        UpdateDensity(densities[(int)player.GetComponentInChildren <PlayerFlightControls>().currentAltSetting]);
        prevAlt = player.GetComponentInChildren <PlayerFlightControls>().currentAltSetting;

        // set first speed
        UpdateSpeed(speeds[(int)player.GetComponentInChildren <PlayerFlightControls>().currentSpeedSetting]);
        prevSpeed = player.GetComponentInChildren <PlayerFlightControls>().currentSpeedSetting;
    }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        // only change arrow when altitude first changes
        if (prevAltitude != playerFlightControls.currentAltSetting)
        {
            SetBulb(playerFlightControls.currentAltSetting);
            prevAltitude = playerFlightControls.currentAltSetting;
        }

        // the altitude fluctuates too much, check within a range
        if (playerFlyingComponent.desireAltitude - 2 > playerFlightControls.GetDynamicAlt() || playerFlightControls.GetDynamicAlt() > playerFlyingComponent.desireAltitude + 2)
        {
            SetAltitudeLiquid();
        }
    }
Exemple #5
0
    // Update is called once per frame
    void Update()
    {
        // the altitude fluctuates too much, check within a range
        if (playerFlyingComponent.desireAltitude - 2 > playerFlyingComponent.currentAltitude || playerFlyingComponent.currentAltitude > playerFlyingComponent.desireAltitude + 2)
        {
            altSlider.value = playerFlightControls.GetDynamicAlt();
            //altText.text = Mathf.RoundToInt(playerFlyingComponent.currentAltitude) + " m";
        }

        // only change arrow when altitude first changes
        if (prevAltitude != playerFlightControls.currentAltSetting)
        {
            altitudeArrow.transform.localPosition = sliderPresets[(int)playerFlightControls.currentAltSetting];
            prevAltitude = playerFlightControls.currentAltSetting;
        }
    }
Exemple #6
0
 public void CheckForAltChange()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if ((int)currentAltSetting < (int)EAlts.High)
         {
             currentAltSetting += 1;
         }
     }
     else if (Input.GetMouseButtonDown(1))
     {
         if ((int)currentAltSetting > (int)EAlts.Low)
         {
             currentAltSetting -= 1;
         }
     }
     autoPilot.desiredAlt = (presetAlts[(int)currentAltSetting]);
 }
 // Update is called once per frame
 void Update()
 {
     if (intialSet)
     {
         SetAAGunDisplay(prevAlt);
         intialSet = false;
     }
     if (prevAlt != playerControlls.currentAltSetting)
     {
         SetAAGunDisplay(playerControlls.currentAltSetting);
         prevAlt = playerControlls.currentAltSetting;
     }
     if (prevGunStatus != AAgunWithinRange())
     {
         //Debug.Log("AA guns");
         dangerSign.GetComponent <SignBlink>().Blink(AAgunWithinRange());
         prevGunStatus = AAgunWithinRange();
     }
 }
Exemple #8
0
    // Start is called before the first frame update
    void Start()
    {
        playerFlyingComponent = this.GetComponent <Flying>();
        playerFlightControls  = this.GetComponentInChildren <PlayerFlightControls>();

        // set max for alt meter
        // set min for alt meter
        //altSlider.maxValue = playerFlightControls.presetAlts[playerFlightControls.presetAlts.Length - 1];
        //altSlider.minValue = playerFlightControls.presetAlts[0];

        prevAltitude = playerFlightControls.currentAltSetting;
        prevAlt      = normalizingNum;

        // set current alt on meter
        SetBulb(prevAltitude);
        // altSlider.value = playerFlightControls.GetDynamicAlt();

        maxAlt           = playerFlightControls.presetAlts[playerFlightControls.presetAlts.Length - 1];
        minAlt           = playerFlightControls.presetAlts[0];
        heightDifference = Mathf.Abs(Mathf.Abs(maxAlt) - Mathf.Abs(minAlt));
    }
Exemple #9
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // change in alt
        if (player.GetChild(0).gameObject.active)
        {
            if (player.GetComponentInChildren <PlayerFlightControls>().currentAltSetting != prevAlt)
            {
                UpdateCloudBoxDensity((int)player.GetComponentInChildren <PlayerFlightControls>().currentAltSetting);
                prevAlt = player.GetComponentInChildren <PlayerFlightControls>().currentAltSetting;
            }

            // change in speed
            if (player.GetComponentInChildren <PlayerFlightControls>().currentSpeedSetting != prevSpeed)
            {
                // figure out how to smooth this!
                UpdateCloudBoxSpeed((int)player.GetComponentInChildren <PlayerFlightControls>().currentSpeedSetting);
                //UpdateSpeed(speeds[(int)player.GetComponentInChildren<PlayerFlightControls>().currentSpeedSetting]);
                prevSpeed = player.GetComponentInChildren <PlayerFlightControls>().currentSpeedSetting;
            }
        }
    }
Exemple #10
0
 private void SetBulb(EAlts index)
 {
     altitudeBulbs[(int)prevAltitude].GetComponent <MeshRenderer>().material = bulbColors[0];
     // lerp, do a little flicker
     altitudeBulbs[(int)index].GetComponent <MeshRenderer>().material = bulbColors[1];
 }
Exemple #11
0
 // Start is called before the first frame update
 void Start()
 {
     prevAlt = playerControlls.currentAltSetting;
     //SetAAGunDisplay(prevAlt);
 }