Beispiel #1
0
    void PopulateSlidersText()
    {
        for (int i = 0; i < sliders.Length; i++)
        {
            for (int j = 0; j < TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj.Count; j++)
            {
                if (sliders[i].GetComponent <GameSlider>() != null)
                {
                    if (sliders[i].GetComponent <GameSlider>().type.ToString() == TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj[j].name)
                    {
                        if (sliders[i].GetComponent <GameSlider>().slider_type == SLIDER_TYPE.DROP_SPEED)
                        {
                            sliderValue[i].text = TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj[j].objectProperties.dropSpeed.ToString();
                        }
                        else if (sliders[i].GetComponent <GameSlider>().slider_type == SLIDER_TYPE.DAMAGE)
                        {
                            sliderValue[i].text = TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj[j].objectProperties.damage.ToString();
                        }
                    }
                }
            }
        }

        for (int i = 0; i < SliderManager.Instance.adminSliders.Count; i++)
        {
            AdminSlider adminSlider = SliderManager.Instance.adminSliders[i];
            float       val         = TrinaxHelperMethods.RoundDecimal(TrinaxManager.trinaxAudioManager.audioSettings[i].slider.value, 1);
            adminSlider.sliderValText.text = val.ToString();
        }
    }
Beispiel #2
0
    public void LerpScale(float dist)
    {
        float distanceApart = dist;

        float lerp = TrinaxHelperMethods.mapValue(distanceApart, 0, 18, 1f, 0f);

        transform.localScale = Vector3.Lerp(Vector3.zero, new Vector3(1, 0.4f, 0), lerp);
    }
Beispiel #3
0
    void UpdateSaveValues()
    {
        GlobalSettings globalSettings = new GlobalSettings
        {
            IP           = inputFields[(int)FIELD_ID.SERVER_IP].text.Trim(),
            idleInterval = float.Parse(inputFields[(int)FIELD_ID.IDLE_INTERVAL].text),

            useServer     = toggles[(int)TOGGLE_ID.USE_SERVER].isOn,
            useMocky      = toggles[(int)TOGGLE_ID.USE_MOCKY].isOn,
            useKeyboard   = toggles[(int)TOGGLE_ID.USE_KEYBOARD].isOn,
            muteAllSounds = toggles[(int)TOGGLE_ID.MUTE_SOUND].isOn,
        };

        // loop through all the gameobject types in the game
        for (int i = 0; i < TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj.Count; i++)
        {
            TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj[i] = UpdateSavedGameObjects(TrinaxGlobal.Instance.gameSettings.GameObjs.GameObj[i].name);
        }

        float firstAidVal;

        firstAidVal = TrinaxHelperMethods.RoundToNearestMidPoint(float.Parse(inputFields[(int)FIELD_ID.FIRSTAID_RECOVER].text), 2);
        inputFields[(int)FIELD_ID.FIRSTAID_RECOVER].text = firstAidVal.ToString();

        GameSettings gameSettings = new GameSettings
        {
            //gameDuration = int.Parse(inputFields[(int)FIELD_ID.GAME_DURATION].text),
            spawnInterval   = float.Parse(inputFields[(int)FIELD_ID.SPAWN_INTERVAL].text),
            minPowerupSpawn = float.Parse(inputFields[(int)FIELD_ID.MIN_POWERUP_SPAWN].text),
            maxPowerupSpawn = float.Parse(inputFields[(int)FIELD_ID.MAX_POWERUP_SPAWN].text),

            pointsPerObject            = int.Parse(inputFields[(int)FIELD_ID.POINTS_PER_OBJECT].text),
            xpPerObject                = int.Parse(inputFields[(int)FIELD_ID.XP_PER_OBJECT].text),
            xpPerObjectMultipler       = float.Parse(inputFields[(int)FIELD_ID.XP_PER_OBJECT_MULTIPLER].text),
            MAX_XP_REQUIRED_PER_BONUS  = int.Parse(inputFields[(int)FIELD_ID.MAX_XP_REQUIRED_PER_BONUS].text),
            timeToActivateNextPattern  = float.Parse(inputFields[(int)FIELD_ID.PATTERN_INTERVAL].text),
            DifficultyIncreaseInterval = float.Parse(inputFields[(int)FIELD_ID.DIFFICULTY_INCREASE_INTERVAL].text),
            probabilityScale           = int.Parse(inputFields[(int)FIELD_ID.PROBABILITY_SCALE].text),
            firstAidRecover            = firstAidVal,
            pointsPerCoin              = int.Parse(inputFields[(int)FIELD_ID.POINTS_PER_COIN].text),
            coinFallSpeed              = float.Parse(inputFields[(int)FIELD_ID.COIN_FALL_SPEED].text),
            invunerableDuration        = int.Parse(inputFields[(int)FIELD_ID.INVUNERABLE_DURATION].text),
            umbrellaProbabilityChance  = float.Parse(inputFields[(int)FIELD_ID.UMBRELLA_CHANCE].text),

            GameObjs = TrinaxGlobal.Instance.gameSettings.GameObjs,
        };

        KinectSettings kinectSettings = new KinectSettings
        {
            minUserDistance      = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.KINECT_MIN_USER_DISTANCE].value, 1),
            maxUserDistance      = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.KINECT_MAX_USER_DISTANCE].value, 1),
            maxLeftRightDistance = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.KINECT_RIGHTLEFT_USER_DISTANCE].value, 1),
        };

        TrinaxGlobal.Instance.globalSettings = globalSettings;
        TrinaxGlobal.Instance.gameSettings   = gameSettings;
        TrinaxGlobal.Instance.kinectSettings = kinectSettings;
    }
Beispiel #4
0
 IEnumerator DispatchConnectionLost()
 {
     connectionLostPanel.Show();
     if (TrinaxGlobal.Instance.scene != SCENE.MAIN)
     {
         TrinaxHelperMethods.ChangeLevel(SCENE.MAIN, null);
     }
     yield return(null);
 }
Beispiel #5
0
    private void Update()
    {
        if (!isReady)
        {
            return;
        }

        if (aP != null && aP.gameObject.activeSelf)
        {
            if (Input.GetKeyDown(KeyCode.F5))
            {
                Debug.Log("Going back to scene 0");
                TrinaxHelperMethods.ChangeLevel((int)SCENE.MAIN, () =>
                {
                    TrinaxManager.trinaxCanvas.adminPanel.gameObject.SetActive(false);
                });
            }
        }

        if (Input.GetKeyDown(KeyCode.F11))
        {
            //hideText = !hideText;
            //TrinaxCanvas.Instance.HideDebugText(hideText);
            Cursor.visible = !Cursor.visible;
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            TrinaxGlobal.Instance.IsAppPaused = !TrinaxGlobal.Instance.IsAppPaused;
        }

        if (TrinaxGlobal.Instance.IsAppPaused)
        {
            Time.timeScale = 0;
        }
        else
        {
            Time.timeScale = 1;
        }
    }
Beispiel #6
0
 public virtual void OnValueChanged(Slider slider)
 {
     val = TrinaxHelperMethods.RoundDecimal(slider.value, 1);
     sliderValText.text = val.ToString();
 }
Beispiel #7
0
    GameObj UpdateSavedGameObjects(string type)
    {
        ObjectProperties properties = new ObjectProperties {
        };
        GameObj obj = new GameObj {
        };

        if (type == FALLING_TYPES.Banana.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.BANANA_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.BANANA_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        else if (type == FALLING_TYPES.Slipper.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.SLIPPER_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.SLIPPER_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        else if (type == FALLING_TYPES.Sock.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.SOCK_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.SOCK_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        else if (type == FALLING_TYPES.Bottle.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.BOTTLE_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.BOTTLE_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        else if (type == FALLING_TYPES.Flowerpot.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.FLOWER_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.FLOWERPOT_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        else if (type == FALLING_TYPES.Newspaper.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.NEWSPAPER_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.NEWSPAPER_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        else if (type == FALLING_TYPES.Microwave.ToString())
        {
            properties.dropSpeed = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.MICROWAVE_DROP_SPEED].value, 1);
            properties.damage    = TrinaxHelperMethods.RoundDecimal(sliders[(int)SLIDER_ID.MICROWAVE_DAMAGE].value, 1);
            obj.name             = type;
            obj.objectProperties = properties;
            return(obj);
        }
        return(obj);
    }