protected void SimulateBtn_Click(object sender, EventArgs e) { CourseHandler ch = new CourseHandler(); Course course = ch.GetCourse(Convert.ToInt32(CoursesDDL.SelectedValue)); if (Convert.ToInt32(CompletionDDL.SelectedValue) >= course.CompletionPercentage) { ScoreHandler sh = new ScoreHandler(); int score = sh.AddScore(Convert.ToInt32(CompletionDDL.SelectedValue), course.MaxScore, course.Id, Convert.ToInt32(UsersDDL.SelectedValue)); if (course.AchievementID > 0) { AchievementHandler ah = new AchievementHandler(); ah.GrantAchievement(Convert.ToInt32(UsersDDL.SelectedValue), course.AchievementID); Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Du har gennemført " + course.Name + " og dermed optjent en ny achievement. Du scorede " + score + " point ud af " + course.MaxScore + ".');", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Du har gennemført " + course.Name + ". Du scorede " + score + " point ud af " + course.MaxScore + ".');", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Du opfylder ikke kravene til at kunne gennemføre dette kursus.');", true); } }
// Update is called once per frame void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == "Player") { scoH.AddScore(scoreValue); this.transform.position = new Vector2(this.transform.position.x, this.transform.position.y - 10.0f); if (crateRender.sprite == kawa) { GameObject.Find("Main Camera").GetComponent <LevelCreator>().gameSpeed += 1.0f; player.clip = kawaS; } else { player.clip = monetkaS; } player.Play(); ran = Random.Range(1, 10); if (ran == 1) { crateRender.sprite = kawa; } else { crateRender.sprite = monetka; } } }
void OnTriggerEnter(Collider other) { if (other.GetComponent <BubbleMovement>() != null) { BubbleMovement bm = other.transform.GetComponent <BubbleMovement>(); switch (bm.bubbleType) { case BubbleMovement.BubbleType.bubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(pop, other.transform.position, other.transform.rotation); Destroy(other.transform.gameObject); break; case BubbleMovement.BubbleType.timeBubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(input.timePop, other.transform.position, other.transform.rotation); Destroy(other.transform.gameObject); break; case BubbleMovement.BubbleType.explodingBubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(input.explosion, other.transform.position, other.transform.rotation); Destroy(other.transform.gameObject); break; case BubbleMovement.BubbleType.laserBubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(input.laserpop, other.transform.position, other.transform.rotation); Destroy(other.transform.gameObject); input.laserModeCooldown = input.laserModeDelay; input.laserMode = true; break; } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("ScoreCollider")) { scoreHandler.AddScore(); } if (collision.gameObject.CompareTag("Pipe")) { dead = true; gameManager.Lose(); speed = 0; } }
// Update is called once per frame void Update() { //Moving towards the score if (fading == false) { Vector3 hookScorePosition = Camera.main.WorldToScreenPoint(basic.Hook.transform.position); float speed = combo.GetComboScoreUIMovementSpeed(); Vector3 differenceVector = (hookScorePosition - gameObject.transform.position); if (differenceVector.magnitude >= speed) { gameObject.transform.Translate(differenceVector.normalized * speed); } if (differenceVector.magnitude < speed) { fading = true; ScoreHandler scoreHandler = GameObject.Find("Manager").GetComponent <ScoreHandler>(); scoreHandler.AddScore(scoreHandler.GetComboScoreValue(), false, false); } } //Fading out else { float alphaFade = combo.GetComboScoreUIAlphaFade(); //TEXT FADING //Create a new colour that is equal to the text Color faded = selfText.GetComponent <Text>().color; //Minus the value we want to fade by faded.a = faded.a - alphaFade; //Set our text back to that colour selfText.GetComponent <Text>().color = faded; //IMAGE FADING //Use that same colour, but set it to the image's colour this time faded = selfImage.GetComponent <Image>().color; //Minus the faded value faded.a = faded.a - alphaFade; //And set it back selfImage.GetComponent <Image>().color = faded; } }
void OnTriggerEnter(Collider other) { if (other.GetComponent <BubbleMovement>() != null) { BubbleMovement bm = other.transform.GetComponent <BubbleMovement>(); switch (bm.bubbleType) { case BubbleMovement.BubbleType.bubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(pop, other.transform.position, other.transform.rotation); Destroy(other.transform.gameObject); break; default: break; } } }
void OnTriggerEnter2D(Collider2D hitInfo) { Asteroid asteroid = hitInfo.GetComponent <Asteroid>(); if (asteroid != null) { if (explosionRef != null) { ParticleSystem ps = Instantiate(explosionRef); ps.transform.position = asteroid.asteroid_rb.transform.position; ps.Play(); Destroy(ps.gameObject, ps.main.duration); } if (asteroid.a_type == Asteroid.asteroid_type.small) { ScoreHandler.AddScore(10); } if (asteroid.a_type == Asteroid.asteroid_type.medium) { asteroid.createSmallAsteroid(Random.Range(1, 3)); ScoreHandler.AddScore(20); //spawn small + points } if (asteroid.a_type == Asteroid.asteroid_type.large) { asteroid.createMediumAsteroid(Random.Range(1, 2)); ScoreHandler.AddScore(30); //spawn small or medium + points } asteroid.gameObject.SetActive(false); //Debug.Log(hitInfo.name); this.gameObject.SetActive(false); } }
void FixedUpdate() // przesuwanie calego obszaru gry - postac biegnie { if (startTime - Time.time % 5 == 0 && gameSpeed < 10) { gameSpeed += 0.2f; } if (!isMenu) { gameLayer.transform.position = new Vector2(gameLayer.transform.position.x - gameSpeed * Time.deltaTime, gameLayer.transform.position.y); } if (gameLayer.transform.childCount < activeTilesCount) // jezeli wykorzystywanych jest mniej niz 25 segmentow, pobierz segment z poza widoku kamery { spawnTile(); } //jezeli segment jest poza polem gry, przenies go do odpowiedniego miejsca gdzie bedzie czekal na ponowne wykorzystanie foreach (Transform child in gameLayer.transform) { if (child.position.x < outofbounceX) { switch (child.gameObject.name) { case "blok_lewy(Clone)": child.gameObject.transform.position = collectedTiles.transform.Find("gLeft").transform.position; child.gameObject.transform.parent = collectedTiles.transform.Find("gLeft").transform; break; case "blok_srodek(Clone)": if (waitCounter > 0) { waitCounter--; } child.gameObject.transform.position = collectedTiles.transform.Find("gMiddle").transform.position; child.gameObject.transform.parent = collectedTiles.transform.Find("gMiddle").transform; break; case "blok_prawy(Clone)": child.gameObject.transform.position = collectedTiles.transform.Find("gRight").transform.position; child.gameObject.transform.parent = collectedTiles.transform.Find("gRight").transform; break; case "blank(Clone)": child.gameObject.transform.position = collectedTiles.transform.Find("gBlank").transform.position; child.gameObject.transform.parent = collectedTiles.transform.Find("gBlank").transform; break; case "Monetka(Clone)": child.gameObject.transform.position = collectedTiles.transform.Find("tCoins").transform.position; child.gameObject.transform.parent = collectedTiles.transform.Find("tCoins").transform; break; case "Reward": // tu pickupy GameObject.Find("Reward").GetComponent <crateScript> ().inPlay = false; break; default: Destroy(child.gameObject); break; } scoH.AddScore(1); } } if (coinCounter == 0 && waitCounter == 0) { coinCounter = (int)Random.Range(5, 8); waitCounter = Random.Range(6, 13); } }
void AndroidControl() { if (Input.touchCount > 0) { /* Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); * RaycastHit hit; * if (Physics.Raycast(ray, out hit, Mathf.Infinity, bubbleLayer)) * { * Debug.Log(hit.point); * Destroy(hit.transform.gameObject); * } */ foreach (Touch t in Input.touches) { Ray ray = Camera.main.ScreenPointToRay(t.position); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, bubbleLayer)) { BubbleMovement bm = hit.transform.GetComponent <BubbleMovement>(); switch (bm.bubbleType) { case BubbleMovement.BubbleType.bubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(deathpop, hit.transform.position, hit.transform.rotation); Destroy(hit.transform.gameObject); break; case BubbleMovement.BubbleType.deathBubble: tm.LoseTime(bm.timeFracture); Instantiate(pop, hit.transform.position, hit.transform.rotation); Destroy(hit.transform.gameObject); break; case BubbleMovement.BubbleType.timeBubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(timePop, hit.transform.position, hit.transform.rotation); Destroy(hit.transform.gameObject); break; case BubbleMovement.BubbleType.explodingBubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(explosion, hit.transform.position, hit.transform.rotation); Destroy(hit.transform.gameObject); break; case BubbleMovement.BubbleType.laserBubble: sh.AddScore(); tm.AddTime(bm.timeFracture); Instantiate(laserpop, hit.transform.position, hit.transform.rotation); Destroy(hit.transform.gameObject); laserMode = true; break; } /* * if (bm.hostile) * { * tm.LoseTime(bm.timeFracture); * Instantiate(pop, hit.transform.position, hit.transform.rotation); * Destroy(hit.transform.gameObject); * } * else if (!bm.hostile) * { * sh.AddScore(); * tm.AddTime(bm.timeFracture); * Instantiate(deathpop, hit.transform.position, hit.transform.rotation); * Destroy(hit.transform.gameObject); * } * */ } } } }
public void AddScore(int amount) { sh.AddScore(amount); }