public void SetText(string text) //Change the text of the button { if (this.text) { this.text.gameObject.GetComponent <Text>().text = text; } }
void Awake() { positionDamper = new Vector3Damper(transform.position, .1f); fader = gameObject.AddComponent <ColorFader>(); fader.fullColor = new Color(1f, 1f, 1f, .3f); fader.forceFullColor = true; }
void Awake() { scaleDamper = new Vector3Damper(Vector3.one, .1f); fader = GetComponent <ColorFader>(); light = GetComponent <Light>(); SetShit(0); }
public override void Start() { base.Start(); maxSpeed *= 1.6f; acceleration *= 1.6f; fader = gameObject.AddComponent <ColorFader>(); fader.colorString = "_EmissionColor"; fader.fullColor = Color.black; }
protected CustomButton ignoredButton; //A button that is ignored when changes are applied protected virtual void Awake() { CustomButton[] allButtons = GetComponentsInChildren <CustomButton>(); foreach (CustomButton cb in allButtons) { if (cb != entryButton) //If the Custom button isn't the entry button { if (cb.GetComponentInParent <ShopCategory>() == null) //If it's not part of a shop category { menuButtons.Add(cb); //Add it to the menu buttons list } else //If it is if (GetComponent <ShopItem>() != null) //If the parent is a shop item { menuButtons.Add(cb); //Add it to the menu buttons list } } } ColorFader[] allColorFaders = GetComponentsInChildren <ColorFader>(); foreach (ColorFader cf in allColorFaders) { if (cf.transform.name.ToLower().Contains("backdrop")) //If it's the backdrop { backdrop = cf; } if (cf != backdrop) //If the color fader script isn't the backdrop's { if (cf.GetComponentInParent <CustomButton>() == null) //If it doesn't belong to a custom button { if (cf.GetComponentInParent <ShopCategory>() == null) { otherComponents.Add(cf); //Add it to the other components list } else if (GetComponent <ShopItem>() != null) //If the parent is a shop item { otherComponents.Add(cf); //Add it to the other components list } } } } //Find the blocking panel Image[] allImages = GetComponentsInChildren <Image>(); foreach (Image img in allImages) { if (img.transform.name.ToLower().Contains("blocking")) //If the transform name includes "blocking" { blockingPanel = img; //Assume it's the blocking panel } } }
private void FadeTimerColor(FadeItem init, FadeItem dest) { var current = new FadeItem() { Time = this.CurrentTime, Color = this.TimerColor }; ////this.TimerColor = ColorFader.Linear(init, dest, current); this.TimerColor = ColorFader.BoundedExponential(init, dest, current); }
void Awake() { //Get references Image[] images = GetComponentsInChildren <Image>(); text = GetComponentInChildren <Text>().gameObject.GetComponent <ColorFader>(); button = GetComponent <Button>(); thisColorFader = GetComponent <ColorFader>(); lines = GetComponent <ColorFaderArray>(); }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } //Get reference to black background blackBackground = GetComponentInChildren <ColorFader>(); }
private void Initialize(Image image, bool hide, float duration) { this.image = image; go = image.gameObject; af = go.GetComponent <ColorFader>(); initColor = image.color; this.default_duration = duration; if (hide) { ClearColor(); } }
void Start() { //Get the world-space canvas worldSpaceCanvas = GameObject.FindGameObjectWithTag("WorldSpaceCanvas"); //Instantiate the loading slider GameObject slider = Instantiate(Resources.Load("Prefabs/Stage/SlidingInfoBar", typeof(GameObject)), (Vector2)transform.position + offset, Quaternion.identity, worldSpaceCanvas.transform) as GameObject; this.slider = slider.GetComponent <SmoothSlider>(); sliderColorFader = slider.GetComponent <ColorFader>(); this.slider.StartAnimation(0, 0); //Set the progress slider to 0% StartCoroutine(updateTimer(colorChangeTime)); //Start the update timer }
void Start() { nameText = transform.Find(TEXT_NAME).GetComponent <ColorFader>(); //Get the name text ShopItem[] temp = GetComponentsInChildren <ShopItem>(); //Get all shop items in the children nameText.FadeOut(0); //Hide the name text //Get the shop items items = new List <ShopItem>(); foreach (ShopItem itm in temp) { items.Add(itm); } }
private IEnumerator SpawnSwarmElements() { Vector3 origin = this.transform.position; Vector3[] relativePositions = new Vector3[numOfSwarm]; for (int i = 0; i < numOfSwarm; i++) { float xValue = Random.Range(minX, maxX); float yValue = Random.Range(minY, maxY); float zValue = Random.Range(minZ, maxZ); Vector3 relativePos = new Vector3(xValue, yValue, zValue); relativePositions[i] = relativePos; } // Sorts by ascending distance from origin System.Array.Sort(relativePositions, new MagnitudeComparer()); // Determines the max distance from origin float maxMagnitude = relativePositions[numOfSwarm - 1].magnitude; // Calculates the growth of the spawn circle radius per second float spawnRadiusGrowthRate = maxMagnitude / spawnDuration; float spawnRadius = 0; int index = 0; while (index < numOfSwarm - 1) { spawnRadius += spawnRadiusGrowthRate * Time.deltaTime; while (relativePositions[index].magnitude <= spawnRadius && index < numOfSwarm) { Vector3 randomPos = relativePositions[index++] + origin; GameObject particle = Instantiate(upDownPrefabColor, randomPos, Quaternion.identity /*, transform*/); //Debug.Log(new Vector3(xValue, yValue, zValue)); particle.transform.parent = this.transform; particle.transform.position = randomPos; ColorFader fader = particle.GetComponent <ColorFader>(); StartCoroutine(fader.FadeIn()); //Debug.Log(particle.transform.position); } yield return(spawnRadius); } }
void FadeOutPanelHolder() { Debug.Log("Starting fade out process!"); foreach (GameObject box in boxes) { ColorFader currentFader = box.GetComponent <ColorFader>(); if (currentFader) { StartCoroutine(currentFader.FadeOut()); Debug.Log("Fading out a DSPBox!"); } else { Debug.Log("Couldn't find that damn color fader on " + box.name); } } }
// Start is called before the first frame update void Start() { StereoRail_AudioManager.NewMeasureEvent += OnNewMeasure; StereoRail_AudioManager.StopSongEvent += FadeOutPanelHolder; foreach (GameObject box in boxes) { ColorFader currentFader = box.GetComponent <ColorFader>(); if (currentFader) { StartCoroutine(currentFader.FadeIn()); Debug.Log("fading in " + box.name); } else { Debug.Log("Couldn't find a way to fade in" + box.name); } } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } //Get references to components blockingPanel = transform.Find(BLOCKING_PANEL_NAME).GetComponent <Image>();; text = transform.Find("Text").GetComponent <ColorFader>(); image = transform.Find("Black Screen").GetComponent <ColorFader>(); }
private void CheckSonarPoint_Enter(GameObject target) { if (!target.CompareTag("Sonar")) { return; } ColorFader fader = target.GetComponent <ColorFader>(); if (fader == null) { return; } if (fader.SonarInside()) { return; } Debug.Log("CheckSonarPoint"); target.BroadcastMessage("OnSonarInside"); }
void Start() { CreatePlayers(disabledMaterial); timer = new CountdownTimer(countdownInSeconds); GameObjectFunctions.Find("player1", "ready").GetComponent<TextMesh>().text = "Start game"; fader = ColorFader.Create(GameObject.Find("camera").GetComponent<Camera>()); }
void Awake() { lineRenderer = GetComponent <LineRenderer>(); fader = gameObject.AddComponent <ColorFader>(); }
// Use this for initialization IEnumerator LoadingAllAssetsAsync() { LoadingPanel.SetActive(true); ColorFader cf = LoadingPanel.GetComponent <ColorFader>(); if (cf != null) { // cf.FadeIn(); } ProgressBar.fillAmount = 0; int loadingSteps = 4; //1 for loading the settings coockies, 2 for loading the shoping cart and list of products ,3 loading the tree, 4 for generating the tabs System.Net.ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true; System.Security.Cryptography.DESCryptoServiceProvider b = new System.Security.Cryptography.DESCryptoServiceProvider(); loadingSteps = 30; //to make it look good while loading the coockies and products ProgressBar.fillAmount = 1.0f * 1.0f / loadingSteps; if (PlayerPrefs.HasKey("user")) { string username = PlayerPrefs.GetString("user"); Debug.Log(username); } else { PlayerPrefs.SetString("user", "Vazric"); } // loading products ... ProgressBar.fillAmount = 2.0f * 1.0f / loadingSteps; //in this point we loaded the product loadingSteps = products.Length + 4; //loading the tree //get the size and set the position using size attribiyte of zPosSets DragItemszPos = SelectedTreeSize.GetAttribute <zPosSets>().DragItemZPos; int treesize = (int)SelectedTreeSize; // enabling the lights for 3 to 7ft , then 9 and 11fit , then 20ft Under9ftLightset.SetActive((treesize < 9)); Night9And11ftLightset.SetActive((treesize > 7 && treesize < 20)); Twenty20ftLightset.SetActive(treesize > 11); theTree.transform.position = new Vector3(theTree.transform.position.x, theTree.transform.position.y, SelectedTreeSize.GetAttribute <zPosSets>().TreeZPos); theTree.SetActive(false); //loading the tree prefab string treePrefabSRC = SelectedTreeType.GetAttribute <SourceURL>().GetURLForSize(SelectedTreeSize); Debug.Log(treePrefabSRC); var www = UnityWebRequestAssetBundle.GetAssetBundle(treePrefabSRC); yield return(www.Send()); if (www.isNetworkError) { if (!string.IsNullOrEmpty(www.error)) { ErrorPanel.SetActive(true); ErrorMessage.text = www.error + ". Please check your connection and try to reload the page again."; } Debug.LogError(www.error); yield break; } Debug.Log(www.downloadHandler.ToString()); var bundle = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle; www.Dispose(); var assetNames = bundle.GetAllAssetNames(); foreach (var c in assetNames) { Debug.Log(c); } // var objects = ; // GameObject test = (GameObject)bundle.LoadAsset("balsam_3ft.prefab"); GameObject myTree = Instantiate(bundle.mainAsset as GameObject); myTree.transform.SetParent(theTree.transform); myTree.transform.position = Vector3.zero; myTree.transform.localPosition = Vector3.zero; myTree.transform.localRotation = Quaternion.Euler((Vector3.zero)); myTree.transform.rotation = Quaternion.Euler(Vector3.zero); // myTree.GetComponent<MeshRenderer>().materials[0] = null; //myTree.GetComponent<MeshRenderer>().materials[0] = Resources.Load("Materials/balsamTree01") as Material; /* * Debug.Log("loading AssetBundle!"); * //var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "myassetBundle")); * WWW www = WWW.LoadFromCacheOrDownload(treePrefabSRC, 1); * yield return www; * AssetBundle bundle = www.assetBundle; * * // var t = bundle.LoadAllAssets(); * * GameObject test = (GameObject)bundle.LoadAsset("balsam_5ft"); * * Instantiate(test); * test.transform.SetParent(theTree.transform); * test.transform.position = Vector3.zero; */ //LoadTheTree(treePrefabSRC); ProgressBar.fillAmount = 2.0f * 1.0f / loadingSteps; for (int index = 0; index < products.Length; index++) { Debug.Log("Loading " + index.ToString()); yield return(products[index].LoadImage()); if (!string.IsNullOrEmpty(products[index].Error)) { ErrorPanel.SetActive(true); ErrorMessage.text = products[index].Error + ". Please check your connection and try to reload the page again."; } ProgressBar.fillAmount = (3.0f + index) * 1.0f / loadingSteps; } var type = typeof(ProductInfo.ProductType); var values = System.Enum.GetValues(typeof(ProductInfo.ProductType)).Cast <ProductInfo.ProductType>().Select(e => new { pType = e, pAttr = (ProductCategoryAttribute)(type.GetMember(e.ToString()).First().GetCustomAttributes(typeof(ProductCategoryAttribute), false)[0]), numOfProd = products.Count(p => p.productType == e) }).ToList(); categoryButtons.Clear(); ProgressBar.fillAmount = 1; foreach (var cat in values) { if (!cat.pAttr.isHidden) { GameObject button = (GameObject)Instantiate(buttonPrefab); button.name = "Cat_" + cat.pType.ToString(); button.transform.SetParent(buttonPanel.transform, false); //Setting button parent button.transform.GetChild(0).GetComponent <Text>().text = cat.pAttr.Description + " (" + cat.numOfProd.ToString() + ")"; //Changing text if (cat.numOfProd > 0) { categoryButtons.Add(button); button.GetComponent <Button>().onClick.AddListener(new UnityAction(delegate { ListItemsByType(cat.pType); })); } else { button.GetComponent <Button>().interactable = false; } } } Debug.Log("Loading complete!"); if (cf != null) { cf.FadeOut(); } else { LoadingPanel.SetActive(false); } theTree.SetActive(true); }