void updateScore(int addScore, Text txt) { score = score + new SafeInt(addScore); scoreText.text = "Score: " + score; txt.text = "+" + addScore; }
void Start() { if (PlayerPrefs.HasKey("muteM")) { if (PlayerPrefs.GetInt("muteM") == 1) { clickMusic(); } } if (PlayerPrefs.HasKey("muteS")) { if (PlayerPrefs.GetInt("muteS") == 1) { clickSound(); } } bonusMultiplier = new SafeInt(0); time = new SafeFloat(540); highlightSelected.transform.position = new Vector3(0, 0, -100); highlightViewed.transform.position = new Vector3(0, 0, -100); audioSource = GetComponent <AudioSource>(); newLevel(); }
void IStatsSetter.SaveRecordStars(SafeInt starsAmount) { if (starsAmount > playerStats.RecordCollectedStars) { playerStats.RecordCollectedStars = starsAmount; } }
void IStatsSetter.SaveRecordScoreMultiplier(SafeInt multiplierValue) { if (multiplierValue > playerStats.RecordScoreMultiplierValue) { playerStats.RecordScoreMultiplierValue = multiplierValue; } }
void updateScore(int addScore, GameObject bts) { addScore /= EasyModeStatic.easyMode; score = score + new SafeInt(addScore); scoreText.text = "Score: " + score; bts.GetComponent <TextPopUp>().assign("+" + addScore, Color.white, 18); }
void IStatsSetter.SaveRecordScore(SafeInt scoreAmount) { if (scoreAmount > playerStats.RecordEarnedScore) { playerStats.RecordEarnedScore = scoreAmount; OnNewScoreRecord?.Invoke(); } }
void IStatsSetter.SaveRecordLifeTime(SafeInt lifeTime) { playerStats.TotalLifeTime += lifeTime; if (lifeTime > playerStats.RecordLifeTime) { playerStats.RecordLifeTime = lifeTime; } }
void OnTriggerExit(Collider other) { if (other.tag == "Sunlight") { sunlight = new SafeInt(0); } else if (other.tag == "Shadow") { darkness = new SafeInt(0); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } SafeInt safeInt = (SafeInt)obj; return(this.defa133ffdss == safeInt.defa133ffdss && this.bcda1ktrees == safeInt.bcda1ktrees); }
public void Serialize(ref SafeInt data) { if (isReading) { data = _buffer.ReadInt32LE(); } else { _buffer.WriteInt32LE(data); } }
public static void GetVal(GetUserDataResult res, string key, ref SafeInt val) { if (res.Data == null || !res.Data.ContainsKey(key)) { Debug.Log("Have not " + key); } else { val = int.Parse(res.Data[key].Value); } }
/// <summary> /// Read array of SafeInt data from stream /// </summary> /// <returns>array of SafeInt</returns> public SafeInt[] ReadSafeIntArray() { int length = ReadInt(); SafeInt[] array = new SafeInt[length]; for (int i = 0; i < length; i++) { array[i] = ReadInt(); } return(array); }
private IEnumerator Start() { Debug.Log("My Secured Text: " + MySecuredText); while (Application.isPlaying) { // You can assig de type directly like you assing normally :) MySecuredInt = Random.Range(0, 100); yield return(new WaitForSeconds(2f)); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Sunlight") { darkness = new SafeInt(0); //if(w.isNightTime == false) sunlight = w.lightMax; if(!lightLevels.w.isNightTime) sunlight = lightLevels.w.lightMax; } else if (other.tag == "Shadow") { sunlight = new SafeInt(0); darkness = lightLevels.w.lightMax; } }
void OnTriggerStay(Collider other) { if (other.tag == "Sunlight") { darkness = new SafeInt(0); //if(w.isNightTime == false) sunlight = w.lightMax; sunlight = w.lightMax; } else if (other.tag == "Shadow") { sunlight = new SafeInt(0); darkness = w.lightMax; } }
/// <summary> /// Read data of given XmlElement as array of SafeInt /// </summary> /// <param name="e">XmlElement contains data</param> /// <returns>array of int</returns> public SafeInt[] ReadSafeIntArray(XmlElement e) { string lenghtStr = e.GetAttribute("Lenght"); int length = 0; if (!int.TryParse(lenghtStr, out length)) { length = 0; } SafeInt[] array = new SafeInt[length]; XmlElement element = e.FirstChild as XmlElement; int index = 0; while (element != null) { array[index++] = ReadInt(element); element = e.GetNextSibling(element); } return(array); }
void Update() { if (Input.GetKeyDown(KeyCode.Escape) && !anyScreenActive()) { clickPause(); } if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A)) { rotMe(true); } if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D)) { rotMe(false); } if (bonusTimer > 0) { bonusTimer -= Time.deltaTime * 1; if (bonusTimer <= 0) { bonusTimer = 0; bonusMultiplier = new SafeInt(0); } } if (time.GetValue() > 0 && allowTimer) { time = time - Time.deltaTime * 1; int normalTime = (int)time.GetValue(); timeText.text = "Time: " + (normalTime / 60) + ":" + (normalTime % 60 < 10?"0" : "") + normalTime % 60; } else if (time.GetValue() <= 0) { StartCoroutine(gameOver()); } }
void matchBlocks() { int bonusint = bonusMultiplier.GetValue(); GameObject btextScore = Instantiate(bonusText, Input.mousePosition + new Vector3(0, 30, 0), Quaternion.identity); if (bonusint >= 6) { GameObject btext = Instantiate(bonusText, Input.mousePosition, Quaternion.identity); if (bonusint >= 4 && bonusint <= 10) { btext.GetComponent <TextPopUp>().assign("Good", Color.yellow, 20); updateScore(10 + bonusMultiplier.GetValue() * 2, btextScore); } else if (bonusint >= 11 && bonusint <= 18) { btext.GetComponent <TextPopUp>().assign("Great", Color.blue, 25); updateScore(10 + bonusMultiplier.GetValue() * 3, btextScore); } else if (bonusint >= 19 && bonusint <= 28) { btext.GetComponent <TextPopUp>().assign("Splendid", Color.green, 30); updateScore(10 + bonusMultiplier.GetValue() * 4, btextScore); } else if (bonusint + 1 == allPairs) { audioSource.PlayOneShot(sound[1], 1); Instantiate(boomEffect, block2.gameObject.transform.position, transform.rotation); btext.GetComponent <TextPopUp>().assign("FLAWLESS", Color.white, 50); updateScore(100 + bonusMultiplier.GetValue() * 6, btextScore); } else { btext.GetComponent <TextPopUp>().assign("Excellent", Color.magenta, 35); updateScore(10 + bonusMultiplier.GetValue() * 5, btextScore); } } else { updateScore(10 + bonusMultiplier.GetValue(), btextScore); } bonusTimer = 3f; bonusMultiplier += new SafeInt(1); audioSource.PlayOneShot(sound[0], 1); Instantiate(effect, block1.gameObject.transform.position, transform.rotation); Instantiate(effect, block2.gameObject.transform.position, transform.rotation); blockScript.Remove(block1); blockScript.Remove(block2); /* * NOTE: * since Destroy(gameObject) driven me crazy, I decided * just to throw blocks out of screen and change their tag. * * //Destroy(block1.gameObject) * //Destroy(block2.gameObject) * * Here lies two hours of sorrow and madness */ block1.gameObject.transform.position = new Vector3(999, 999, 999); block2.gameObject.transform.position = new Vector3(999, 999, 999); block1.gameObject.tag = "defeated"; block2.gameObject.tag = "defeated"; UI_selected.texture = emptyTexture; UI_viewed.texture = emptyTexture; highlightSelected.transform.position = new Vector3(0, 0, -100); highlightViewed.transform.position = new Vector3(0, 0, -100); block1 = null; block2 = null; //any blocks left? if (anyBlocks()) { //check possible moves checkMoves(); } }
IEnumerator getLiveWeather() { WWW weatherRequest = new WWW("http://api.openweathermap.org/data/2.5/weather?q=" + currentLocation + "&units=metric" + "&APPID=" + APIKEY); //get our weather //Debug.Log (weatherRequest.url); yield return weatherRequest; if (weatherRequest.error == null || weatherRequest.error == "") { var N = JSON.Parse(weatherRequest.text); conditionName = N["weather"][0]["main"].Value; conditionID = new SafeInt(ParseUtil.numberParse(N["weather"][0]["id"].Value)); //Debug.Log(Mathf.RoundToInt(ParseUtil.numberParse(N["main"]["temp"].Value))); temperature = new SafeInt(Mathf.RoundToInt(ParseUtil.numberParse(N["main"]["temp"].Value))); cloudiness = new SafeInt(ParseUtil.numberParse(N["clouds"]["all"].Value)); humidity = new SafeInt(ParseUtil.numberParse(N["main"]["humidity"].Value)); sunrise = UnixTimeStampToDateTime(ParseUtil.numberParse(N["sys"]["sunrise"])); sunset = UnixTimeStampToDateTime(ParseUtil.numberParse(N["sys"]["sunset"])); } else { currentError = "Weather error: " + weatherRequest.error; } }
void IInGamePurchasesSetter.AddTotalStars(SafeInt starsAmount) { inGamePurchases.TotalStars += starsAmount; inGamePurchases.EstimatedCostInStars += starsAmount; }
public SafeIntTag(string id, string displayName, SafeInt safeInt) { Id = id; DisplayName = displayName; SafeInt = safeInt; }
//public SpriteRenderer lightOverlay; void Awake() { //Get LightMax From WeatherSync upperBound = w.lightMax; }
void OnLevelWasLoaded(int level) { upperBound = w.lightMax; sunlight = new SafeInt(0); darkness = new SafeInt(0); }