示例#1
0
    void FixedUpdate()
    {
        if (/*(rotation > -45)&*/ Game.isPlaying)
        {
            rotation         -= Min(10, Pow(1.3f, rotationVelocity) * Time.deltaTime);
            rotationVelocity += 1;
        }
        if (!Game.isTyping && Input.GetKeyDown(KeyCode.Space))
        {
            if ((rotation < -290) && (ScoreSystem.GetScore() > 0))
            {
                ScoreSystem.AddPoint();
            }
            Game.isPlaying   = rb2d.simulated = true;
            rb2d.velocity    = Vector2.up * speed;
            rotationVelocity = 0;
            rotation         = 60f;
        }
        else if (!Game.isPlaying)
        {
            rb2d.simulated = false;
            rb2d.velocity  = Vector2.zero;
            var pos = transform.position;
            pos.y = Mathf.Sin(Time.time * 4f) * 0.15f;
            transform.position = pos;
            rotation           = 0;
        }
        var rot = transform.rotation;

        rot.eulerAngles    = new Vector3(0f, 0f, rotation);
        transform.rotation = rot;
    }
示例#2
0
 void OnTriggerEnter2D(Collider2D c)
 {
     if (c.transform.tag == "Score")
     {
         ScoreSystem.AddPoint();
     }
 }
示例#3
0
 void OnTriggerEnter(Collider other) // When Player gets a point
 {
     if (other.gameObject.name == "Player")
     {
         Debug.Log("working");
         point_sfx = GameObject.Find("ScoreSound").GetComponent <AudioSource>();
         ScoreSystem.AddPoint();
         MovementScript.SpeedUp();
         point_sfx.Stop();
         point_sfx.Play();
         Destroy(this.gameObject);
     }
 }
示例#4
0
 public void TakeDamage(Vector3 impactPoint)
 {
     Instantiate(_hitPrefab, impactPoint, transform.rotation);
     _audioSource.clip = _hitSfx;
     _audioSource?.Play();
     _currentHealth--;
     if (_currentHealth <= 0)
     {
         Instantiate(_explosionPrefab, impactPoint, transform.rotation);
         _audioSource.clip = _explosionSfx;
         _audioSource?.Play();
         ScoreSystem.AddPoint(_rewardPoint);
         gameObject.SetActive(false);
     }
 }