/// <summary>Connect camera to slider.</summary> private void Awake() { // Make sure the given near and far distances are valid, skipping setup if not. if (!VerifyRange()) { return; } // Get required SliderController for getting input from UI Slider. SliderController = GetComponent <SliderController>(); // Make sure that given start distance is within range of given near and far distances. if (StartDistance < NearDistance || StartDistance > FarDistance) { Debug.LogError(ExampleErrors .OutsideRange(this, StartDistance, "Start Distance", NearDistance, FarDistance)); StartDistance = Mathf.Clamp(StartDistance, NearDistance, FarDistance); } // Convert start distance to a percent of near and far distances, and adjust slider to this // value. float sliderFraction = (StartDistance - NearDistance) / (FarDistance - NearDistance); OnSlider(sliderFraction); // Set slider's starting value, and only after have done so, connect future changes in slider // input to zooming in and out. SliderController.SetStartingValue(sliderFraction); SliderController.OnChange += OnSlider; }
void Awake() { health = maxHealth; energy = maxEnergy; healthSlider = FindObjectOfType <Health>(); energySlider = FindObjectOfType <Energy>(); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); pretzelController = pretzels.GetComponent <SliderController>(); pretzelList = new List <GameObject>(); gameController = game.GetComponent <SliderController>(); }
void Start() { canvas = GameObject.FindGameObjectWithTag(Tags.Canvas); connectedButton = GetComponent <UnityEngine.UI.Button>(); switch (button) { case MainMenuButtons.New: connectedButton.onClick.AddListener(() => canvas.GetComponent <MainMenuUI>().NewMapBtn_click()); break; case MainMenuButtons.Load: connectedButton.onClick.AddListener(() => canvas.GetComponent <MainMenuUI>().LoadMapBtn_Click()); break; case MainMenuButtons.Exit: connectedButton.onClick.AddListener(() => canvas.GetComponent <MainMenuUI>().Exit_click()); break; case MainMenuButtons.Back: connectedButton.onClick.AddListener(() => canvas.GetComponent <MainMenuUI>().ToMainMenu_Click()); break; case MainMenuButtons.Create: sliderC = canvas.GetComponentInChildren <SliderController>(); connectedButton.onClick.AddListener(() => canvas.GetComponent <MainMenuUI>().CreateMapBtn_Click(sliderC.GetCurrentSpawnObject())); break; } }
void Start() { music = GetComponent <AudioStatusBase>(); sliderController = GetComponent <SliderController>(); sliderController.SetAction(ChangeMusic); sliderController.SetSaveKey(musicType.ToString() + "musicVolume"); }
// Use this for initialization void Start() { sliderController = handModels.GetComponent <SliderController>(); toggleController = handModels.GetComponent <ToggleController>(); leftPinch = leftPhysicsHand.GetComponent <GestureDetection>(); foreach (ExtendedFingerDetector detector in leftHand.GetComponents <ExtendedFingerDetector>()) { if (detector.Focus == "Slider") { leftSlider = detector; } else if (detector.Focus == "Buttons") { leftButton = detector; } } rightPinch = rightPhysicsHand.GetComponent <GestureDetection>(); foreach (ExtendedFingerDetector detector in rightHand.GetComponents <ExtendedFingerDetector>()) { if (detector.Focus == "Slider") { rightSlider = detector; } else if (detector.Focus == "Buttons") { rightButton = detector; } } }
// public Action protected override void Awake() { base.Awake(); sliderController = inventoryBuildingController.GetComponent <SliderController>(); sliderController.production.maxValue = productionTime; sliderController.burning.maxValue = burnFuelTime; }
public SliderAndButtonApiControllerTest() { _mockButtonService = new Mock <IButtonService <ButtonDto> >(); _mockSliderService = new Mock <ISliderService <SliderDto> >(); _sliderController = new SliderController(_mockSliderService.Object); _buttonController = new ButtonController(_mockButtonService.Object); Buttons = new List <ButtonDto>() { new ButtonDto { Id = 1 }, new ButtonDto { Id = 2 } }; Sliders = new List <SliderDto>() { new SliderDto { Id = 1 }, new SliderDto { Id = 2 } }; }
public void StartSolvePothole(int workerCount) { this.status = PotholeStatus.InProgress; this.assignedWorkers = workerCount; potholeManager.StartRepairPothole(this, workerCount); sliderController = GetComponentInChildren <SliderController>(); }
private void Awake() { button = GetComponentInChildren <Button>(); slider = GetComponentInChildren <Slider>(); sc = GetComponentInChildren <SliderController>(); text.enabled = false; }
// Use this for initialization void Start() { rigid = gameObject.GetComponent <Rigidbody>(); playerCol = GetComponentInChildren <PlayerCollider>(); sliderCtrl = GameObject.FindGameObjectWithTag("GameCtrl").GetComponent <SliderController>(); jumpSE = GameObject.FindGameObjectWithTag("GameCtrl").GetComponent <AudioSource>(); roboAni = GetComponent <Animator>(); }
virtual protected void Start() { orders = new List <GameObject>(); // Store current orders isMakeWhite = isMakeBlack = false; initialPos = GameManager.instance.GetInitialPosition(); sliderController = GameManager.instance.GetSliderController(); // Game Starts CreateOrder(); }
private void Start() { slider = GetComponent <Slider>(); sliderController = GetComponent <SliderController>(); isTickingDown = false; originalColor = slider.transform.GetChild(1).GetChild(0).GetComponent <Image>().color; }
public void Setup() { _mapPathProvider = Substitute.For <IProvideServerMapPath>(); _repo = Substitute.For <IRepository>(); _context = new InMemoryDataContext(); _repo.Context.Returns(_context); _controller = new SliderController(_repo, _mapPathProvider); _imageViewModel = new ImageViewModel(); _imageUpload = Substitute.For <HttpPostedFileBase>(); }
private void InitSingleton() { if (instance != null && instance != this) { Destroy(gameObject); } else { instance = this; } }
public void FillRepeater() { try { rptMedia.DataSource = SliderController.GetItems(Int32.Parse(_AlbumID), Int32.Parse(_MaxResults.ToString()), Int32.Parse(_ModuleID.ToString())); rptMedia.DataBind(); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
private void SpawnTextAndUpdateSlider() { SliderController sliderController = FindObjectOfType <SliderController>(); sliderController.SetAmount(kinematicBubbleManager.GetAmount()); var canvas = Instantiate(textCanvas, transform.position, Quaternion.identity); TextMeshPro text = canvas.GetComponentInChildren <TextMeshPro>(); //kinematicBubbleManager.GetAmount().ToString() TextCanvasController textCanvasController = canvas.GetComponent <TextCanvasController>(); textCanvasController.SetTextValue(kinematicBubbleManager.GetAmount()); }
// Start is called before the first frame update void Start() { fallMultiplier = 1.2f; lowJumpFallMultiplier = 1.1f; playerSpeed = 150f; _renderer = GetComponentInParent <SpriteRenderer>(); _animator = GetComponentInParent <Animator>(); Health = 100; IsHurt = false; _healthBarController = HealthBar.GetComponent <SliderController>(); _healthBarController.Set(Health); }
void Start() { GameObject hs = GameObject.FindGameObjectWithTag("HighScore"); if (hs == null) { Debug.Log("Game controller not found!"); } else { highScore = hs.GetComponent <HighScore>(); } GameObject camera = GameObject.FindGameObjectWithTag("MainCamera"); if (camera == null) { Debug.Log("Camera not found!"); } else { cameraTransform = camera.GetComponent <Transform>(); } GameObject game = GameObject.FindGameObjectWithTag("GameController"); if (game == null) { Debug.Log("Game not found!"); } else { lanes = game.GetComponent <GameController>().lanes; } GameObject slider = GameObject.FindGameObjectWithTag("Slider"); if (slider == null) { Debug.Log("Slider not found!"); } else { sliderController = slider.GetComponent <SliderController>(); } LevelUpImage.enabled = false; UpdateTransforms(); StartCoroutine(MoveSounds()); }
public void FillDropdown() { try { DotNetNuke.Entities.Modules.ModuleController mc = new ModuleController(); ArrayList existMods = mc.GetModulesByDefinition(this.PortalId, "BizModules - UltraPhotoGallery"); int i = 0; foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods) { if (!mi.IsDeleted) { // get module title //mi.ModuleTitle; // additionally, you can find out what tab it is on //mi.TabID; //mi.ModuleID; cboModuleTabId.Items.Insert(i, new ListItem(mi.ModuleTitle.ToString(), mi.ModuleID.ToString())); } } ArrayList existTabs = mc.GetModulesByDefinition(this.PortalId, "BizModules - UltraPhotoGallery"); int ii = 0; foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods) { if (!mi.IsDeleted) { // get module title //mi.ModuleTitle; // additionally, you can find out what tab it is on //mi.TabID; //mi.ModuleID; cboTabId.Items.Insert(ii, new ListItem(mi.ModuleTitle.ToString(), mi.TabID.ToString())); } } ddlAlbum.DataSource = SliderController.GetAlbums(this.PortalId); ddlAlbum.DataTextField = "Title"; ddlAlbum.DataValueField = "ItemID"; ddlAlbum.DataBind(); ddlAlbum.Items.Insert(0, new ListItem("-- Please Select --", "0")); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
// Start is called before the first frame update void Awake() { sliderController = GameObject.Find("UI").GetComponentInChildren <SliderController>(); if (levelInstance != null && levelInstance != this) { Destroy(this.gameObject); } else { levelInstance = this; } LoadStage(currentStage); }
public void Reset() { StopAllCoroutines(); player = GameObject.FindObjectOfType <PlayerController>(); status = GameObject.FindObjectOfType <SliderController>(); clock = GameObject.FindObjectOfType <ClockManager>(); SetupActions(); if (actions.Count > 0) { StartCoroutine(UpdateInteractions()); } }
void Awake() { startingPosition = transform.position; daysRemaining = GameObject.Find("RemainingDays").GetComponent <DayCounterScript>(); eventSystem = GameObject.Find("EventSystem"); mplayer = GameObject.Find("PersistentDataObject").GetComponent <MusicPlayer>(); clock = GameObject.Find("Clock").GetComponent <ClockManager>(); pointer = GetComponent <SliderController>(); animator = GetComponent <Animator>(); gameManager = FindObjectOfType <GameManager>(); dialogController.gameObject.SetActive(true); playerOrientation = PlayerOrientation.Down; screenFader = GameObject.Find("Fader").GetComponent <ScreenFader>(); isForceSleeping = (PlayerPrefs.GetInt(Constants.Prefs.FORCE_SLEEPING, Constants.Prefs.Defaults.FORCE_SLEEPING) == 1); bool hasSavedGame = (PlayerPrefs.GetFloat(Constants.Prefs.GAME_TIME, Constants.Prefs.Defaults.GAME_TIME) > 0); if (hasSavedGame) { LoadPlayerData(); } bool hasChangedFloor = PlayerPrefs.GetInt(Constants.Prefs.CHANGING_FLOOR, Constants.Prefs.Defaults.CHANGING_FLOOR) == 1; if (isForceSleeping) { gameManager.Reset(); daysRemaining.ShowRemainingDays(); StartCoroutine(DisplayDailyMessage()); isForceSleeping = false; PlayerPrefs.SetInt(Constants.Prefs.FORCE_SLEEPING, Constants.Prefs.Defaults.FORCE_SLEEPING); SavePlayerData(); } else if (hasChangedFloor) { mplayer.StopLoopedFootsteps(); transform.position = new Vector3(-0.86f, 3.88f, 0f); playerOrientation = PlayerOrientation.Right; PlayerPrefs.SetInt(Constants.Prefs.CHANGING_FLOOR, Constants.Prefs.Defaults.CHANGING_FLOOR); SavePlayerData(); } UpdatePlayerAnimation(playerOrientation, false); }
void Start() { slider = FindObjectOfType <SliderController>(); slider.Text = "Interval: "; draw = FindObjectOfType <DrawTargetView>(); context = this.DefaultInputContext(); context.GetObservable(0).OnBegin.TimeInterval().Subscribe(ts => { Debug.Log($"[{ts.Value.sequenceId}] {ts.Interval.Milliseconds}"); }).AddTo(this); slider.Enabled.Subscribe(v => { if (!v) { clear(); } else { setup(); } }).AddTo(this); slider.Value.Subscribe(v => setup()).AddTo(this); }
public void Reset() { StopAllCoroutines(); player = GameObject.FindObjectOfType<PlayerController>(); status = GameObject.FindObjectOfType<SliderController>(); clock = GameObject.FindObjectOfType<ClockManager>(); SetupActions(); if(actions.Count > 0) { StartCoroutine(UpdateInteractions()); } }
// Start is called before the first frame update void Start() { SliderControl = new SliderController(SliderObject, TextSliderObject, CurrentHP, MinHP, MaxHP); //SliderControl.OnStart(); }
void Start() { sliderController = GetComponent <SliderController>(); sliderController.SetAction(ChangeMusic); sliderController.SetSaveKey(MusicEnum.bgm.ToString() + "musicVolume"); }
public void ShieldSetUp(SliderController coolDownSlider) { _isShieldActivated = false; _lastShieldSpawnTime = Time.time; _shieldCooldownSlider = coolDownSlider; }
public void ShieldSetUp(SliderController coolDownSlider) { throw new System.NotImplementedException(); }
void Start() { rigidbody = GetComponent <Rigidbody>(); sliderController = slider.GetComponent <SliderController>(); cameraTransform = camera.GetComponent <Transform>(); }
/// <summary> /// Setup required <see cref="UnityEngine.Light"/> and all values needed to use it as a sun and/or /// moon. /// </summary> /// <remarks> /// This flag is used to allow this script to be setup early if needed (e.g. if another class /// needs to interact with it before this script's Start function is called. /// </remarks> private void TrySetup() { // Skip if this script has already been setup. if (IsSetup) { return; } // Verify all required parameters are defined and correctly setup, skipping any further setup if // any parameter is missing or invalid. if (!VerifyParameters()) { return; } // Get required SliderController for getting input from UI Slider. SliderController = GetComponent <SliderController>(); // Connect changes in Slider input to changing sun/moon. SliderController.OnChange += Set; // Record the y-angle of the light as the azimuth of the sun/moon, i.e. what direction it is in // parallel to the ground. Azimuth = Light.transform.eulerAngles.y; // Convert given time values of sunrise/sunset into points between 0f and 1f. SunriseDark = Sunrise / 24f; // Calculate the most vivid point of sunrise. float vividToDarkInterval = VividToDark / 24f; SunriseVivid = SunriseDark + vividToDarkInterval; // Calculate point when light is most vivid. SunsetDark = Sunset / 24f + 0.5f; SunsetVivid = SunsetDark - vividToDarkInterval; // Calculate midpoints between sunrise and sunset, when sun and moon are at their fullest. FullSun = (SunriseDark + SunsetDark) / 2f; FullMoon = FullSun + 0.5f; FullMoonAfterMidnight = FullMoon > 1f; if (FullMoonAfterMidnight) { FullMoon %= 1f; FullMoonLower = FullMoon; } else { FullMoonLower = FullMoon - 1f; } // Calculate total night time. NightTotal = SunriseDark + (1f - SunsetDark); // Setup the ambient light to use a color, specifically the Darkest Color. This Darkest Color is // not actually used to color the darkest points of the sun/moon light's cycle, specifically the // points when the sun and moon drop below the horizon. This is because, when the sun/moon light // drops below the horizon, if the light has any color at all it will sharply cut off as it // drops beneath the ground plane. As such, at these points the sun/moon light fades to a black // (no light) color, while the ambient light fades in with the Darkest Color. RenderSettings.ambientMode = AmbientMode.Flat; // Make sure fog is enabled, as this will be colored based on the changing light colors. RenderSettings.fog = true; RenderSettings.fogMode = FogMode.Linear; RenderSettings.fogStartDistance = FogStart; RenderSettings.fogEndDistance = FogEnd; // Setup the main Camera to work with a procedural Skybox, so we can adjust the sky based on // the time of day/night. Also extend Camera's far clipping plane so that the ground can // seamlessly merge from Fog to Skybox. MainCamera = Camera.main; MainCamera.clearFlags = CameraClearFlags.Skybox; MainCamera.farClipPlane = RenderDistance; Skybox skybox = MainCamera.gameObject.GetComponent <Skybox>(); if (skybox == null) { skybox = MainCamera.gameObject.AddComponent <Skybox>(); } Sky = skybox.material; if (Sky == null) { Sky = new Material(Shader.Find("Skybox/Procedural")); skybox.material = Sky; } Sky.SetFloat("_SunSize", SunSize); Sky.SetFloat("_Exposure", SkyExposure); Sky.SetColor("_SkyTint", SkyTint); // Calculate the ambient light color/value during midday and half light. At night the Darkest // Color is used (the reason why is explained above). DayAmbient = DayColor * DayAmbientParent; HalfLightAmbient = HalfLightColor * HalfLightAmbientParent; // Flag that this script has now been setup and apply starting value. IsSetup = true; Set(Value); }
void Awake() { SliderController = GetComponent<SliderController>(); skinnedMeshRenderer = Vessel.GetComponent<SkinnedMeshRenderer>(); meshCollider = Vessel.GetComponent<MeshCollider>(); }
void Awake() { startingPosition = transform.position; daysRemaining = GameObject.Find("RemainingDays").GetComponent<DayCounterScript>(); eventSystem = GameObject.Find("EventSystem"); mplayer = GameObject.Find("PersistentDataObject").GetComponent<MusicPlayer>(); clock = GameObject.Find("Clock").GetComponent<ClockManager>(); pointer = GetComponent<SliderController>(); animator = GetComponent<Animator>(); gameManager = FindObjectOfType<GameManager>(); dialogController.gameObject.SetActive(true); playerOrientation = PlayerOrientation.Down; screenFader = GameObject.Find("Fader").GetComponent<ScreenFader>(); isForceSleeping = (PlayerPrefs.GetInt(Constants.Prefs.FORCE_SLEEPING, Constants.Prefs.Defaults.FORCE_SLEEPING) == 1); bool hasSavedGame = (PlayerPrefs.GetFloat(Constants.Prefs.GAME_TIME, Constants.Prefs.Defaults.GAME_TIME) > 0); if(hasSavedGame) { LoadPlayerData(); } bool hasChangedFloor = PlayerPrefs.GetInt(Constants.Prefs.CHANGING_FLOOR, Constants.Prefs.Defaults.CHANGING_FLOOR) == 1; if(isForceSleeping) { gameManager.Reset(); daysRemaining.ShowRemainingDays(); StartCoroutine(DisplayDailyMessage()); isForceSleeping = false; PlayerPrefs.SetInt(Constants.Prefs.FORCE_SLEEPING, Constants.Prefs.Defaults.FORCE_SLEEPING); SavePlayerData(); } else if (hasChangedFloor) { mplayer.StopLoopedFootsteps(); transform.position = new Vector3(-0.86f, 3.88f, 0f); playerOrientation = PlayerOrientation.Right; PlayerPrefs.SetInt(Constants.Prefs.CHANGING_FLOOR, Constants.Prefs.Defaults.CHANGING_FLOOR); SavePlayerData(); } UpdatePlayerAnimation(playerOrientation, false); }