private void OnInputDown(EventData eventData) { if (grid.CanPlacePiece(activePiece, Vector2iUtils.down)) { grid.MovePiece(activePiece, Vector2iUtils.down); scoreText.AddScore(1); } else { dropTime = 1; } }
// Update is called once per frame void Update() { if (bRunning && player) { Vector3 direction = transform.position - player.transform.position; direction = direction.normalized * 2f * runningModifier * Time.deltaTime; direction.y = 0; rb.MovePosition(transform.position + direction); transform.LookAt(transform.position + direction); an.SetBool("Moving", true); scoreController.AddScore(Time.deltaTime * 100f); } else { an.SetBool("Moving", false); } if (runningModifier != 1f) { runningModifier = Mathf.Lerp(runningModifier, 1f, 1.3f * Time.deltaTime); if (runningModifier < 1.4f) { runningModifier = 1f; } } else { exclamation.SetActive(false); } }
public void LoseLife(int amount, string byWhat) { lives -= amount; if (lives <= 0 && byWhat == "Poison") { Destroy(gameObject); } else if (lives <= 0 && byWhat == "Player") { currentKills.AddKills(); scoreText.AddScore(score); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.GetComponent <Ball>() is Ball b) { textSpawner.SpawnDropText(b.Username, textTarget); } if (name.ToUpper().Contains("LAME")) { _scoreText.RemoveScore(); } else { _scoreText.AddScore(); } }
/// <summary> /// 得点を加算するアニメーションを行う。 /// </summary> /// <param name="point">加算される得点。</param> void AddPoint(ulong point) { Score += point; addedScoreText.Show("+" + point.ToString()); scoreText.AddScore(point); }