예제 #1
0
파일: Player.cs 프로젝트: teinf/VIKK-ARENA
    private void HandleShooting()
    {
        if (timeBtwLastShot >= fireRate)
        {
            canShoot = true;
        }

        if (Input.GetMouseButton(0) && canShoot && !isShielding)
        {
            Vector3 spreadOffset = new Vector3(Random.Range(-1, 1), Random.Range(-1, 1), 0);
            Bullet.Create(GetPosition(), GameAssets.ToMouseDirection(GetPosition() + spreadOffset / 2, Input.mousePosition));
            timeBtwLastShot = 0;
            canShoot        = false;
        }
        timeBtwLastShot += Time.deltaTime;
    }
예제 #2
0
파일: Player.cs 프로젝트: teinf/VIKK-ARENA
 private void HandleRotation()
 {
     mouse = GameAssets.ToMouseDirection(transform.position, Input.mousePosition);
     angle = Mathf.Atan2(mouse.y, mouse.x) * Mathf.Rad2Deg * Time.timeScale;
     transform.rotation = Quaternion.AngleAxis(angle - 180, Vector3.forward);
 }